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
Extract MutableSettings from TracerSettings (#7522)
## Summary of changes
- Extract a `MutableSettings` type from `TracerSettings`
- Extract a `Raw` type from `ExporterSettings`
## Reason for change
We're working on refactoring how we handle dynamic/remote/config in code
settings i.e. settings which can change at runtime. As a first step,
this PR extracts those settings to their own type, called
`MutableSettings` because they mutable during the lifetime of the app.
> Feel free to suggest other names for this type, or we can
alternatively bikeshed it later.
Additionally, extracted the "raw" settings from `ExporterSettings`.
These are the values which are read from config sources. The actual
values of `ExporterSettings` are set based on these values, using a
highly convoluted (backward compatible) series of methods, but the idea
is: if the `Raw` settings haven't changed, the `ExporterSettings`
haven't changed.
> This isn't _strictly_ true due to the `File.Exists` call we have, but
I believe this is good enough for our purposes.
## Implementation details
- Create `MutableSettings` and move all the properties from
`TracerSettings` that _can_ change to it.
- Update `TracerSettings` to create an instance of `MutableSettings`,
and simply pass-through properties to it.
- This should mean existing functionality is unaffected by this PR
- Implement `IEquatable<MutableSettings>` for future comparisons between
`MutableSettings` instances
- Unfortunately, can't use a `record` here or auto-gen the
implementation, because we need to handle equivalence of the
dictionaries.
- Extract the "raw" setting reading to an `ExporterSettings` nested-type
- Opted for nested here, because unlike `MutableSettings` (which will
eventually live separately from `TracerSettings`) we won't expose `Raw`
to consumers - they'll still use `ExporterSettings`
## Test coverage
This is just a refactoring, so it's covered by existing tests.
Additionally, I added a test for the `IEquatable` implementation (which
is similar to the test we have for `ImmutableDynamicSettings`) to ensure
the implementation is updated if we add more properties.
## Other details
https://datadoghq.atlassian.net/browse/LANGPLAT-819
Part of a config stack
- #7522 👈
- #7525
- #7530
- #7532
- #7543
- #7544
0 commit comments