You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an MBean with two attributes, but both attributes are strings. I would like to customize a config file and convert two string attributes to labels with adding an extra-Metric via the option extraMetrics
Prometheus Exporter skips MBeans without numeric attributes. We can try to add a numeric attribute via the
metricCustomizers / extraMetrics
see an example:
startDelaySeconds: 10lowercaseOutputName: falselowercaseOutputLabelNames: falseincludeObjectNames: ["jetbrains.youtrack:type=Maintenance,name=Global"]metricCustomizers:
- mbeanFilter:
domain: jetbrains.youtrackproperties:
type: Maintenancename: GlobalattributesAsLabels:
- Build
- VersionextraMetrics:
- name: isActivevalue: truedescription: This is a boolean value indicating if the scenario is still active or is completed.
Install a visualVM plugin: Menu / Tools / Plugins / Available Plugins / VisualVM MBean
Connect from the VisualVM tool to the remote host: 127.0.0.1:9010
Open an MBean with numeric and String attributes, for example jetbrains.youtrack:type=Hub,name=HubIntegration
Actual result
A test MBean is:
jetbrains.youtrack:type=Maintenance,name=Global
Attributes:
Attribute name
Readable
Type
Value
Build
true
java.lang.String
62967
Version
true
java.lang.String
2025.1
An output doesn't have the metric isActive
Expected result
The output will have the metric isActive
Workaround
We can create metrics for each string attribute via the config:
startDelaySeconds: 10lowercaseOutputName: falselowercaseOutputLabelNames: falsewhitelistObjectNames:
- "jetbrains.youtrack:type=Maintenance,name=Global"rules:
- pattern: 'jetbrains.youtrack<type=Maintenance, name=Global><>(\w+): (.+)'name: youtrack_version_infolabels:
$1: $2value: 1.0type: GAUGEhelp: Application version info
We will get a metric with name youtrack_version for the last version of jmx-exporter and a metric with name youtrack_version_info for the old version of jmx-exporter. See also:
polarnik
changed the title
metricCustomizers / extraMetrics doesn't skips an MBean with string attributes only
metricCustomizers / extraMetrics skips MBeans with string-only attributes
Mar 3, 2025
@polarnik I cannot reproduce your issue. With the configuration you provided, I can see the following metric in the output:
# HELP jetbrains_youtrack_Maintenance_isActive This is a boolean value indicating if the scenario is still active or is completed. jetbrains.youtrack:name=Global,type=Maintenance,attribute=isActive# TYPE jetbrains_youtrack_Maintenance_isActive untyped
jetbrains_youtrack_Maintenance_isActive{Build="62967",Version="2025.1",name="Global"} 1.0
Yes, it's my mistake. I used version 1.1.0 because there was a typo in my docker-compose file. I mounted a jmx agent two times, a new version and a release version 1.1.0 into a same file.
Description
I have an MBean with two attributes, but both attributes are strings. I would like to customize a config file and convert two string attributes to labels with adding an extra-Metric via the option extraMetrics
Prometheus Exporter skips MBeans without numeric attributes. We can try to add a numeric attribute via the
metricCustomizers / extraMetrics
see an example:
jmx_exporter/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/core/MetricCustomizersAttributesAsLabelsExtraMetricsTest/JavaAgent/exporter.yaml
Line 9 in 01700b2
But the output will skip the MBean anyway
See also:
Environment
Config
jmx_exporter.yml
youtrack.jvmoptions
docker-compose
Steps
Actual result
A test MBean is:
Attributes:
An output doesn't have the metric isActive
Expected result
The output will have the metric isActive
Workaround
We can create metrics for each string attribute via the config:
We will get a metric with name
youtrack_version
for the last version of jmx-exporter and a metric with nameyoutrack_version_info
for the old version of jmx-exporter. See also:And merge a few metrics into one via Grafana dashboard transformations
The text was updated successfully, but these errors were encountered: