KxSystems / prometheus-kdb-exporter

Kdb+ exporter for Prometheus
https://code.kx.com/q/interfaces
Apache License 2.0
17 stars 9 forks source link

Histogram update #13

Closed mthompson-kx closed 3 years ago

mthompson-kx commented 3 years ago

Summary and histogram metrics are set to _seconds

Change to after:{} to return seconds

q)tm1:`timestamp$.z.d
q)tm2:tm1+0D00:00:05
q)
q)(10e-9)*tm2-tm1
50f
q)(10e-10)*tm2-tm1
5f
q)

Prometheus histogram buckets are required to be cumulative, with the last bucket matching the value of _count

Additionally a +Inf le is required.

Without the above changes the PromQL queries fail, returning NaN

histogram_quantile(0.9, rate(kdb_sync_histogram_seconds{service="kx-tp"}[10s]) )

Without changes

{container="tp-metrics", endpoint="metrics", instance="10.0.1.22:8080", job="kx-tp", namespace="kx", pod="kx-tp-566978d9fc-g4z4r", service="kx-tp"}

NaN

With changes

{container="tp-metrics", endpoint="metrics", instance="10.0.0.39:8080", job="kx-tp", namespace="kx", pod="kx-tp-688fbf59cc-9l9v5", service="kx-tp"}

0.225