Hi Julien,
Thank you very much for the response. I used the following code segment.
I register the Counter like this
static final Counter TOTAL_REQUESTS_RECEIVED = Counter.build
(MetricConstants.PROXY_REQUEST_COUNT_TOTAL,"Total no.of requests").
labelNames("test").register();
and use the following method in the server shutdown method.
TOTAL_REQUESTS_RECEIVED.labels();
But still the previous counter values are not set to 0.
Please help me to solve this.
Thanks.
On Wed, 8 Jul 2020 at 02:36, Julien Pivotto <[email protected]>
wrote:
> On 07 Jul 11:51, Nipuni wrote:
> > I want to set Prometheus Counter value to 0 when the server restarts in
> a
> > manner similar to,
> >
> > * private static final Gauge SERVER_UP =
> Gauge.build(MetricConstants.SERVER_UP, "Server
> status").labelNames(labels).register();*
> >
> > * Gauge gauge = (Gauge) map.get(SERVER_UP);*
> > * gauge.labels(serviceName, serviceType).set(0);*
> >
> >
> > How can this be done with Counters ?
>
> Just call the .labels() function without .inc()
>
>
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Prometheus Users" 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-users/f3d920aa-31a7-4446-ab2d-c7b5d3fddd50o%40googlegroups.com
> .
>
>
> --
> Julien Pivotto
> @roidelapluie
>
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" 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-users/CAKHONj3kD4Ps-hjJ8%3DKaExodeFepk51bDDmQ9T9mCY7AmPt-SQ%40mail.gmail.com.