From 5e9bd17b1f2d7a492653057e9e6f625564ede86a Mon Sep 17 00:00:00 2001 From: Nicole J <43453127+njingco@users.noreply.github.com> Date: Wed, 3 Jun 2020 10:30:52 -0700 Subject: [PATCH] added the prometheus_remote_storage_remote_read_queries_total (#7328) * added the prometheus_remote_storage_remote_read_queries_total query Signed-off-by: njingco * adjusted the help label of remoteReadQueriesTotal Signed-off-by: njingco --- storage/remote/read.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/storage/remote/read.go b/storage/remote/read.go index b03bb8869..219ba3ab3 100644 --- a/storage/remote/read.go +++ b/storage/remote/read.go @@ -32,14 +32,27 @@ var remoteReadQueries = prometheus.NewGaugeVec( []string{remoteName, endpoint}, ) +var remoteReadQueriesTotal = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "remote_read_queries_total", + Help: "The total number of remote read queries.", + }, + []string{remoteName, endpoint}, +) + func init() { prometheus.MustRegister(remoteReadQueries) + prometheus.MustRegister(remoteReadQueriesTotal) } // QueryableClient returns a storage.Queryable which queries the given // Client to select series sets. func QueryableClient(c *Client) storage.Queryable { remoteReadQueries.WithLabelValues(c.remoteName, c.url.String()) + remoteReadQueriesTotal.WithLabelValues(c.remoteName, c.url.String()) + return storage.QueryableFunc(func(ctx context.Context, mint, maxt int64) (storage.Querier, error) { return &querier{ ctx: ctx, @@ -68,6 +81,9 @@ func (q *querier) Select(sortSeries bool, hints *storage.SelectHints, matchers . remoteReadGauge.Inc() defer remoteReadGauge.Dec() + remoteReadTotalCounter := remoteReadQueriesTotal.WithLabelValues(q.client.remoteName, q.client.url.String()) + remoteReadTotalCounter.Inc() + res, err := q.client.Read(q.ctx, query) if err != nil { return nil, nil, fmt.Errorf("remote_read: %v", err)