You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move DefaultServiceName to MutableSettings (#7530)
## Summary of changes
- Expose `DefaultServiceName` on `MutableSettings` instead of on
`TracerManager`
- Expose `MutableSettings` on `PerTraceSettings`
## Reason for change
The `DefaultServiceName` depends on `ServiceName`, which can change at
runtime, so `MutableSettings` seems like the best place for it
(eventually we will only have a single `TracerManager` and
`TracerSettings` per lifetime
> Note that this also solves an existing edge-case bug when customers do
config in code and already-finished traces are serialized with the
"incorrect" default service name.
## Implementation details
Mostly commit-by-commit but:
- Move the "fallback application name" calculation to a helper class
- Expose the fallback application name on `TracerSettings`
- Created as a `Lazy<>` because this calculation can be kind of
expensive, and isn't necessary if the customer specifies a service name.
- Exposed on `TracerSettings` because it doesn't change
- Expose `DefaultServiceName` on `MutableSettings` instead of
`TracerManager`.
- Update usages to point to the new location
Additionally, there are some places where I believe we were
"incorrectly" using the `DD_SERVICE` value, and ignoring the real
fallback name.
- [x] Service Discovery's `StoreTracerMetadata` - @anna-git can you
confirm if I'm correct that this _should_ be using the "calculated"
service name as a fallback?
- [x] `TraceExporterConfiguration` - @ganeshnj, same question, can you
confirm that we should be passing the "calculated" service name, not
just the "explictly set" service name?
One additional aspect I think we should consider:
- Currently we're calling `NormalizeService(serviceName)` in a few
places. Is there any reason we shouldn't be _always_ normalizing the
service name?
- e.g. why don't we normalize `DefaultServiceName` automatically?
## Test coverage
Covered by existing tests generally
## Other details
https://datadoghq.atlassian.net/browse/LANGPLAT-819
Part of a config stack
- #7522
- #7525
- #7530 👈
- #7532
- #7543
- #7544
Log.Warning(ex,"Unable to determine ASP.NET site name: HostingEnvironment type could not be loaded. This is expected when running ASP.NET Core on the .NET Framework CLR, which is not supported");
0 commit comments