Skip to content

Commit

Permalink
try again to make sure all tests passes
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <[email protected]>
  • Loading branch information
eliottness committed Feb 7, 2025
1 parent b96eb2a commit ea8d4bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions ddtrace/tracer/dynamic_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ func (dc *dynamicConfig[T]) handleRC(val *T) bool {
func (dc *dynamicConfig[T]) toTelemetry() telemetry.Configuration {
dc.RLock()
defer dc.RUnlock()
value := telemetry.SanitizeConfigValue(dc.current)
return telemetry.Configuration{
Name: dc.cfgName,
Value: value,
Value: dc.current,
Origin: dc.cfgOrigin,
}
}
Expand Down
9 changes: 2 additions & 7 deletions ddtrace/tracer/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,8 @@ func TestTelemetryEnabled(t *testing.T) {
defer globalconfig.SetServiceName("")
defer Stop()

assert.True(t, telemetryClient.Started)
var cfgs []telemetry.Configuration
for _, c := range telemetryClient.Configuration {
c.Value = telemetry.SanitizeConfigValue(c.Value)
}
telemetrytest.CheckConfig(t, cfgs, "trace_sample_rules", "[]")
telemetrytest.CheckConfig(t, cfgs, "span_sample_rules", "[]")
telemetrytest.CheckConfig(t, telemetryClient.Configuration, "trace_sample_rules", "[]")
telemetrytest.CheckConfig(t, telemetryClient.Configuration, "span_sample_rules", "[]")
})

t.Run("profiler start, tracer start", func(t *testing.T) {
Expand Down
8 changes: 5 additions & 3 deletions internal/telemetry/telemetrytest/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,15 @@ func (r *RecordClient) ProductStartError(product telemetry.Namespace, _ error) {
}

func (r *RecordClient) RegisterAppConfig(key string, value any, origin telemetry.Origin) {
r.mu.Lock()
defer r.mu.Unlock()
r.Configuration = append(r.Configuration, telemetry.Configuration{Name: key, Value: value, Origin: origin})
r.RegisterAppConfigs(telemetry.Configuration{Name: key, Value: value, Origin: origin})
}

func (r *RecordClient) RegisterAppConfigs(kvs ...telemetry.Configuration) {
r.mu.Lock()
defer r.mu.Unlock()
for i := range kvs {
kvs[i].Value = telemetry.SanitizeConfigValue(kvs[i].Value)
}
r.Configuration = append(r.Configuration, kvs...)
}

Expand All @@ -189,6 +190,7 @@ func (r *RecordClient) AppStop() {
}

func CheckConfig(t *testing.T, cfgs []telemetry.Configuration, key string, value any) {
t.Helper()
for _, c := range cfgs {
if c.Name == key && reflect.DeepEqual(c.Value, value) {
return
Expand Down

0 comments on commit ea8d4bb

Please sign in to comment.