prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to use lowercaseOutputName in particular rules

Nirzak opened this issue · comments

Hi, we know that we can define lowercaseOutputName globally which reflects all the rules. but If we want to define lowercaseOutputName only for particular rules except others then it doesn't work. Currently, we can define attrNameSnakeCase on the rules section but not lowercaseOutputName. The ability to use this option in the rule section will help us a lot. Thanks

The current code either..

  1. uses the attribute name as defined by an MBean
  2. converts the attribute name to snake case

I looked at the code...

if (rule.attrNameSnakeCase) {
attributeName = toSnakeAndLowerCase(attrName);
} else {
attributeName = attrName;
}

... and adding a rule configuration value of attrNameLowercase would result in confusing configuration.

Example:

rules:
  - pattern: 'org.apache.cassandra.metrics<type=(\w+), name=(\w+)><>Value: (\d+)'
    name: cassandra_$1_$2
    value: $3
    valueFactor: 0.001
    labels: {}
    help: "Cassandra metric $1 $2"
    cache: false
    type: GAUGE
    attrNameSnakeCase: true
    attrNameLowercase: true

Is the attribute name snake case? lower case?
Is the user expecting a specific order of operations? (snake case then lowercase?

This feels like a workaround for inconsistent configuration of exporter rules and dashboards.

The current code either..

  1. uses the attribute name as defined by an MBean
  2. converts the attribute name to snake case

I looked at the code...

if (rule.attrNameSnakeCase) {
attributeName = toSnakeAndLowerCase(attrName);
} else {
attributeName = attrName;
}

... and adding a rule configuration value of attrNameLowercase would result in confusing configuration.

Example:

rules:
  - pattern: 'org.apache.cassandra.metrics<type=(\w+), name=(\w+)><>Value: (\d+)'
    name: cassandra_$1_$2
    value: $3
    valueFactor: 0.001
    labels: {}
    help: "Cassandra metric $1 $2"
    cache: false
    type: GAUGE
    attrNameSnakeCase: true
    attrNameLowercase: true

Is the attribute name snake case? lower case? Is the user expecting a specific order of operations? (snake case then lowercase?

This feels like a workaround for inconsistent configuration of exporter rules and dashboards.

Yeah the attrNameSnakeCase already makes an attribute name in lower case order. but my request was for lowercaseOutputName configuration per rule not the attribute name lower case. Currently metrics name can only be lowercase or uppercase globally. it reflects on all the rules which sometimes breaks some dashboards where one dashboard is using uppercase form of metrics where other is using the lower case form.

where one dashboard is using uppercase form of metrics where other is using the lower case form.

At this time, I feel the best approach is to make your dashboards consistent. It will resolve operational issues in the future and prevent a mismatch of inconsistent usage.

where one dashboard is using uppercase form of metrics where other is using the lower case form.

At this time, I feel the best approach is to make your dashboards consistent. It will resolve operational issues in the future and prevent a mismatch of inconsistent usage.

Oh ok got it. Yeah are currently doing this as this is the only way..