-
Notifications
You must be signed in to change notification settings - Fork 151
Add fix for not re-reporting telemetry when there are "empty" dynamic config changes #7796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,8 +125,6 @@ internal TracerSettings(IConfigurationSource? source, IConfigurationTelemetry te | |
| .AsBoolResult() | ||
| .OverrideWith(in otelActivityListenerEnabled, ErrorLog, defaultValue: false); | ||
|
|
||
| var exporter = new ExporterSettings(source, _telemetry); | ||
|
|
||
| PeerServiceTagsEnabled = config | ||
| .WithKeys(ConfigurationKeys.PeerServiceDefaultsEnabled) | ||
| .AsBool(defaultValue: false); | ||
|
|
@@ -335,66 +333,6 @@ not null when string.Equals(value, "otlp", StringComparison.OrdinalIgnoreCase) = | |
|
|
||
| OpenTelemetryLogsEnabled = OpenTelemetryLogsEnabled && OtelLogsExporterEnabled; | ||
|
|
||
| DataPipelineEnabled = config | ||
| .WithKeys(ConfigurationKeys.TraceDataPipelineEnabled) | ||
| .AsBool(defaultValue: EnvironmentHelpers.IsUsingAzureAppServicesSiteExtension() && !EnvironmentHelpers.IsAzureFunctions()); | ||
|
|
||
| if (DataPipelineEnabled) | ||
| { | ||
| // Due to missing quantization and obfuscation in native side, we can't enable the native trace exporter | ||
| // as it may lead to different stats results than the managed one. | ||
| if (StatsComputationEnabled) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but {ConfigurationKeys.StatsComputationEnabled} is enabled. Disabling data pipeline."); | ||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
|
|
||
| // Windows supports UnixDomainSocket https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ | ||
| // but tokio hasn't added support for it yet https://github.com/tokio-rs/tokio/issues/2201 | ||
| // There's an issue here, in that technically a user can initially be configured to send over TCP/named pipes, | ||
| // and so we allow and enable the datapipeline. Later, they could configure the app in code to send over UDS. | ||
| // This is a problem, as we currently don't support toggling the data pipeline at runtime, so we explicitly block | ||
| // this scenario in the public API. | ||
| if (exporter.TracesTransport == TracesTransportType.UnixDomainSocket && FrameworkDescription.Instance.IsWindows()) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but TracesTransport is set to UnixDomainSocket which is not supported on Windows. Disabling data pipeline."); | ||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
|
|
||
| if (!isLibDatadogAvailable.IsAvailable) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| if (isLibDatadogAvailable.Exception is not null) | ||
| { | ||
| Log.Warning( | ||
| isLibDatadogAvailable.Exception, | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but libdatadog is not available. Disabling data pipeline."); | ||
| } | ||
| else | ||
| { | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but libdatadog is not available. Disabling data pipeline."); | ||
| } | ||
|
|
||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
|
|
||
| // SSI already utilizes libdatadog. To prevent unexpected behavior, | ||
| // we proactively disable the data pipeline when SSI is enabled. Theoretically, this should not cause any issues, | ||
| // but as a precaution, we are taking a conservative approach during the initial rollout phase. | ||
| if (!string.IsNullOrEmpty(EnvironmentHelpers.GetEnvironmentVariable("DD_INJECTION_ENABLED"))) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but SSI is enabled. Disabling data pipeline."); | ||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
| } | ||
|
|
||
| // We should also be writing telemetry for OTEL_LOGS_EXPORTER similar to OTEL_METRICS_EXPORTER, but we don't have a corresponding Datadog config | ||
| // When we do, we can insert that here | ||
| CustomSamplingRulesFormat = config.WithKeys(ConfigurationKeys.CustomSamplingRulesFormat) | ||
|
|
@@ -731,9 +669,70 @@ not null when string.Equals(value, "otlp", StringComparison.OrdinalIgnoreCase) = | |
| // We create a lazy here because this is kind of expensive, and we want to avoid calling it if we can | ||
| _fallbackApplicationName = new(() => ApplicationNameHelpers.GetFallbackApplicationName(this)); | ||
|
|
||
| // Move the creation of these settings inside SettingsManager? | ||
| var initialMutableSettings = MutableSettings.CreateInitialMutableSettings(source, telemetry, errorLog, this); | ||
| Manager = new(this, initialMutableSettings, exporter); | ||
| // There's a circular dependency here because DataPipeline depends on ExporterSettings, | ||
| // but the settings manager depends on TracerSettings. Basically this is all fine as long | ||
| // as nothing in the MutableSettings or ExporterSettings depends on the value of DataPipelineEnabled! | ||
| Manager = new(source, this, telemetry, errorLog); | ||
|
|
||
| DataPipelineEnabled = config | ||
| .WithKeys(ConfigurationKeys.TraceDataPipelineEnabled) | ||
| .AsBool(defaultValue: EnvironmentHelpers.IsUsingAzureAppServicesSiteExtension() && !EnvironmentHelpers.IsAzureFunctions()); | ||
|
|
||
| if (DataPipelineEnabled) | ||
| { | ||
| // Due to missing quantization and obfuscation in native side, we can't enable the native trace exporter | ||
| // as it may lead to different stats results than the managed one. | ||
| if (StatsComputationEnabled) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but {ConfigurationKeys.StatsComputationEnabled} is enabled. Disabling data pipeline."); | ||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
|
|
||
| // Windows supports UnixDomainSocket https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ | ||
| // but tokio hasn't added support for it yet https://github.com/tokio-rs/tokio/issues/2201 | ||
| // There's an issue here, in that technically a user can initially be configured to send over TCP/named pipes, | ||
| // and so we allow and enable the datapipeline. Later, they could configure the app in code to send over UDS. | ||
| // This is a problem, as we currently don't support toggling the data pipeline at runtime, so we explicitly block | ||
| // this scenario in the public API. | ||
| if (Manager.InitialExporterSettings.TracesTransport == TracesTransportType.UnixDomainSocket && FrameworkDescription.Instance.IsWindows()) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only change, we read the exporter settings that the |
||
| { | ||
| DataPipelineEnabled = false; | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but TracesTransport is set to UnixDomainSocket which is not supported on Windows. Disabling data pipeline."); | ||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
|
|
||
| if (!isLibDatadogAvailable.IsAvailable) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| if (isLibDatadogAvailable.Exception is not null) | ||
| { | ||
| Log.Warning( | ||
| isLibDatadogAvailable.Exception, | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but libdatadog is not available. Disabling data pipeline."); | ||
| } | ||
| else | ||
| { | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but libdatadog is not available. Disabling data pipeline."); | ||
| } | ||
|
|
||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
|
|
||
| // SSI already utilizes libdatadog. To prevent unexpected behavior, | ||
| // we proactively disable the data pipeline when SSI is enabled. Theoretically, this should not cause any issues, | ||
| // but as a precaution, we are taking a conservative approach during the initial rollout phase. | ||
| if (!string.IsNullOrEmpty(EnvironmentHelpers.GetEnvironmentVariable("DD_INJECTION_ENABLED"))) | ||
| { | ||
| DataPipelineEnabled = false; | ||
| Log.Warning( | ||
| $"{ConfigurationKeys.TraceDataPipelineEnabled} is enabled, but SSI is enabled. Disabling data pipeline."); | ||
| _telemetry.Record(ConfigurationKeys.TraceDataPipelineEnabled, false, ConfigurationOrigins.Calculated); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| internal bool IsRunningInCiVisibility { get; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| #nullable enable | ||
|
|
||
| using System; | ||
| using System.IO; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: Probably not needed |
||
| using System.Text; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
@@ -15,6 +16,7 @@ | |
| using Datadog.Trace.Logging; | ||
| using Datadog.Trace.PlatformHelpers; | ||
| using Datadog.Trace.RemoteConfigurationManagement.Protocol; | ||
| using Datadog.Trace.Util.Streams; | ||
| using Datadog.Trace.Vendors.Newtonsoft.Json; | ||
|
|
||
| namespace Datadog.Trace.RemoteConfigurationManagement.Transport | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has all just moved to the end of the constructor, cut and paste