Skip to content

Commit

Permalink
ddtrace/tracer: fix failing smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahkm committed Dec 12, 2024
1 parent f061f22 commit 236cb25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
7 changes: 0 additions & 7 deletions ddtrace/tracer/spancontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,6 @@ func (t *trace) push(sp *span) {
t.setSamplingPriorityLocked(int(v), samplernames.Unknown)
}
t.spans = append(t.spans, sp)
if haveTracer {
if sp.integration == "manual" {
atomic.AddUint32(&tr.spansStarted, 1)
} else {
tr.statsd.Count("datadog.tracer.spans_started", 1, []string{fmt.Sprintf("integration:%s", sp.integration)}, 1)
}
}
}

// setTraceTags sets all "trace level" tags on the provided span
Expand Down
14 changes: 10 additions & 4 deletions ddtrace/tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package tracer
import (
gocontext "context"
"encoding/binary"
"fmt"
"log/slog"
"math"
"os"
Expand Down Expand Up @@ -587,6 +588,10 @@ func (t *tracer) StartSpan(operationName string, options ...ddtrace.StartSpanOpt
}

}
span.context = newSpanContext(span, context)
span.setMetric(ext.Pid, float64(t.pid))
span.setMeta("language", "go")

// add tags from options
for k, v := range opts.Tags {
span.SetTag(k, v)
Expand All @@ -595,10 +600,6 @@ func (t *tracer) StartSpan(operationName string, options ...ddtrace.StartSpanOpt
for k, v := range t.config.globalTags.get() {
span.SetTag(k, v)
}
span.context = newSpanContext(span, context)
span.setMetric(ext.Pid, float64(t.pid))
span.setMeta("language", "go")

if t.config.serviceMappings != nil {
if newSvc, ok := t.config.serviceMappings[span.Service]; ok {
span.Service = newSvc
Expand Down Expand Up @@ -648,6 +649,11 @@ func (t *tracer) StartSpan(operationName string, options ...ddtrace.StartSpanOpt
log.Error("Abandoned spans channel full, disregarding span.")
}
}
if span.integration == "manual" {
atomic.AddUint32(&t.spansStarted, 1)
} else {
t.statsd.Count("datadog.tracer.spans_started", 1, []string{fmt.Sprintf("integration:%s", span.integration)}, 1)
}
return span
}

Expand Down

0 comments on commit 236cb25

Please sign in to comment.