-
Notifications
You must be signed in to change notification settings - Fork 324
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
Micrometer integration improvements #1476
Comments
Marking Micrometer support as beta for now: #1492 |
I was surprised when I saw that micrometer itself did the diff calculations. I expected the recording to use e.g. monotonic counters and then the reporter to do the diff calculations, that way they're synchronized with the collection interval, and you could have multiple reporters with different intervals, etc. |
It only does that if you're configuring Micrometer with
For the Prometheus client integration (elastic/apm#355), we want to test out calculating diffs at the agent level, similar to For Micrometer, I think the best way to configure delta vs incrementing counters is to use the Micrometer settings ( |
Currently, there are some pitfalls when using the Micrometer integration.
There are two main ways to configure Micrometer MeterRegistries:
CountingMode.CUMULATIVE
, representing monotonically increasing counters andCountingMode.STEP
, that reset the counters.We're currently recommending
CountingMode.STEP
so that we report the deltas since the last report which simplifies common aggregations such as summing counters across different instances. However, this requires that themetrics_interval
is lined up with the step duration.Even when doing that, the time when we read the metrics would need to be aligned with the time they get reset which is not really feasible. With some unlucky timing, we might always report the value just after it has been reset.Update: I read the code wrong: it always returns the value from the last interval so that shouldn't be an issue. For example, if the step duration is 10s, it would return the count from the first 10s when querying the value at t=15s
When there are multiple
MeterRegistry
s within aCompoundMeterRegistry
, we de-duplicate the metrics by putting them in a map that has theMeter.Id
as a key. However, we don't consistently favor STEP or cumulative CUMULATIVE, or a specific type ofMeterRegistry
.apm-agent-java/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java
Lines 109 to 117 in c609815
We don't support histograms yet but there are also some open questions to investigate: For the SimpleMeterRegistry it seems no matter whether choosing
STEP
orCUMULATIVE
, the histogram gets reset based onio.micrometer.core.instrument.distribution.DistributionStatisticConfig#getExpiry
. However, for thePrometheusMeterRegistry
for example, the histogram never gets reset (as the expiry is set to 5 years).Also, I'm not sure if percentile aggregation on a histogram field would even work if the histogram is tracking incrementing counts.
cc @cyrille-leclerc @alex-fedotyev
The text was updated successfully, but these errors were encountered: