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
chore(app): handle bootstrap background tasks via dedicated supervisor (#1538)
## Summary
This PR updates the bootstrap process/helpers to use supervision trees to handle all necessary background async tasks that arise out of the initialization of various subsystems.
The bootstrap phase involves initializes various fundamental subsystems -- logging, metrics, TLS, etc -- prior to the application doing useful work. In many cases, these subsystems require background tasks to run in order to perform routine upkeep, or manage requests to alter behavior, and so on. Currently, these background tasks are all spawned directly on the ambient runtime where they cannot be restarted if they failed, and generally can't participate in the advanced mechanisms available to supervision trees, such as communicating via dataspaces.
This PR updates the bootstrap process, and associated helper types, to build a single supervisor that contains all necessary workers (tasks) that must be driven in order to support the subsystems being initialized. The goal is two-fold:
- move more async tasks into supervision trees (for reasons of reliability and observability)
- gain access to advanced runtime features like dataspaces
The work here is meant as a stepping stone towards supporting dynamic log level overrides that come from changes to `log_level` in ADP's primary configuration. By switching the relevant background task that handles log level overrides currently to run in a supervision tree, we're opening up the ability to change how interested code operates with it and communicates with it, allowing us to decouple ADP-specific needs from generic Saluki code.
We've worker-ified four distinct background tasks:
- `MetricsFlusherWorker`: bridge between our `metrics` recorder and emitting internal metrics to the `internal_metrics` source
- `RuntimeMetricsWorker`: collects Tokio runtime metrics and re-emits them into our internal metrics
- `MetricsOverrideWorker`: handles API requests to dynamically override/reset the current metrics level
- `LoggingOverrideWorker`: handles API requests to dynamically override/reset the current log level
## Change Type
- [ ] Bug fix
- [ ] New feature
- [x] Non-functional (chore, refactoring, docs)
- [ ] Performance
## How did you test this PR?
Existing unit and integration tests.
## References
DADP-52
Co-authored-by: toby.lawrence <toby.lawrence@datadoghq.com>
0 commit comments