Thanks Julien. I guess there are examples for both, having Exemplars with
the delta as well as the absolute value.

Example 1) Number of Bytes in a queue. You would call myGauge.inc(nBytes)
if a message is added to the queue, and myGauge.dec(nBytes) if a message is
fetched from the queue. If adding / fetching is done via REST API, it would
make sense to have Exemplars for the add/fetch operations.

Example 2) An IoT device reaching out to a Web hook for reporting
temperature. To track the current temperature, you'd call
myGauge.set(temperature). If the IoT device is capable of adding trace
headers when calling the Web hook it would be good to have Exemplars of
these calls.

The Java library supports automatic Exemplars, i.e. users don't call
explicit API to add Exemplars, but the library figures out if a current
trace context exists and samples Exemplars automatically under the hood.
For that, we need a default behavior. So what would a good default be?
Always the total value of the Gauge, or always the delta, or make it depend
on whether inc(), dec(), or set() was called?

Fabian


On Tue, Dec 6, 2022 at 11:18 PM Julien Pivotto <[email protected]>
wrote:

> On 06 Dec 23:06, 'Fabian Stäber' via Prometheus Developers wrote:
> > Hi,
> >
> > I'm experimenting with Exemplars for Gauge metrics in client_java
> > (background: at the dev summit on 10 November 2022
> > <
> https://docs.google.com/document/d/11LC3wJcVk00l8w5P3oLQ-m3Y37iom6INAMEu2ZAGIIE/edit
> >
> > we decided that "Prometheus will ingest Exemplars on all time series").
> >
> > For comparison: A counter MUST have the following methods
> > <https://prometheus.io/docs/instrumenting/writing_clientlibs/#counter>:
> >
> >    - inc(): Increment the counter by 1
> >    - inc(double v): Increment the counter by the given amount. MUST check
> >    that v >= 0.
> >
> > Exemplars will contain the increment, i.e. if inc() is called the
> Exemplar
> > will have the value 1.0, if inc(v) is called the Exemplar will have the
> > value v.
> >
> > Now, A gauge MUST have the following methods
> > <https://prometheus.io/docs/instrumenting/writing_clientlibs/#gauge>:
> >
> >    - inc(): Increment the gauge by 1
> >    - inc(double v): Increment the gauge by the given amount
> >    - dec(): Decrement the gauge by 1
> >    - dec(double v): Decrement the gauge by the given amount
> >    - set(double v): Set the gauge to the given value
> >
> > Which value should we choose for Gauge Exemplars?
>
> That is a good question and my guess would be that it will depend on the
> use case. Do you have examples of gauges would would attach exemplars
> to?
>
> --
> Julien Pivotto
> @roidelapluie
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/CAPX310ipsufix2s4_P4PXOvzGr4MFDbHaaBmmJZXpnW-k%2Bas6g%40mail.gmail.com.

Reply via email to