Convert resource attributes to labels in prometheus remote write exporter #26
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.
Description:
Added missing functionality of converting resource attributes to labels in Prometheus Remote Write Exporter.
Furthermore, this PR merges the ideas of a Prometheus "External Label" with OTLP "Resource Attributes". From my understanding an "external label" is a label customer's can add in Prometheus' global config's, and they are allowed to start with "__" unlike regular labels. Since resource attributes to not appear to have any restrictions for starting with "__", I believe it is safe to merge these concepts.
This solves issue open-telemetry#1892 because customer's can specify cortex's "cluster" and "__replica__" labels using the
resourceprocessor
, which would be equivalent to the suggested way to do it on Cortex's website (using external labels: https://cortexmetrics.io/docs/production/ha-pair-handling/)Also note that this PR is not as long as it seems, a lot of lines are test data
Link to tracking Issue:
open-telemetry#1892
Testing:
Unit tests have been added, and manual testing by exporting to cortex has shown resource attributes successfully appear as labels with no differences in the metrics graphs, which is expected
Documentation:
No documentation has been added as this was missing, expected functionality