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

Don't print a stacktrace when failing to get a metric #219

Merged
merged 2 commits into from
Apr 24, 2019

Conversation

albertvaka
Copy link
Contributor

@albertvaka albertvaka commented Apr 11, 2019

A multi-line stack trace was being printed to the log when a metric couldn't be retrieved, eg: because of a cast error. This makes the error fit into a single log line.

Before:

2019-04-11 17:59:46,641 | WARN | JmxAttribute | Unable to get metrics from org.datadog.jmxfetch.test:type=SimpleTestJavaApp - MyAwesomeMetric
java.lang.NumberFormatException: For input string: "ImNotANumber"
        at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
        at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
        at java.lang.Double.parseDouble(Double.java:538)
        at org.datadog.jmxfetch.JmxAttribute.castToDouble(JmxAttribute.java:301)
        at org.datadog.jmxfetch.JmxSimpleAttribute.getMetrics(JmxSimpleAttribute.java:45)
        at org.datadog.jmxfetch.JmxAttribute.getMetricsCount(JmxAttribute.java:254)
        at org.datadog.jmxfetch.Instance.getMatchingAttributes(Instance.java:562)
        at org.datadog.jmxfetch.Instance.init(Instance.java:361)
        at org.datadog.jmxfetch.InstanceInitializingTask.call(InstanceInitializingTask.java:15)
        at org.datadog.jmxfetch.InstanceInitializingTask.call(InstanceInitializingTask.java:3)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

After:

2019-04-11 18:03:10,754 | WARN | JmxAttribute | Unable to get metrics from org.datadog.jmxfetch.test:type=SimpleTestJavaApp - MyAwesomeMetric: java.lang.NumberFormatException: For input string: "ImNotANumber"

@albertvaka albertvaka added this to the Next milestone Apr 11, 2019
@albertvaka albertvaka force-pushed the albertvaka/less-verbose-fetch-errors branch from e4655ae to f1ec4d8 Compare April 11, 2019 16:10
@albertvaka albertvaka merged commit 3c8296b into master Apr 24, 2019
@albertvaka albertvaka deleted the albertvaka/less-verbose-fetch-errors branch April 24, 2019 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants