Skip to content

Dropwizard Timer conversion method throws away useful metrics #525

@btpeterson

Description

@btpeterson

The fromTimer method in DropwizardExports https://github.com/prometheus/client_java/blob/master/simpleclient_dropwizard/src/main/java/io/prometheus/client/dropwizard/DropwizardExports.java#L110 converts a Metrics Timer into a Prometheus Summary without recording the min, max, mean, and standard deviation of the duration of some type of event, or the overall and moving averages of the rate of some type of event.

e.g. with Dropwizard 1.3.17 and Prometheus version 0.8.1

Where metrics for a Dropwizard Timer converted to a Prometheus Summary look like this:
# HELP io_dropwizard_jetty_MutableServletContextHandler_requests Generated from Dropwizard metric import (metric=io.dropwizard.jetty.MutableServletContextHandler.requests, type=com.codahale.metrics.Timer) \# TYPE io_dropwizard_jetty_MutableServletContextHandler_requests summary io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.5",} 0.10800000000000001 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.75",} 0.21100000000000002 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.95",} 0.741 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.98",} 0.741 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.99",} 0.741 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.999",} 0.741 io_dropwizard_jetty_MutableServletContextHandler_requests_count 9.0

It should look something of this form:
# HELP io_dropwizard_jetty_MutableServletContextHandler_requests Generated from Dropwizard metric import (metric=io.dropwizard.jetty.MutableServletContextHandler.requests, type=com.codahale.metrics.Timer) \# TYPE io_dropwizard_jetty_MutableServletContextHandler_requests summary io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.5",} 0.001 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.75",} 0.001 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.95",} 0.002 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.98",} 0.002 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.99",} 0.003 io_dropwizard_jetty_MutableServletContextHandler_requests{quantile="0.999",} 0.04 io_dropwizard_jetty_MutableServletContextHandler_requests_min 0.0 io_dropwizard_jetty_MutableServletContextHandler_requests_max 4.0E7 io_dropwizard_jetty_MutableServletContextHandler_requests_median 1000000.0 io_dropwizard_jetty_MutableServletContextHandler_requests_mean 1152216.7380545516 io_dropwizard_jetty_MutableServletContextHandler_requests_stddev 1843291.2698578946 io_dropwizard_jetty_MutableServletContextHandler_requests_count 1297.0 io_dropwizard_jetty_MutableServletContextHandler_requests{rate="m1",} 0.007373683673126385 io_dropwizard_jetty_MutableServletContextHandler_requests{rate="m5",} 0.8681037724467615 io_dropwizard_jetty_MutableServletContextHandler_requests{rate="m15",} 0.8406770125395507 io_dropwizard_jetty_MutableServletContextHandler_requests{rate="mean",} 0.568490738870207

Where both of the metrics above are derived from Dropwizard's Timer metric:
"io.dropwizard.jetty.MutableServletContextHandler.requests" : { "count" : 1297, "max" : 0.04, "mean" : 0.0011522167380545517, "min" : 0.0, "p50" : 0.001, "p75" : 0.001, "p95" : 0.002, "p98" : 0.002, "p99" : 0.003, "p999" : 0.04, "stddev" : 0.0018432912698578947, "m15_rate" : 0.4613733266784683, "m1_rate" : 9.099848574976793E-7, "m5_rate" : 0.14349658844641472, "mean_rate" : 0.45971442765657716, "duration_units" : "seconds", "rate_units" : "calls/second" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions