avaje / avaje-metrics Goto Github PK
View Code? Open in Web Editor NEWCore implementation of avaje metric api
Home Page: http://avaje-metrics.github.io
Core implementation of avaje metric api
Home Page: http://avaje-metrics.github.io
Without the threshold set all entries are output:
21:15:10 exe:612ms metric:web.CustomerResource.asBean
d:0 p:100 ms:612 us:612194 m:web.CustomerResource.asBean
d:1 p:99 ms:611 us:611976 m:service.MusicLayer.playItSon
d:2 p:0 ms:0 us:91 m:service.DummyEmailSender.send
d:3 p:0 ms:0 us:81 m:service.DummyEmailSender.yeahNah
d:2 p:8 ms:51 us:51347 m:service.RadioHead.kidA
d:3 p:0 ms:1 us:1133 m:service.Muse.originOfSymmetry
d:2 p:91 ms:560 us:560506 m:service.RadioHead.theBends
d:3 p:89 ms:550 us:550383 m:service.RadioHead.pabloHoney
d:4 p:81 ms:500 us:500221 m:service.Muse.resistance
d:5 p:0 ms:0 us:20 m:service.Muse.notThatResistant
d:5 p:81 ms:500 us:500153 m:service.Muse.iDoTheRealWorkAroundHere
d:5 p:0 ms:0 us:14 m:service.Muse.notParticularlyResistant
And with a threshold set to 2 percent:
21:41:20 exe:612ms metric:web.CustomerResource.asBean
d:0 p:100 ms:612 us:612252 m:web.CustomerResource.asBean
d:1 p:99 ms:612 us:612050 m:service.MusicLayer.playItSon
d:2 p:8 ms:51 us:51322 m:service.RadioHead.kidA
d:2 p:91 ms:560 us:560576 m:service.RadioHead.theBends
d:3 p:89 ms:550 us:550429 m:service.RadioHead.pabloHoney
d:4 p:81 ms:500 us:500295 m:service.Muse.resistance
d:5 p:81 ms:500 us:500173 m:service.Muse.iDoTheRealWorkAroundHere
// configure the MetricReportManager
val config = MetricReportConfig()
// output the aggregate metrics every 60 seconds
config.setFreqInSeconds(60)
// set request timing threshold to 2 percent (omit entries less than 2 percent)
config.setRequestTimingThreshold(2)
reporter = MetricReportManager(config)
Supports the ability to use long values (rather than double) for all built in gauges for better storage options.
Change to:
writeHeader("collected", reportMetrics.getCollectionTime());
writeHeader("reported", System.currentTimeMillis());
getTimedMetric() -> timed()
getCounterMetric() -> counter()
getValueMetric() -> value()
getTimedMetricGroup() -> timedGroup()
getMetricNameCache() -> nameCache()
09:31:59 exe:612ms metric:org.example.myapp.web.api.CustomerResource.asBean
d:0 p:100 ms:612 us:612162 m:org.example.myapp.web.api.CustomerResource.asBean
d:1 p:99 ms:611 us:611986 m:org.example.myapp.service.MusicLayer.playItSon
d:2 p:0 ms:0 us:95 m:org.example.myapp.service.DummyEmailSender.send
..
09:32:12 exe:611ms metric:org.example.myapp.service.MusicLayer.playItSon
d:0 p:100 ms:611 us:611686 m:org.example.myapp.service.MusicLayer.playItSon
d:1 p:0 ms:0 us:105 m:org.example.myapp.service.DummyEmailSender.send
d:2 p:0 ms:0 us:91 m:org.example.myapp.service.DummyEmailSender.yeahNah
...
On linux collect the VmRSS and VmHWM via:
grep Vm /proc/<pid>/status
The issue being that the total memory used by a JVM process is more than the reported heap committed + nonheap committed. So it is good to measure and track the absolute total memory being used.
On linux we can use /proc/$PPID/status
and get the VmHWM and VmRSS values.
This enhancement gets those values on linux when available (as gauges like the jvm memory metrics).
Need to have a look at that.
avaje-metrics as a project has been going now for 9 years. Fair to say it is unloved and unknown in the community so the question is should it continue to exist?
The original reason avaje-metrics was created was because I didn't believe the benefit of Histogram exceeded its cost and difficulty in aggregating (how do you aggregate a 50th percentile?) WHEN we collect metrics often enough (like every minute) and alternatively can use bucket timer which is a lot less expensive that Histograms. All these things still hold true. I also note that there looks to be some hesitation in maintaining Dropwizard metrics it going forward.
Well the idea they are going for sounds good but micrometer isn't very micro at all - over 600kb and looking at the API and internals I'm not overly convinced by it.
So that is what I've done and I've been brutal in the sense that I've "modernised" the API, types and modularized it better. Given the tiny number of existing users out there I've been brutal and significantly changed the API without concern for backward compatibility - apologies for that if people are looking to upgrade etc.
Having done the big refactor I'm very happy with the result. A heck of a lot of avaje-metrics was pretty good but I think this refactor gives it a lot more consistency with Dropwizard and Micrometer and I think it's a lot more future orientated. So yes, happy.
In the ValueCounter.getStatistics(reset) in the else block (so when reset==false) it says
return new DefaultValueStatistics(startTime.get(), count.sum(), total.sum(), max.maxThenReset());
Is that intentional (max value reset)?
Generally we want to apply a prefix to application metrics to clearly identify them relative to jvm metrics etc.
Generally we also want to rollup metrics based on prefixes. For example aggregate the metrics with "web.api." prefix to get a measure of total for all Rest/Grpc calls to a given service.
To support this we default to given metrics a prefix of "app." - the default metrics names will then be app.<short class name>.<method name>
.
Seeing this on a specific server with a relatively old JDK. Need to investigate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.