Coder Social home page Coder Social logo

Disable Metrics at runtime about metrics.net HOT 3 OPEN

etishor avatar etishor commented on June 28, 2024
Disable Metrics at runtime

from metrics.net.

Comments (3)

etishor avatar etishor commented on June 28, 2024

@dekenless the metrics library should add a very very small overhead to code running in production and because of this the library is designed to be always running or be completely disabled at startup.

You can completely disable the metrics library by adding a line to the config file. The main goal of this setting is to allow users to measure the impact and the overhead of the metrics library.

Adding support for turning the library on and off at runtime (not just at startup) is currently very hard to do. The reason is that since the application has been running, user objects will have references to metric objects (timers, counters etc) possibly in static readonly fields and these references would point to real metrics objects, and not to the NoOp versions that are used when metrics are disabled. Adding another layer of indirection to handle this, would impact the normal flow and intended usage of the library and it is not something i'm willing to do without a very good reason.

In conclusion, my suggestion would be to leave the metrics enabled in production - as they will always provide valuable information. To measure the impact of having the metrics enabled you can use the config setting to disable/enable them.

If the impact is noticeable, I would appreciate it if you could post more details. I'm running metrics in prod in a few projects and never noticed the impact, not even when measurements are taken on critical-path.

from metrics.net.

dekenless avatar dekenless commented on June 28, 2024

OK, I will handle it on my end as this is a must for my implementation as it is quite possible to have ~500 metrics (timers and counters). We need to insure that in a production environment the act of reporting on things does not inadvertently affect performance and if it does we need to be able to disable it without bringing down the service.

How about at least being able to stop the MetricsHttpListener at runtime?

from metrics.net.

kadaan avatar kadaan commented on June 28, 2024

What about something like what twitter server supports:

/admin/metrics
Watch specific stats and extract them via http queries.

curl "localhost:8090/admin/metrics?m=clnt/crocodile/requests&m=clnt/crocodile/failures"
[
{
"name" : "clnt/crocodile/requests",
"delta" : 643.0,
"value" : 517342.0
},
{
"name" : "clnt/crocodile/failures",
"delta" : 90.0,
"value" : 77430.0
}
]

from metrics.net.

Related Issues (20)

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.