Skip to content

Commit

Permalink
[awsxrayreceiver]: End obsreport span when poller loop completes succ…
Browse files Browse the repository at this point in the history
…essfully (open-telemetry#12299)

* [awsxrayreceiver]: End obsreport span when poller loop completes successfully

Signed-off-by: Anthony J Mirabella <[email protected]>

* Update expected span counts to account for poller spans now being finished

Signed-off-by: Anthony J Mirabella <[email protected]>

* Add PR# to changelog entry

Signed-off-by: Anthony J Mirabella <[email protected]>
  • Loading branch information
Aneurysm9 committed Jul 13, 2022
1 parent ba1889b commit ae57d43
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions receiver/awsxrayreceiver/internal/udppoller/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func (p *poller) poll() {
Payload: copybody,
Ctx: ctx,
}
p.obsrecv.EndTracesOp(ctx, awsxray.TypeStr, 1, nil)
}
}
}
2 changes: 1 addition & 1 deletion receiver/awsxrayreceiver/internal/udppoller/poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestSuccessfullyPollPacket(t *testing.T) {
}
}, 10*time.Second, 5*time.Millisecond, "poller should return parsed segment")

assert.NoError(t, obsreporttest.CheckReceiverTraces(tt, receiverID, Transport, 1, 0))
assert.NoError(t, obsreporttest.CheckReceiverTraces(tt, receiverID, Transport, 2, 0))
}

func TestIncompletePacketNoSeparator(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions receiver/awsxrayreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestTranslatorErrorsOut(t *testing.T) {
"X-Ray segment to OT traces conversion failed")
}, 10*time.Second, 5*time.Millisecond, "poller should log warning because consumer errored out")

assert.NoError(t, obsreporttest.CheckReceiverTraces(tt, receiverID, udppoller.Transport, 0, 1))
assert.NoError(t, obsreporttest.CheckReceiverTraces(tt, receiverID, udppoller.Transport, 1, 1))
}

func TestSegmentsConsumerErrorsOut(t *testing.T) {
Expand Down Expand Up @@ -194,7 +194,7 @@ func TestSegmentsConsumerErrorsOut(t *testing.T) {
"Trace consumer errored out")
}, 10*time.Second, 5*time.Millisecond, "poller should log warning because consumer errored out")

assert.NoError(t, obsreporttest.CheckReceiverTraces(tt, receiverID, udppoller.Transport, 0, 1))
assert.NoError(t, obsreporttest.CheckReceiverTraces(tt, receiverID, udppoller.Transport, 1, 1))
}

func TestPollerCloseError(t *testing.T) {
Expand Down
18 changes: 18 additions & 0 deletions unreleased/fix_xrayreceiver_pollingSpans.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: xrayreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Ensure that the UDP Poller ends the obsreport span it creates with every loop.

# One or more tracking issues related to the change
issues: [12299]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
This avoids a memory leak that can happen when spans are created to track received
segments but never ended.

0 comments on commit ae57d43

Please sign in to comment.