Skip to content

Commit

Permalink
(otelarrowreceiver): Start span after extracted context is returned (#…
Browse files Browse the repository at this point in the history
…224)

Start the `otel_arrow_stream_recv` span after `hrcv.combineHeaders`
returns an extracted context that contains the data path trace.
Otherwise this span is only a child of the stream inflight trace.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
  • Loading branch information
moh-osman3 and jmacd authored Jun 12, 2024
1 parent 7bc16c7 commit dd6e224
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions collector/receiver/otelarrowreceiver/internal/arrow/arrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,6 @@ func (r *receiverStream) recvOne(streamCtx context.Context, serverStream anyStre
inflightCtx, flight := r.newInFlightData(streamCtx, method, req.GetBatchId(), pendingCh)
defer flight.recvDone(inflightCtx, &retErr)

// this span is a child of the inflight, covering the Arrow decode, Auth, etc.
inflightCtx, span := r.tracer.Start(inflightCtx, "otel_arrow_stream_recv")
defer span.End()

if err != nil {
if errors.Is(err, io.EOF) {
return status.Error(codes.Canceled, "client stream shutdown")
Expand All @@ -575,6 +571,11 @@ func (r *receiverStream) recvOne(streamCtx context.Context, serverStream anyStre
return status.Errorf(codes.Internal, "arrow metadata error: %v", err)
}

// start this span after hrcv.combineHeaders returns extracted context. This will allow this span
// to be a part of the data path trace instead of only being included as a child of the stream inflight trace.
inflightCtx, span := r.tracer.Start(inflightCtx, "otel_arrow_stream_recv")
defer span.End()

// Authorize the request, if configured, prior to acquiring resources.
if r.authServer != nil {
var authErr error
Expand Down

0 comments on commit dd6e224

Please sign in to comment.