Skip to content

Commit

Permalink
whoops, no need to generate stats msgp anymore (#2964)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgajg1134 authored Nov 5, 2024
1 parent d846308 commit c9fc691
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ddtrace/tracer/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestLogSamplingRules(t *testing.T) {
tp := new(log.RecordLogger)
tp.Ignore("appsec: ", telemetry.LogPrefix)
t.Setenv("DD_TRACE_SAMPLING_RULES", `[{"service": "some.service", "sample_rate": 0.234}, {"service": "other.service"}, {"service": "last.service", "sample_rate": 0.56}, {"odd": "pairs"}, {"sample_rate": 9.10}]`)
_, _, _, stop := startTestTracer(t, WithLogger(tp))
_, _, _, stop := startTestTracer(t, WithLogger(tp), WithEnv("test"))
defer stop()

assert.Len(tp.Logs(), 1)
Expand All @@ -159,7 +159,7 @@ func TestLogDefaultSampleRate(t *testing.T) {
tp.Ignore("appsec: ", telemetry.LogPrefix)
log.UseLogger(tp)
t.Setenv("DD_TRACE_SAMPLE_RATE", ``)
_, _, _, stop := startTestTracer(t, WithLogger(tp))
_, _, _, stop := startTestTracer(t, WithLogger(tp), WithEnv("test"))
defer stop()

assert.Len(tp.Logs(), 0)
Expand Down
4 changes: 1 addition & 3 deletions ddtrace/tracer/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016 Datadog, Inc.

//go:generate msgp -unexported -marshal=false -o=stats_msgp.go -tests=false

package tracer

import (
Expand Down Expand Up @@ -68,7 +66,7 @@ func newConcentrator(c *config, bucketSize int64) *concentrator {
// This should never actually happen as the agent MUST have an env configured to start-up
// That panic will be removed in a future release at which point we can remove this
env = "unknown-env"
log.Error("No DD Env found, normally the agent MUST have one")
log.Debug("No DD Env found, normally the agent should have one")
}
aggKey := stats.PayloadAggregationKey{
Hostname: c.hostname,
Expand Down
5 changes: 3 additions & 2 deletions ddtrace/tracer/textmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import (
"gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames"
"gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry"

"github.com/DataDog/datadog-go/v5/statsd"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/DataDog/datadog-go/v5/statsd"
)

const otelHeaderPropagationStyle = "OTEL_PROPAGATORS"
Expand Down Expand Up @@ -2001,7 +2002,7 @@ func TestNonePropagator(t *testing.T) {
t.Setenv(headerPropagationStyleInject, "none,b3")
tp := new(log.RecordLogger)
tp.Ignore("appsec: ", telemetry.LogPrefix)
tracer := newTracer(WithLogger(tp))
tracer := newTracer(WithLogger(tp), WithEnv("test"))
defer tracer.Stop()
// reinitializing to capture log output, since propagators are parsed before logger is set
tracer.config.propagator = NewPropagator(&PropagatorConfig{})
Expand Down
4 changes: 2 additions & 2 deletions ddtrace/tracer/tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ func TestTracerRuntimeMetrics(t *testing.T) {
t.Run("on", func(t *testing.T) {
tp := new(log.RecordLogger)
tp.Ignore("appsec: ", telemetry.LogPrefix)
tracer := newTracer(WithRuntimeMetrics(), WithLogger(tp), WithDebugMode(true))
tracer := newTracer(WithRuntimeMetrics(), WithLogger(tp), WithDebugMode(true), WithEnv("test"))
defer tracer.Stop()
assert.Contains(t, tp.Logs()[0], "DEBUG: Runtime metrics enabled")
})
Expand All @@ -721,7 +721,7 @@ func TestTracerRuntimeMetrics(t *testing.T) {
t.Setenv("DD_RUNTIME_METRICS_ENABLED", "true")
tp := new(log.RecordLogger)
tp.Ignore("appsec: ", telemetry.LogPrefix)
tracer := newTracer(WithLogger(tp), WithDebugMode(true))
tracer := newTracer(WithLogger(tp), WithDebugMode(true), WithEnv("test"))
defer tracer.Stop()
assert.Contains(t, tp.Logs()[0], "DEBUG: Runtime metrics enabled")
})
Expand Down

0 comments on commit c9fc691

Please sign in to comment.