Skip to content

Commit dd511dd

Browse files
pstibranypracucci
authored andcommitted
TSDB: metrics for queries (#1981)
* Update queriedSeries and queriedSamples metrics in v2Query. Signed-off-by: Peter Štibraný <[email protected]> * Increment number of users when creating new TSDB. Signed-off-by: Peter Štibraný <[email protected]> * Use length of slices to update metrics. Signed-off-by: Peter Štibraný <[email protected]> * Update CHANGELOG.md Signed-off-by: Peter Štibraný <[email protected]> * Removed memUsers.Inc() in favor of PR #1982. Signed-off-by: Peter Štibraný <[email protected]> * Removed mention of cortex_ingester_memory_users from CHANGELOG.md Signed-off-by: Peter Štibraný <[email protected]> * One more small fix to CHANGELOG.md. Signed-off-by: Peter Štibraný <[email protected]>
1 parent ec2d8c4 commit dd511dd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* [BUGFIX] TSDB: Fixed error handling in the series to chunks conversion with the experimental TSDB blocks storage. #1837
3131
* [BUGFIX] TSDB: Fixed TSDB creation conflict with blocks transfer in a `JOINING` ingester with the experimental TSDB blocks storage. #1818
3232
* [BUGFIX] TSDB: `experimental.tsdb.ship-interval` of <=0 treated as disabled instead of allowing panic. #1975
33+
* [BUGFIX] TSDB: Fixed `cortex_ingester_queried_samples` and `cortex_ingester_queried_series` metrics when using block storage. #1981
3334

3435
## 0.4.0 / 2019-12-02
3536

pkg/ingester/ingester_v2.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ func (i *Ingester) v2Query(ctx old_ctx.Context, req *client.QueryRequest) (*clie
198198
return nil, err
199199
}
200200

201+
numSamples := 0
202+
201203
result := &client.QueryResponse{}
202204
for ss.Next() {
203205
series := ss.At()
@@ -212,9 +214,13 @@ func (i *Ingester) v2Query(ctx old_ctx.Context, req *client.QueryRequest) (*clie
212214
ts.Samples = append(ts.Samples, client.Sample{Value: v, TimestampMs: t})
213215
}
214216

217+
numSamples += len(ts.Samples)
215218
result.Timeseries = append(result.Timeseries, ts)
216219
}
217220

221+
i.metrics.queriedSeries.Observe(float64(len(result.Timeseries)))
222+
i.metrics.queriedSamples.Observe(float64(numSamples))
223+
218224
return result, ss.Err()
219225
}
220226

0 commit comments

Comments
 (0)