Review Exporter Settings#2455
Conversation
Benchmarks Report 🐌Benchmarks for #2455 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️Raw results
|
Add the URL as the first parameter to consider Change the tests as well to order them by order of precedence
There's one use case that still throws, not sure what to do yet
Adds a builder to do it to keep the object immutable Changes the tests Adapted the checkAgentCommand
... by checking default values all the time
Based on the same system as used in DirectLogsSubmissionsSettings
Note that it is a breaking change
a100c5c to
e445c99
Compare
it was used only in tests and it doesn't seem we are going further down this road
| { | ||
| if (!Uri.TryCreate(traceAgentUrl, UriKind.RelativeOrAbsolute, out var uri)) | ||
| { | ||
| ValidationWarnings.Add($"The provided Uri: ${traceAgentUrl} provided in '{ConfigurationKeys.AgentUri}' is not valid. It won't be taken into account to send traces."); |
There was a problem hiding this comment.
| ValidationWarnings.Add($"The provided Uri: ${traceAgentUrl} provided in '{ConfigurationKeys.AgentUri}' is not valid. It won't be taken into account to send traces."); | |
| ValidationWarnings.Add($"The Uri '${traceAgentUrl}' provided in '{ConfigurationKeys.AgentUri}' is not valid. It won't be taken into account to send traces."); |
| var traceAgentUrl = source?.GetString(ConfigurationKeys.AgentUri); | ||
| if (!string.IsNullOrWhiteSpace(traceAgentUrl)) | ||
| { | ||
| if (!Uri.TryCreate(traceAgentUrl, UriKind.RelativeOrAbsolute, out var uri)) |
There was a problem hiding this comment.
nit: could we invert the if here?
| public int PartialFlushMinSpans { get; set; } | ||
| public string TracesPipeName { get; set; } | ||
| public int TracesPipeTimeoutMs { get; set; } | ||
| public string TracesUnixDomainSocketPath { get; set; } |
There was a problem hiding this comment.
This shouldn't have gone I don't think 🤔
There was a problem hiding this comment.
This is correct, TracesUnixDomainSocketPath got removed from ExporterSettings here but it is still present on the ImmutableExporterSettings type if you expand below
There was a problem hiding this comment.
This was removed intentionally as it had been added only for .NET. (cf PR description)
This is the reason why Lucas rightfully asked me to document these settings (cf https://github.com/DataDog/architecture/pull/1000)
| }; | ||
|
|
||
| var tracerSettings = new TracerSettings(new NameValueConfigurationSource(settings)); | ||
| var tracerSettings = new ImmutableTracerSettings(new TracerSettings(new NameValueConfigurationSource(settings))); |
There was a problem hiding this comment.
I'm a little on the fence, but I feel like this test belongs in ImmutableExporterSettingsTests since that is where the replacement of localhost occurs
| [Fact] | ||
| public void Traces_SocketFilesExist_ExplicitTraceAgentPort_UsesDefaultHttp() | ||
| { | ||
| // AgentPort isn't settable directly, so goinng a config source as a user would |
There was a problem hiding this comment.
| // AgentPort isn't settable directly, so goinng a config source as a user would | |
| // AgentPort isn't settable directly, so setting via a config source as a user would |
| var immutableExporterSettings = Setup(FileExistsMock(ExporterSettings.DefaultMetricsUnixDomainSocket), new ExporterSettings()); | ||
| Assert.Equal(expected: MetricsTransportType.UDS, actual: immutableExporterSettings.MetricsTransport); | ||
| Assert.Equal(expected: ExporterSettings.DefaultMetricsUnixDomainSocket, actual: immutableExporterSettings.MetricsUnixDomainSocketPath); | ||
| CheckDefaultValues(immutableExporterSettings, "MetricsTransport", "MetricsUnixDomainSocketPath", "DogStatsdPort"); |
There was a problem hiding this comment.
Should we assert DogStatsdPort to be 0 in this instance?
zacharycmontoya
left a comment
There was a problem hiding this comment.
LGTM with some minor comments
Summary of changes
I've removed
DD_APM_RECEIVER_SOCKETas it should not have been added. As it is not documented, we agreed with Lucas that it was ok to break the public API. I've also cleaned the settings to reintroduceTraceAgentUrias the first parameter to take into account and make more explicit the order of precedence. Finally, I've removed the TCP Strategy as it wasn't used and as it doesn't seem we want to go further down that road.Reason for change
A regression had been introduced as we were not using the Trace Agent Uri as the primary parameter to take into account. We've also seen that we may be able to improve how we configure the transport when Kevin developed the Agent checks in the CLI tool.
Implementation details
Regarding the settings refactoring:
DD_APM_RECEIVER_SOCKETTraceAgentUrias the first parameter to take into accountTesting
Tried to add as much testing as I could by testing both
ExporterSettings,ImmutableExporterSettingschecking both the modified values and the ones that should have stayed with their default values.Fixes #2426 (hopefully:))