-
Notifications
You must be signed in to change notification settings - Fork 320
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
Collect metrics from JMX #469
Comments
👍 Great. This would make the installation of Jolokia obsolete ... |
This would be awesome. |
Thanks for the feedback. We're planning to tackle this soon. |
I have a first sort-of working draft. One remaining question is how users can actually configure this. Unfortunately, the configuration mechanism doesn't work well when lists of objects should be configured. The underlying primitive are key/value String-String pairs so that it can also be configured via environment variable, system properties and property files, for example. Admittedly, for this use-case, yaml would be a prime candidate though. Nevertheless, I still think the String-String key/value pairs are the right primitive for the overall agent configuration use case. One syntax I have come up with is this:
Another option would be just to use JSON:
This will generate these metric sets (this is the intake v2 format which is not the same as the documents stored in ES):
That looks pretty similar to the GC metrics the Java agent reports by default:
Note that the agent will create tags/labels for each key property such as the JMX It's also possible to capture composite JMX data structures. In this example, the
This is the resulting metric set:
Currently, only /cc @ruflin @jsoriano who are the maintainers of the Jolokia Metricbeat module (I think) |
Looks good! |
Not sure I understand correctly. We could use the JSON as the value in the capture_jmx_metrics=[ \
{"object_name": "java.lang:type=GarbageCollector,name=*", "attribute": "CollectionCount", "metric_name": "collection_count"}, \
{"object_name": "java.lang:type=GarbageCollector,name=*", "attribute": "CollectionTime"} \
]
application_packages=com.foo |
Sorry for being unclear- I would prefer not using JSON as the string value of config options in However, this is just a matter of preference, I wouldn't object to using JSONs. |
@felixbarny I haven't touched jmx in quite some time but one thing I'm curious about is if it would make sense to align the Metricbeat jmx format and this one here? Could you share an example on what the "end format" is that is stored in Elasticsearch in contrast to what we get with Metricbeat? BTW I think @jsoriano is the expert on this one. |
The main difference I see with metricbeat regarding configuration (apart of options naming) is that in the Jolokia module, for each object name (mbean), there can be multiple attribute mappings. So the JSON example here would be something like: {"object_name": "java.lang:type=GarbageCollector,name=*", "attributes": [
{"attribute": "CollectionCount", "metric_name": "collection_count"},
{"attribute": "CollectionTime"}
]} And not sure how this could be done with the other format. In metricbeat yaml-based config this mapping would be defined with something like this: - mbean: 'java.lang:type=GarbageCollector,name=*'
attributes:
- attr: CollectionCount
field: collection_count
- attr: CollectionTime
field: CollectionTime
Metrics collected by metricbeat are stored in events under I guess that to align the format with APM, the metrics should be stored under |
See the examples in http://apm-agent-java_801.docs-preview.app.elstc.co/guide/en/apm/agent/java/master/config-jmx.html
Yes, that's some kind of limitation of the syntax. We could extend it to something like
or even
But it comes with its own challenges. In the end it's the same as having multiple declarations with the same object name, just a bit more concise. If we would get rid of the name to customize the metric name and just use the attribute name, I guess this syntax would be best:
|
another variant:
|
To continue the brainstorming we could start out with this syntax:
To specify additional optional properties, like the
That would also allow adding additional properties later on, for example
ObjectName parsing testObjectName objectName = new ObjectName("CollectionCount:metric_name=collection_count,metric_type=delta");
System.out.println(objectName);
System.out.println(objectName.getDomain());
System.out.println(objectName.getKeyPropertyList()); Output
To configure multiple attributes, just repeat the attribute part:
|
Talking about the event structure: It's basically |
A heap example is also available in the docs: http://apm-agent-java_801.docs-preview.app.elstc.co/guide/en/apm/agent/java/master/config-jmx.html EDIT: EDIT 2: |
Sounds good to me, I thought this was the event sent by the Java agent:
|
That’s correct but the apm server will transform that before sending to es |
It seems the two formats are not too far apart from each other. We should probably also make this part of the ECS metrics effort to unify on the naming for the most common metrics? |
Introduce a configuration option which enables the collection of arbitrary JMX metrics. It should be possible to get a collection of metrics and to convert properties to metric tags.
For example
java.lang:type=GarbageCollector,name=*
A consideration is whether the collection of these metrics should be done in a separate metrics reporter thread vs the apm-reporter thread so that the gathering of metrics does not block sending other events.
The text was updated successfully, but these errors were encountered: