Skip to content

Commit

Permalink
tracing: Start Stream span at the top
Browse files Browse the repository at this point in the history
Move the `StartSpan` call  at the top of the `processor.HandleStream`
function so the semaphore acquisition is also tracked, not only the
stream handling.

Signed-off-by: Marc Lopez Rubio <[email protected]>
  • Loading branch information
marclop committed Aug 1, 2023
1 parent 31428f0 commit 69337be
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions input/elasticapm/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ func (p *Processor) HandleStream(
processor modelpb.BatchProcessor,
result *Result,
) error {
sp, ctx := apm.StartSpan(ctx, "Stream", "Reporter")
defer sp.End()
// Limit the number of concurrent batch decodes.
//
// The semaphore defaults to 200 (N), only allowing N requests to read
Expand Down Expand Up @@ -282,9 +284,6 @@ func (p *Processor) HandleStream(
}
}

sp, ctx := apm.StartSpan(ctx, "Stream", "Reporter")
defer sp.End()

if async {
// The semaphore is released by handleStream
shouldReleaseSemaphore = false
Expand Down

0 comments on commit 69337be

Please sign in to comment.