micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.39k stars 966 forks source link

Add gauges for jvm.threads.deadlocked and jvm.threads.deadlocked.monitor #5222

Open rkurniawati opened 2 weeks ago

rkurniawati commented 2 weeks ago

Hello,

I was wondering if you would consider accepting the changes in this PR so that we will have these two deadlock-related metrics in a future version of Micrometer?

This PR adds the following JVM thread deadlock-related metrics:

Thanks, Ruth

Ruth Kurniawati

pivotal-cla commented 2 weeks ago

@rkurniawati Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 2 weeks ago

@rkurniawati Thank you for signing the Contributor License Agreement!

rkurniawati commented 1 week ago

Thank you for your feedback, @shakuzen! I agree it's a good idea to let the users enable these metrics when they need them. The APIs used by the deadlock metrics have some overhead in the JVM implementation that I use, calling the findDeadlockedThreads triggers a JVM safepoint which will cause a slowdown that may be significant to some applications.

When you suggest putting these in a separate class, do you mean put them in a separate metric binder? It would be great if you have an example of a metric that's disabled by default.

Thanks, Ruth