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

NullPointerException if bean_regexp has optional group #254

Open
spingel opened this issue Nov 18, 2019 · 0 comments
Open

NullPointerException if bean_regexp has optional group #254

spingel opened this issue Nov 18, 2019 · 0 comments

Comments

@spingel
Copy link

spingel commented Nov 18, 2019

Steps

  1. Configure a metric value using a bean_regexp with an optional capturing group

Example configuration:

                - include:
                    domain: app
                    bean_regex: app:name=app.bean(,type=.*)?
                    attribute:
                      Value:
                        metric_type: gauge
                        alias: app.metric

When the bean name does not include the optional capturing group (e.g. app:name=app.bean), this configuration results in an NPE and failure to report the metric value.

Work-around

Use a optional non-capturing group, e.g. bean_regex: app:name=app.bean(?:,type=.*)?

Logs

Logs from running datadog-agent -l debug jmx list everything

2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) | 2019-11-18 16:44:27,032 | ERROR | Instance | Error while trying to match attributeInf
o configuration with the Attribute: app:name=app.bean : javax.mana
gement.MBeanAttributeInfo[description=Attribute exposed for management, name=Value, type=java.lang.Object, read-only, descriptor={}]
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) | java.lang.NullPointerException
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at java.lang.String.replace(String.java:2240)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.JmxAttribute.replaceByAlias(JmxAttribute.java:570)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.JmxAttribute.addAdditionalTags(JmxAttribute.java:119)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.JmxAttribute.setMatchingConf(JmxAttribute.java:445)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.Instance.getMatchingAttributes(Instance.java:572)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.Instance.init(Instance.java:370)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.InstanceInitializingTask.call(InstanceInitializingTask.java:15)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at org.datadog.jmxfetch.InstanceInitializingTask.call(InstanceInitializingTask.java:3)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2019-11-18 16:44:27 UTC | CORE | INFO | (pkg/jmxfetch/jmxfetch.go:200 in func1) |       at java.lang.Thread.run(Thread.java:748)
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