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

[jvm] add prefix option #1238

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

[jvm] add prefix option #1238

wants to merge 4 commits into from

Conversation

masarasi
Copy link
Contributor

@masarasi masarasi commented Nov 19, 2024

The mackerel-plugin-jvm monitors the application specified in --javaname, but there is an issue that it can only monitor one of the applications if there are multiple applications with the same name. I would like to solve this issue by making it possible to use --metric-key-prefix and --metric-label-prefix.

# /usr/local/bin/mackerel-plugin-jvm -javaname Bootstrap -metric-key-prefix tomcat-ex -metric-label-prefix tomcat-ex --pidfile /usr/local/src/tomcat-ex/temp/tomcat.pid
jvm.tomcat-ex.new_space.NGCMX	1025507328.000000	1731999116
jvm.tomcat-ex.new_space.NGC	35651584.000000	1731999116
jvm.tomcat-ex.new_space.EU	18874368.000000	1731999116
jvm.tomcat-ex.new_space.S0U	0.000000	1731999116
jvm.tomcat-ex.new_space.S1U	4194304.000000	1731999116
jvm.tomcat-ex.old_space.OGCMX	1025507328.000000	1731999116
jvm.tomcat-ex.old_space.OGC	31457280.000000	1731999116
jvm.tomcat-ex.old_space.OU	5605888.000000	1731999116
jvm.tomcat-ex.metaspace.MCMX	1140850688.000000	1731999116
jvm.tomcat-ex.metaspace.MCMN	0.000000	1731999116
jvm.tomcat-ex.metaspace.MC	13369344.000000	1731999116
jvm.tomcat-ex.metaspace.MU	13096038.400000	1731999116
jvm.tomcat-ex.metaspace.CCSC	1507328.000000	1731999116
jvm.tomcat-ex.metaspace.CCSU	1363046.400000	1731999116
jvm.tomcat-ex.memorySpace.oldSpaceRate	17.820638	1731999116
jvm.tomcat-ex.memorySpace.newSpaceRate	64.705882	1731999116
jvm.tomcat-ex.gc_events.YGC	0.000000	1731999116
jvm.tomcat-ex.gc_events.FGC	0.000000	1731999116
jvm.tomcat-ex.gc_events.CGC	0.000000	1731999116
jvm.tomcat-ex.gc_time.YGCT	0.000000	1731999116
jvm.tomcat-ex.gc_time.FGCT	0.000000	1731999116
jvm.tomcat-ex.gc_time.CGCT	0.000000	1731999116
jvm.tomcat-ex.gc_time_percentage.YGCT	0.000000	1731999116
jvm.tomcat-ex.gc_time_percentage.FGCT	0.000000	1731999116
jvm.tomcat-ex.gc_time_percentage.CGCT	0.000000	1731999116
# MACKEREL_AGENT_PLUGIN_META=1 /usr/local/bin/mackerel-plugin-jvm -javaname Bootstrap -metric-key-prefix tomcat-ex -metric-label-prefix tomcat-ex --pidfile /usr/local/src/tomcat-ex/temp/tomcat.pid | grep -v "mackerel-agent-plugin" | jq
{
  "graphs": {
    "jvm.tomcat-ex.gc_events": {
      "label": "JVM tomcat-ex GC events",
      "unit": "integer",
      "metrics": [
        {
          "name": "YGC",
          "label": "Young GC event",
          "stacked": false
        },
        {
          "name": "FGC",
          "label": "Full GC event",
          "stacked": false
        },
        {
          "name": "CGC",
          "label": "Concurrent GC event",
          "stacked": false
        }
      ]
    },

@masarasi masarasi self-assigned this Nov 19, 2024
Copy link
Contributor

@yohfee yohfee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! implementation seems good.

It is better to have

  • Descriptions about their usage on README
  • Tests that keys and labels are replaced as expected

mackerel-plugin-jvm/lib/jvm.go Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

2 participants