Skip to content

Commit

Permalink
[chore] Fix args order to ptracetest/CompareSpan (open-telemetry#31716)
Browse files Browse the repository at this point in the history
**Description:**

Pass the correct `expected, actual` variables to CompareSpan fns in
ptracetest. The errors show the reverse expected and actual trace due to
this.

**Testing:** 
Updated unit tests - swapped the actual/expected yamls for impacted
tests.

---------

Co-authored-by: Curtis Robert <[email protected]>
  • Loading branch information
jinja2 and crobert-1 committed Mar 12, 2024
1 parent a1e0e60 commit 6e418b1
Show file tree
Hide file tree
Showing 43 changed files with 47 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resourceSpans:
- attributes:
- key: testKey2
value:
stringValue: teststringvalue2
stringValue: unpredictable
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resourceSpans:
- attributes:
- key: testKey2
value:
stringValue: unpredictable
stringValue: teststringvalue2
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ resourceSpans:
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
endTimeUnixNano: "11651379494838206464"
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5

Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ resourceSpans:
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
endTimeUnixNano: "11651379494838206464"
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
2 changes: 0 additions & 2 deletions pkg/pdatatest/ptracetest/testdata/ignore-spanid/actual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ resourceSpans:
stringValue: value1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5

Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ resourceSpans:
stringValue: value1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ resourceSpans:
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
startTimeUnixNano: "11651379494838206464"
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5

Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ resourceSpans:
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
startTimeUnixNano: "11651379494838206464"
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
2 changes: 0 additions & 2 deletions pkg/pdatatest/ptracetest/testdata/ignore-traceid/actual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ resourceSpans:
parentSpanId: ""
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5

Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ resourceSpans:
parentSpanId: ""
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resourceSpans:
- attributes:
- key: key2
value:
stringValue: value2
stringValue: value3
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resourceSpans:
- attributes:
- key: key2
value:
stringValue: value3
stringValue: value2
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
droppedAttributesCount: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ resourceSpans:
- key: key1
value:
stringValue: value1
droppedAttributesCount: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
droppedEventsCount: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ resourceSpans:
- key: key1
value:
stringValue: value1
droppedEventsCount: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
droppedLinksCount: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ resourceSpans:
- key: key1
value:
stringValue: value1
droppedLinksCount: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
endTimeUnixNano: "11651379494838206464"
endTimeUnixNano: "11651379494838206400"
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
endTimeUnixNano: "11651379494838206400"
endTimeUnixNano: "11651379494838206464"
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ resourceSpans:
- key: key1
value:
stringValue: value1
events:
- name: Sub span event
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ resourceSpans:
- key: key1
value:
stringValue: value1
events:
- name: Sub span event
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resourceSpans:
value:
stringValue: value1
events:
- name: event1
- name: event2
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resourceSpans:
value:
stringValue: value1
events:
- name: event2
- name: event1
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
kind: 2
kind: 1
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
kind: 1
kind: 2
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ resourceSpans:
- key: key1
value:
stringValue: value1
links:
- attributes:
- key: testKey1
value:
stringValue: teststringvalue1
- key: testKey2
value:
stringValue: teststringvalue2
spanId: fd0da883bb27cd6b
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ resourceSpans:
- key: key1
value:
stringValue: value1
links:
- attributes:
- key: testKey1
value:
stringValue: teststringvalue1
- key: testKey2
value:
stringValue: teststringvalue2
spanId: fd0da883bb27cd6b
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
parentSpanId: ""
spanId: ""
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resourceSpans:
value:
stringValue: value1
links:
- spanId: ""
- spanId: fd0da883bb27cd6b
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
parentSpanId: ""
spanId: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resourceSpans:
value:
stringValue: value1
links:
- spanId: fd0da883bb27cd6b
- spanId: ""
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
parentSpanId: ""
spanId: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
parentSpanId: bcff497b5a47310f
parentSpanId: 310fbcff497b5a47
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resourceSpans:
- key: key1
value:
stringValue: value1
parentSpanId: 310fbcff497b5a47
parentSpanId: bcff497b5a47310f
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ resourceSpans:
value:
stringValue: value1
parentSpanId: ""
spanId: fd0da883bb27cd6b
spanId: d0dfa883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ resourceSpans:
value:
stringValue: value1
parentSpanId: ""
spanId: d0dfa883bb27cd6b
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ resourceSpans:
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
startTimeUnixNano: "11651379494838206464"
startTimeUnixNano: "11651379494838206400"
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ resourceSpans:
name: span1
parentSpanId: ""
spanId: fd0da883bb27cd6b
startTimeUnixNano: "11651379494838206400"
startTimeUnixNano: "11651379494838206464"
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ resourceSpans:
stringValue: value1
parentSpanId: ""
spanId: ""
status:
code: 1
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ resourceSpans:
stringValue: value1
parentSpanId: ""
spanId: ""
status: {}
status:
code: 1
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ resourceSpans:
parentSpanId: ""
spanId: ""
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
traceId: b8cb1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ resourceSpans:
parentSpanId: ""
spanId: ""
status: {}
traceId: b8cb1765a7b0acf0b66aa4623fcb7bd5
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ resourceSpans:
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
traceState: xx
traceState: yy
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ resourceSpans:
spanId: fd0da883bb27cd6b
status: {}
traceId: 8c8b1765a7b0acf0b66aa4623fcb7bd5
traceState: yy
traceState: xx
6 changes: 3 additions & 3 deletions pkg/pdatatest/ptracetest/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func CompareScopeSpans(expected, actual ptrace.ScopeSpans) error {
}

for as, es := range matchingSpans {
errs = multierr.Append(errs, internal.AddErrPrefix(fmt.Sprintf(`span "%s"`, es.Name()), CompareSpan(as, es)))
errs = multierr.Append(errs, internal.AddErrPrefix(fmt.Sprintf(`span "%s"`, es.Name()), CompareSpan(es, as)))
}

return errs
Expand Down Expand Up @@ -340,7 +340,7 @@ func compareSpanEventSlice(expected, actual ptrace.SpanEventSlice) (errs error)
}

for ae, ee := range matchingSpanEvents {
errs = multierr.Append(errs, internal.AddErrPrefix(fmt.Sprintf(`span event "%s"`, ee.Name()), CompareSpanEvent(ae, ee)))
errs = multierr.Append(errs, internal.AddErrPrefix(fmt.Sprintf(`span event "%s"`, ee.Name()), CompareSpanEvent(ee, ae)))
}

return errs
Expand Down Expand Up @@ -420,7 +420,7 @@ func compareSpanLinkSlice(expected, actual ptrace.SpanLinkSlice) (errs error) {
}

for al, el := range matchingSpanLinks {
errs = multierr.Append(errs, internal.AddErrPrefix(fmt.Sprintf(`span link "%s"`, el.SpanID()), CompareSpanLink(al, el)))
errs = multierr.Append(errs, internal.AddErrPrefix(fmt.Sprintf(`span link "%s"`, el.SpanID()), CompareSpanLink(el, al)))
}

return errs
Expand Down

0 comments on commit 6e418b1

Please sign in to comment.