-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly utilize the provided metrics_mapper
#3446
Conversation
The current implementation of the Prometheus check ignores completely the values of `metrics_mapper`, because the code is pretty much building it using the original metric names. Instead, we should use the mappings provided by the user in the `metrics_mapper` dictionary. So given an example config like this: ```yml metrics: - cp_kafka_server_replicamanager_underreplicatedpartitions type_overrides: cp_kafka_server_replicamanager_underreplicatedpartitions: gauge metrics_mapper: cp_kafka_server_replicamanager_underreplicatedpartitions: server.replica_manager.under_replicated_partitions ``` We should emit metrics named `server.replica_manager.under_replicated_partitions` instead of `cp_kafka_server_replicamanager_underreplicatedpartitions` which is what the agent does currently.
Codecov Report
@@ Coverage Diff @@
## master #3446 +/- ##
=========================================
- Coverage 86.46% 83.9% -2.57%
=========================================
Files 735 62 -673
Lines 37955 4702 -33253
Branches 4461 574 -3887
=========================================
- Hits 32819 3945 -28874
+ Misses 3936 636 -3300
+ Partials 1200 121 -1079 |
metrics_mapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@casidiablo Good catch, thanks!
When do you expect this would be released as a docker image? Which version will this be in? |
@casidiablo 6.12, unless you feel comfortable using |
)" This reverts commit 176b71d.
@casidiablo thank you for contributing, but In your case it should be something like: metrics:
- cp_kafka_server_replicamanager_underreplicatedpartitions: server.replica_manager.under_replicated_partitions You can still find all the params that you can use to configure the check here in this file https://github.com/DataDog/integrations-core/blob/master/prometheus/datadog_checks/prometheus/data/conf.yaml.example |
How does that look in the kubernetes integration? |
Hi @casidiablo |
It's explained in the motivation block above. Basically, I have this configuration in my pods:
What I expect from this is to get a metric named In other words, |
As I told you metrics:
- cp_kafka_server_replicamanager_underreplicatedpartitions: server.replica_manager.under_replicated_partitions Tell me if this worked for you. Thanks! |
If I do that then the prometheus check just fails to start:
I think it's because it does not expect metrics to be a dictionary but a list. |
What does this PR do?
The current implementation of the Prometheus check ignores completely the values of
metrics_mapper
, because the code is pretty much building it using the original metric names.Instead, we should use the mappings provided by the user in the
metrics_mapper
dictionary.Motivation
Given an example config like this:
We should emit metrics named
server.replica_manager.under_replicated_partitions
instead ofcp_kafka_server_replicamanager_underreplicatedpartitions
which is what the agent does currently.Additional Notes
N/A
Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached