Skip to content
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

Question: Translation of prometheus patterns to jmxfetch queries #396

Open
iMajna opened this issue Jul 12, 2022 · 0 comments
Open

Question: Translation of prometheus patterns to jmxfetch queries #396

iMajna opened this issue Jul 12, 2022 · 0 comments

Comments

@iMajna
Copy link

iMajna commented Jul 12, 2022

Unfortunately, I cannot find any info about docs about this anywhere and I'm not sure whether it is actually possible when I see implementation but worth of asking.

I'm trying it translate following prometheus rule:

  - pattern: 'kafka.server<type=app-info><>(commit-id|version): (.+)'
    name: kafka_server_$1_info
    value: 1
    labels:
      $1: "$2"
    help: "Kafka server JMX metric info version and commit-id"
    type: GAUGE

That gives me is following output metric:

kafka_server_version_info{version="3.1.0"} 1.0

to Jmxfetch rule.

Reason why I'm doing this is because attribute version is reported as double but in fact it is string and therefore I need to override metric with default value of 1.

$>info -b kafka.server:type=app-info
#mbean = kafka.server:type=app-info
#class name = org.apache.kafka.common.metrics.JmxReporter$KafkaMbean
# attributes
%0 - commit-id (double, r)
%1 - start-time-ms (double, r)
%2 - version (double, r)

So, after I was able to do the same with prometheus rule I'm trying to accomplish the same with jmxfetch as I'm using oob kafka integration to pull jmx metrics.

So, if I tired use something like this:

  {
    "include": {
      "domain": "kafka.server",
      "bean": "kafka.server:type=app-info",
      "attribute": {
        "version": {
          "alias": "kafka.server.cluster.version",
          "metric_type": "gauge",
          "values": {
            "default": 1
          }
        }
      }
    }
  }

but this more or less yields metric kafka.server.cluster.version with value 1 and without tag version=3.1.0 as the one from prometheus rule would as there I could create label out of version attribute through regex. I'm not sure who to do the same here tho.

So, in short, is there a way to somehow send attribute as a label or a tag with its true value along side metric?

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

No branches or pull requests

1 participant