Peekay
Peekay

Reputation: 451

How to monitor the time span between the request and response using prometheus java client

I am writing a Restful web api. I am using prometheus for monitoring my api . for example this is how i am keeping a count of total request and failed requests.

static final Counter requests = Counter.build()
         .name("requests_total").help("Total requests.").register();
static final Counter failedRequests = Counter.build()
         .name("requests_failed_total").help("Total failed requests.").register();

then i increment the counters like below

requests.inc();
failedRequests.inc();

the same way i would like to monitor the time span between the request and response of api call. Is there a prometheus java client which would help me doing this.? thanks in advance

Upvotes: 1

Views: 2137

Answers (1)

brian-brazil
brian-brazil

Reputation: 34142

A Summary's timing functinoality will let you do this: https://github.com/prometheus/client_java#summary

Upvotes: 1

Related Questions