Coder Social home page Coder Social logo

avaje-metrics's People

Contributors

dependabot[bot] avatar koendg avatar rbygrave avatar rob-bygrave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

avaje-metrics's Issues

Add support for setting a percentage threshold to omit entries from request timing reporting

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)

When you turn on collection on everything the 'internally nested metrics' don't get decremented on first execution

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
...

ENH: Add collection of process memory VmRSS and VmHWM on linux

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).

9 years on, should avaje metrics continue? Yes

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?

Dropwizard Metrics

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.

Micrometer

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.

What should avaje-metrics be going forward?

  • Java 11 + module-info
  • Small at ~80Kb
  • Simple Counter, Gauge, Meter, Timer + Bucket timer
  • No Histogram
  • No EWMA (it's far to laggy if we are reporting every minute)

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.

Default to use a "app." prefix for derived metric names (best practice for ease of rollup)

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>.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.