From 69337be603be99438569a9ba71fb5f122b142779 Mon Sep 17 00:00:00 2001 From: Marc Lopez Rubio Date: Tue, 1 Aug 2023 12:04:43 +0500 Subject: [PATCH] tracing: Start `Stream` span at the top 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 --- input/elasticapm/processor.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/input/elasticapm/processor.go b/input/elasticapm/processor.go index 45654250..eb79eb98 100644 --- a/input/elasticapm/processor.go +++ b/input/elasticapm/processor.go @@ -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 @@ -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