Skip to content

Commit 0676b57

Browse files
committed
migrate dynamicInstrumentationEnabled
1 parent a325530 commit 0676b57

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

ddtrace/tracer/option.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,6 @@ type config struct {
273273
// headerAsTags holds the header as tags configuration.
274274
headerAsTags dynamicConfig[[]string]
275275

276-
// dynamicInstrumentationEnabled controls if the target application can be modified by Dynamic Instrumentation or not.
277-
// Value from DD_DYNAMIC_INSTRUMENTATION_ENABLED, default false.
278-
dynamicInstrumentationEnabled bool
279-
280276
// ciVisibilityEnabled controls if the tracer is loaded with CI Visibility mode. default false
281277
ciVisibilityEnabled bool
282278

@@ -411,8 +407,6 @@ func newConfig(opts ...StartOption) (*config, error) {
411407
}
412408
c.statsComputationEnabled = internal.BoolEnv("DD_TRACE_STATS_COMPUTATION_ENABLED", true)
413409

414-
c.dynamicInstrumentationEnabled, _, _ = stableconfig.Bool("DD_DYNAMIC_INSTRUMENTATION_ENABLED", false)
415-
416410
namingschema.LoadFromEnv()
417411
c.spanAttributeSchemaVersion = int(namingschema.GetVersion())
418412

ddtrace/tracer/remote_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func (t *tracer) startRemoteConfig(rcConfig remoteconfig.ClientConfig) error {
384384

385385
var dynamicInstrumentationError, apmTracingError error
386386

387-
if t.config.dynamicInstrumentationEnabled {
387+
if t.config.internalConfig.DynamicInstrumentationEnabled() {
388388
_, liveDebuggingError := remoteconfig.Subscribe(
389389
"LIVE_DEBUGGING", t.dynamicInstrumentationRCUpdate,
390390
)

internal/config/config.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ type Config struct {
6060
partialFlushMinSpans int
6161
// partialFlushEnabled specifices whether the tracer should enable partial flushing. Value
6262
// from DD_TRACE_PARTIAL_FLUSH_ENABLED, default false.
63-
partialFlushEnabled bool
64-
statsComputationEnabled bool
65-
dataStreamsMonitoringEnabled bool
63+
partialFlushEnabled bool
64+
statsComputationEnabled bool
65+
dataStreamsMonitoringEnabled bool
66+
// dynamicInstrumentationEnabled controls if the target application can be modified by Dynamic Instrumentation or not.
6667
dynamicInstrumentationEnabled bool
6768
// globalSampleRate holds the sample rate for the tracer.
6869
globalSampleRate float64
@@ -312,3 +313,16 @@ func (c *Config) SetPartialFlushMinSpans(minSpans int, origin telemetry.Origin)
312313
c.partialFlushMinSpans = minSpans
313314
telemetry.RegisterAppConfig("DD_TRACE_PARTIAL_FLUSH_MIN_SPANS", minSpans, origin)
314315
}
316+
317+
func (c *Config) DynamicInstrumentationEnabled() bool {
318+
c.mu.RLock()
319+
defer c.mu.RUnlock()
320+
return c.dynamicInstrumentationEnabled
321+
}
322+
323+
func (c *Config) SetDynamicInstrumentationEnabled(enabled bool, origin telemetry.Origin) {
324+
c.mu.Lock()
325+
defer c.mu.Unlock()
326+
c.dynamicInstrumentationEnabled = enabled
327+
telemetry.RegisterAppConfig("DD_DYNAMIC_INSTRUMENTATION_ENABLED", enabled, origin)
328+
}

0 commit comments

Comments
 (0)