Skip to content

Add capture_jmx_metrics option#801

Merged
felixbarny merged 15 commits intoelastic:masterfrom
felixbarny:jmx
Sep 24, 2019
Merged

Add capture_jmx_metrics option#801
felixbarny merged 15 commits intoelastic:masterfrom
felixbarny:jmx

Conversation

@felixbarny
Copy link
Copy Markdown
Member

@felixbarny felixbarny commented Aug 20, 2019

closes #469

Copy link
Copy Markdown
Member

@bmorelli25 bmorelli25 left a comment

Choose a reason for hiding this comment

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

- uses ObjectName syntax, leverages javax.management.ObjectName for parsing
- allow multiple attribute[] elements
- more tests, including negative tests
- make MapsTokenScanner more resilient against IndexOutOfBoundsExceptions
@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 24, 2019

Codecov Report

Merging #801 into master will increase coverage by 0.71%.
The diff coverage is 86.17%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #801      +/-   ##
============================================
+ Coverage     63.51%   64.23%   +0.71%     
  Complexity       80       80              
============================================
  Files           224      228       +4     
  Lines          9035     9280     +245     
  Branches       1154     1202      +48     
============================================
+ Hits           5739     5961     +222     
- Misses         2929     2939      +10     
- Partials        367      380      +13
Impacted Files Coverage Δ Complexity Δ
...n/java/co/elastic/apm/agent/metrics/MetricSet.java 87.5% <ø> (ø) 0 <0> (ø) ⬇️
...ava/co/elastic/apm/agent/jmx/JmxConfiguration.java 100% <100%> (ø) 0 <0> (?)
...a/co/elastic/apm/agent/metrics/MetricRegistry.java 82.89% <28.57%> (-5.68%) 0 <0> (ø)
...ava/co/elastic/apm/agent/jmx/JmxMetricTracker.java 77.33% <77.33%> (ø) 0 <0> (?)
.../main/java/co/elastic/apm/agent/jmx/JmxMetric.java 87.01% <87.01%> (ø) 0 <0> (?)
...ava/co/elastic/apm/agent/jmx/MapsTokenScanner.java 97.43% <97.43%> (ø) 0 <0> (?)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ae1125...9ef428f. Read the comment docs.

Copy link
Copy Markdown
Contributor

@eyalkoren eyalkoren left a comment

Choose a reason for hiding this comment

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

Very nice!! 🎉

In general, since this is a user-configuration thing, I would print some more errors related to misconfiguration, like:

  • usage of non-valid characters
  • usage of non-valid key names

Also- add test for dynamically addition and removal of metrics.

@felixbarny
Copy link
Copy Markdown
Member Author

I would print some more errors related to misconfiguration, like:

  • usage of non-valid characters
  • usage of non-valid key names

Could you be more specific? There are already quite a few error messages in MapsTokenScanner. Which cases do you feel are missing?

Also- add test for dynamically addition and removal of metrics.

All tests already add the metrics dynamically. Removing is not supported at this point.

@eyalkoren
Copy link
Copy Markdown
Contributor

eyalkoren commented Sep 1, 2019

Could you be more specific? There are already quite a few error messages in MapsTokenScanner. Which cases do you feel are missing?

I am not trying to make it 100% bullet-proof, but thinking on possible mis-usages, eg:

  • typos (so if someone uses an unexpected key name - print it)
  • misunderstanding of the syntax (so disallow characters used for special purposes in the syntax within values, like , or :)

@felixbarny
Copy link
Copy Markdown
Member Author

felixbarny commented Sep 12, 2019

@eyalkoren Could you give this another review?

Copy link
Copy Markdown
Contributor

@eyalkoren eyalkoren left a comment

Choose a reason for hiding this comment

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

Awesome! Two minor name change suggestions.

}
}

private List<JmxMetricRegistration> registerJmxMetrics(List<JmxMetric> jmxMetrics) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This action is not really registering (ie adding to the registry), so maybe something like:

Suggested change
private List<JmxMetricRegistration> registerJmxMetrics(List<JmxMetric> jmxMetrics) {
private List<JmxMetricRegistration> compileJmxMetricRegistrationList(List<JmxMetric> jmxMetrics) {

return registrations;
}

private void registerJmxMetric(final JmxMetric jmxMetric, List<JmxMetricRegistration> registrations) throws JMException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
private void registerJmxMetric(final JmxMetric jmxMetric, List<JmxMetricRegistration> registrations) throws JMException {
private void addJmxMetricRegistration(final JmxMetric jmxMetric, List<JmxMetricRegistration> registrations) throws JMException {

@felixbarny felixbarny merged commit 8abcf4e into elastic:master Sep 24, 2019
@felixbarny felixbarny deleted the jmx branch September 24, 2019 09:23
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.

Collect metrics from JMX

5 participants