Package
OpenTelemetry
Is your feature request related to a problem?
I was looking through profiles for an OTel instrumented application of mine, and noticed that code related to self-diagnostics was consistently showing up in the top 5 allocation samples:
This is essentially because SelfDiagnosticsConfigRefresher is running in the background every 10 seconds for the lifetime of the application to see if OTEL_DIAGNOSTICS.json appears/changes to update the configuration:
|
private async Task Worker(CancellationToken cancellationToken) |
|
{ |
|
await Task.Delay(ConfigurationUpdatePeriodMilliSeconds, cancellationToken).ConfigureAwait(false); |
|
while (!cancellationToken.IsCancellationRequested) |
|
{ |
|
this.UpdateMemoryMappedFileFromConfiguration(); |
|
await Task.Delay(ConfigurationUpdatePeriodMilliSeconds, cancellationToken).ConfigureAwait(false); |
|
} |
|
} |
In a production, especially containerised, environment this seems wasteful - if the file didn't exist on start-up, it is unlikely to ever appear, and if it does exist, it's unlikely to be updated.
A way to opt-out of this always-on functionality would provide an efficiency, albeit small, improvement for production environments or when an application is not being actively troubleshooted.
What is the expected behavior?
An opt-in (potentially with intelligent defaults) mechanism to allow the background work to be disabled by the user.
Possible intelligent defaults could include:
- Only refresh for updates if the file existed on start-up
- Only refresh for updates by default in debug
- Only refresh in ASP.NET Core applications if the DOTNET_ENVIRONMENT is
Development
Which alternative solutions or features have you considered?
None.
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Package
OpenTelemetry
Is your feature request related to a problem?
I was looking through profiles for an OTel instrumented application of mine, and noticed that code related to self-diagnostics was consistently showing up in the top 5 allocation samples:
This is essentially because
SelfDiagnosticsConfigRefresheris running in the background every 10 seconds for the lifetime of the application to see ifOTEL_DIAGNOSTICS.jsonappears/changes to update the configuration:opentelemetry-dotnet/src/OpenTelemetry/Internal/SelfDiagnosticsConfigRefresher.cs
Lines 130 to 138 in bfa5afc
In a production, especially containerised, environment this seems wasteful - if the file didn't exist on start-up, it is unlikely to ever appear, and if it does exist, it's unlikely to be updated.
A way to opt-out of this always-on functionality would provide an efficiency, albeit small, improvement for production environments or when an application is not being actively troubleshooted.
What is the expected behavior?
An opt-in (potentially with intelligent defaults) mechanism to allow the background work to be disabled by the user.
Possible intelligent defaults could include:
DevelopmentWhich alternative solutions or features have you considered?
None.
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.