Proposal: attributes as metrics & extra metrics

77 views
Skip to first unread message

Karina Ciupa

unread,
Mar 29, 2024, 10:11:30 AMMar 29
to Prometheus Developers

Hi all,

I am reaching out with a proposal for two different extensions of your project.

In the company that I work for, we needed to extend your project in order to collect additional data from non-standard mbeans. I am opening this discussion to check if you would be interested in merging these extensions in your project.


1. Exposing string-type mbean attributes as labels.

The mbeans that we are working with have a lot of string-type attributes which are not converted into metrics by your project.

However, we need to expose the information offered by these string attributes to Prometheus, such that they can be used in queries, or be displayed in graphs.

The best way to do this (that we were able to find) is to expose these attributes as labels on the other metrics. We made this behavior configurable in the rules section of the yaml configuration file. Here is an example:

rules:

  - pattern: '{some mbean pattern}'

     name: some_metric

     attributesAsLabels:

        - firstStringAttribute

        - secondStringAttribute

This produces a metric that looks like this:

some_metric_attribute{firstStringAttribute="something",secondStringAttribute="something else"} 123

 

2. Adding additional metrics to an mbean.

Some of the mbeans that we are working with do not expose any useful metrics, so we implemented a way to define a custom metric through the configuration file. This is also configurable in the rules section of the yaml configuration file. Here is an example:

  - pattern: '{some mbean pattern}'

     name: some_metric

     extraMetrics:

        - name: someName

          value: someValue

          description: someDescription

This produces a metric that looks like this:

some_metric_someName{...} someValue

The description is used in the "HELP" section of the logs and indicates what purpose the metric serves.

Please let me know if you are interested in these features. If you are, I will open separate pull requests.

Also, please tell me if there is any way to achieve this behavior in another way that is already available in your project.


Kind regards,

Karina Ciupa
karina...@infobest.ro

Fabian Stäber

unread,
Apr 3, 2024, 1:36:35 PMApr 3
to Prometheus Developers
Hi Karina,

Thanks a lot for your proposals. Could you open a Github issue on https://github.com/prometheus/jmx_exporter and copy the content of this email into the issue? That will make it easier to involve Doug in the discussion, he's the main maintainer of jmx_exporter.

Fabian
Reply all
Reply to author
Forward
0 new messages