Skip to content

Support for extra metrics#1124

Merged
dhoard merged 1 commit intoprometheus:mainfrom
MaBiConti:extra-metrics
Feb 19, 2025
Merged

Support for extra metrics#1124
dhoard merged 1 commit intoprometheus:mainfrom
MaBiConti:extra-metrics

Conversation

@karina-calma
Copy link
Contributor

This PR has a dependency on PR. If this functionality is of interest then that PR will be merged first and then this one.

Some of our mbeans only have string attributes, so we won't have any metrics at all, as only numeric or boolean attributes will generate values. We have implemented a way to define a custom value via the configuration file. Here is an example: we want to generate a new metric, such as "isActive" with the value true (1.0)

includeObjectNames: ["io.prometheus.jmx:type=stringValue"]
metricCustomizers:

  • mbeanFilter:
    domain: io.prometheus.jmx
    properties:
    type: stringValue
    extraMetrics:
    • name: isActive
      value: true
      description: This is a boolean value indicating if the scenario is still active or is completed.

If someone does not explicitly configure metricCustomizers, they should see no impact to performance. When the feature is used, we will go through all the elements in the metricCustomizers block and perform string comparison on the domain and the (optional) properties with every MBean that is matched by the defined rules. For those metrics that match, we will create a new metric with defined name and value. The description is used in the "HELP" section of the logs and indicates what purpose the metric serves.

@dhoard
Copy link
Collaborator

dhoard commented Jan 30, 2025

@karina-calma I believe this can already be accomplished using existing functionality.

See https://www.robustperception.io/converting-string-states-to-booleans-with-the-jmx-exporter/

@karina-calma
Copy link
Contributor Author

Hi @dhoard,

We took a look on this approach, but we have some concerns in term of performance, because this solution involves pattern matching for all the mbeans and all the rules.

We have a significant number of mbeans and this approach will put a load on the server and increase response time.
We proposed an alternative solution that is based on string comparison.

@dhoard
Copy link
Collaborator

dhoard commented Feb 18, 2025

@karina-calma I merged #996 . Can you resolved the merge conflicts for this PR?

Co-authored-by: Karina Calma <karina_calma@infobest.ro>
Signed-off-by: Martin Bickel <martin.bickel@continental.com>
@karina-calma
Copy link
Contributor Author

Hi @dhoard, we fixed the conflicts.

@dhoard dhoard merged commit a7d81bc into prometheus:main Feb 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants