[AIP-49] Decouple metrics clients and validators into their own modules #30802
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Part of the ongoing OTel implementation. Should not contain any logic changes, just moving things around into a more modular "plugin" style layout like we have elsewhere instead of the "monolithic" stats.py we currently have.
@howardyoo and @potiuk: This is (my proposal for) the change we discussed yesterday.
Motivation
airflow/stats.py
currently contains the metrics interface as well as implementations of the interface for StatsD and Datadog, some protocols, and validators (along with their interface). This PR does not change any logic, simply moves related content into relevant modules. For example All StatsD-specific code now lives inairflow/metrics/statsd-logger.py
. This is to make the stats.py file a bit cleaner, make adding OTel easier, and possibly make removing the StatsD easier later if we choose to go that route.When I add the OpenTelemetry code, it will live in
airflow/metrics/otel-logger.py
and simply import and implement the interfaces fromstats.py
andmetrics/protocols.py
instead of adding it to the existing growing monolith instats.py
.Testing
Passes
breeze static-checks --all-files
andbreeze testing tests --run-in-parallel
locally.cc: @o-nikolas @vincbeck @vandonr-amz @syedahsn