-
Notifications
You must be signed in to change notification settings - Fork 327
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
Histogram recorded value cannot be negative. #232
Comments
Here are the kamon modules and versions I am using. I am running on a Java8 JVM and using aspectjweaver-1.8.6.jar. |
I am hitting same issue. I am sure I am recording positive values. |
I am having the same issue, using Java8. Here's the stack trace |
I am thinking on this issue now and sadly there doesn't seem to be too much that we can do in the case of a failing gauge because as you can see in the code, there is no information at all to tell you which gauge is failing. But I see two things that we can do to improve this situation:
I will work on this ASAP, regards! |
I am also facing this issue. In my case it has something to do with "kamon-system-metics":
Don't know how the CPU metrics should be negative, but this is the case :) (happening on Windows 7 btw.) |
Looking at the code of ProcessCpuMetrics it seems to me that in fact there can occur negative numbers: def update(): Unit = {
val currentProcCpu = sigar.getProcCpu(pid)
val totalDiff = currentProcCpu.getTotal - lastProcCpu.getTotal
val userDiff = currentProcCpu.getUser - lastProcCpu.getUser
val systemDiff = currentProcCpu.getSys - lastProcCpu.getSys
val timeDiff = currentProcCpu.getLastTime - lastProcCpu.getLastTime
def percentUsage(delta: Long): Long = Try(100 * delta / timeDiff / totalCores).getOrElse(0L)
if (totalDiff == 0) {
if (timeDiff > 2000) currentLoad = 0
if (currentLoad == 0) lastProcCpu = currentProcCpu
} else {
val totalPercent = percentUsage(totalDiff)
val userPercent = percentUsage(userDiff)
val systemPercent = percentUsage(systemDiff)
processUserCpu.record(userPercent)
processSystemCpu.record(systemPercent) // <<<==== this is line 69
processTotalCpu.record(userPercent + systemPercent)
currentLoad = totalPercent
lastProcCpu = currentProcCpu
}
}
The value of |
Please ensure that any exception triggered within Kamon is caught. We have experienced a couple of issues due to #284 and the result is that the underlying actor no longer received any messages sent to it's mailbox. Under most circumstances, it is possible to rework applications to prevent 'old' messages triggering the exception, but if you need to stash a message pending user intervention #252 means that the same exception can be triggered. As a monitoring tool Kamon should not interfere with the running of the application. |
core: catch any exception being thrown when recording values on histograms
core: catch any exception being thrown when recording values on histograms
I noticed the following error shortly after starting up one of my scala services running in a docker container on OSX.
I do not know how to reproduce it but if there are any steps I can take to help troubleshoot the issue please let me know.
java.lang.ArrayIndexOutOfBoundsException: Histogram recorded value cannot be negative.
dispatcher_1 | at org.HdrHistogram.AbstractHistogram.countsArrayIndex(AbstractHistogram.java:1944)
dispatcher_1 | at org.HdrHistogram.AbstractHistogram.recordSingleValue(AbstractHistogram.java:414)
dispatcher_1 | at org.HdrHistogram.AbstractHistogram.recordValue(AbstractHistogram.java:333)
dispatcher_1 | at kamon.metric.instrument.HdrHistogram.record(Histogram.scala:115)
dispatcher_1 | at akka.kamon.instrumentation.ActorCellInstrumentation.aroundBehaviourInvoke(ActorCellInstrumentation.scala:68)
dispatcher_1 | at akka.actor.ActorCell.invoke(ActorCell.scala:483)
dispatcher_1 | at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)
dispatcher_1 | at akka.dispatch.Mailbox.run(Mailbox.scala:221)
dispatcher_1 | at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
dispatcher_1 | at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
dispatcher_1 | at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
dispatcher_1 | at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
dispatcher_1 | at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
The text was updated successfully, but these errors were encountered: