Skip to content

Question: Translation of prometheus patterns to jmxfetch queries  #396

@iMajna

Description

@iMajna

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions