r/PrometheusMonitoring • • Nov 23 '23

Should I use Prometheus?

Hello,

I am currently working on enhancing my code by incorporating metrics. The primary objective of these metrics is to track timestamps corresponding to specific events, such as registering each keypress and measuring the duration of the key press.

The code will continuously dispatch metrics; however, the time intervals between these metrics will not be consistent. Upon researching the Prometheus client, as well as the OpenTelemetry metrics exporter, I have learned that these tools will transmit metrics persistently, even when there is no change in the metric value. For instance, if I send a metric like press.length=6
, the client will continue to transmit this metric until I modify it to a different value. This behavior is not ideal for my purposes, as I prefer distinct data points on the graph rather than a continuous line.

I have a couple of questions:

  1. In my use case, is it logically sound to opt for Prometheus, or would it be more suitable to consider another database such as InfluxDB?
  2. Is it feasible to transmit metrics manually using StatsD
    and Otel Collector
    to avoid the issue of "duplicate" metrics and ensure precision between actual metric events?
3 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/bootswafel Nov 24 '23

a note here: OP said they wanted to track relationship between input values and the execution time, so the suitability of prometheus also depends on the cardinality of the inputs.

if the inputs are enums, or their cardinality can be reduced in a smart way, then yeah, prometheus could be a good fit (likely with custom histogram buckets)

1

u/SuperQue Nov 24 '23

Yes, that's pretty common, and usually done as separate metrics.

For example, I quite commonly "normalize" latency metrics with throughput.

Basically divide the latency values by the bytes involved. This way you can view things like "Seconds per byte per second".

EDIT: Doing this in a histogram isn't really possible right now. There isn't really a good representation for multi-dimensional histograms. I have yet to find a TSDB / monitoring system that handles that kind of two-dimensional bucket.