Giter Club home page Giter Club logo

Comments (2)

dhoard avatar dhoard commented on June 6, 2024

@EconomicTouristsArmLate I believe I understand what you are trying to accomplish, but don't fully follow the use case.

The MBean should be providing a label. Is there a reason that a lack of a label (i.e. empty string) can't be handled downstream?

from jmx_exporter.

EconomicTouristsArmLate avatar EconomicTouristsArmLate commented on June 6, 2024

The problem I'm trying to solve is dumb: I need to sort versions via string comparison (this is how tomcat determines the latest / active version of an app). And an empty label value does sort higher than any other value, but it should sort lowest.

This use case is slightly ridiculous, but I'm sure there are other use cases that benefit from a default label value. Providing a default label value simply improves readability of metrics, which is a benefit in its own.

For now I workaround this problem with multiple, more specific match rules, but this is quite cumbersome and error prone:

rules:
  # first rule with only matches `name` with a version, second rule matches without. only first match is used.
  # this is, so that we always have a value in the version label, so that we can string sort by this, in order to find the latest version
  # in the same way tomcat does... the default version string must thus be sorted before numbers, '-' does that.
  - pattern: 'Catalina<j2eeType=WebModule, name=//(?:localhost/)?([-a-zA-Z0-9+&@/%?=~_|!:.,;]*[-a-zA-Z0-9+&@/%=~_|])(?:##(.+)), J2EEApplication=none, J2EEServer=none><>startTime:'
    name: tomcat_module_started_at
    labels:
      module: "$1"
      version: "$2"
    help: Tomcat WebModule startTime (unix time)
    type: GAUGE
  - pattern: 'Catalina<j2eeType=WebModule, name=//(?:localhost/)?([-a-zA-Z0-9+&@/%?=~_|!:.,;]*[-a-zA-Z0-9+&@/%=~_|]), J2EEApplication=none, J2EEServer=none><>startTime:'
    name: tomcat_module_started_at
    labels:
      module: "$1"
      version: '-'          # ← ← ← ← ← ←  note the default value here
    help: Tomcat WebModule startTime (unix time)
    type: GAUGE

from jmx_exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.