Skip to content

Commit

Permalink
Do not create spans from batch queries if parent span is not recordin…
Browse files Browse the repository at this point in the history
…g. (#36)
  • Loading branch information
n-g authored Jun 26, 2024
1 parent ae3a123 commit 2557a24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ func (t *Tracer) TraceBatchStart(ctx context.Context, conn *pgx.Conn, data pgx.T

// TraceBatchQuery is called at the after each query in a batch.
func (t *Tracer) TraceBatchQuery(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchQueryData) {
if !trace.SpanFromContext(ctx).IsRecording() {
return
}

opts := []trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindClient),
trace.WithAttributes(t.attrs...),
Expand Down

0 comments on commit 2557a24

Please sign in to comment.