zio/zio-zmx

Summary with maxSize=0 crashes

Closed this issue · 0 comments

vigoo commented

When migrating a codebase using the Prometheus Java client, a summary created like this:

 Summary
            .build()
            .namespace("xxx")
            .name("yyy")
            .help("zzz")
            .register(registry)

it is not immediately obvious how to translate this to zio-zmx's summary parameters (this could be documented in a migration guide).

After checking the Java library's implementation (https://github.com/prometheus/client_java/blob/master/simpleclient/src/main/java/io/prometheus/client/Summary.java) I came up with the following parameters:

  • maxAge is 10 minutes by default
  • there are no quantiles by default so that became Chunk.empty
  • with no quantiles, i set the error to 0.0
  • the maxSize parameter seemed to also relate to the quantiles so i also set it to 0

that makes ConcurrentSumamry to throw a NoSuchElementException on this line: https://github.com/zio/zio-zmx/blob/master/core/jvm/src/main/scala/zio/zmx/internal/ConcurrentSummary.scala#L69