Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename metric to cortex_querier_query_storegateway_chunks_total #7145

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* [ENHANCEMENT] Distributor: support disabling metric relabel rules per-tenant via the flag `-distributor.metric-relabeling-enabled` or associated YAML. #6970
* [ENHANCEMENT] Distributor: `-distributor.remote-timeout` is now accounted from the first ingester push request being sent. #6972
* [ENHANCEMENT] Storage Provider: allow aws sts support for s3 storage provider #6172
* [ENHANCEMENT] Querier: add `cortex_querier_queries_storage_type_total ` metric that indicates how many queries have executed for a source, ingesters or store-gateways. Add `cortex_query_storegateway_chunks_total` metric to count the number of chunks fetched from a store gateway. #7099
* [ENHANCEMENT] Querier: add `cortex_querier_queries_storage_type_total ` metric that indicates how many queries have executed for a source, ingesters or store-gateways. Add `cortex_querier_query_storegateway_chunks_total` metric to count the number of chunks fetched from a store gateway. #7099, #7145
jhalterman marked this conversation as resolved.
Show resolved Hide resolved
* [ENHANCEMENT] Query-frontend: add experimental support for sharding active series queries via `-query-frontend.shard-active-series-queries`. #6784
* [ENHANCEMENT] Distributor: set `-distributor.reusable-ingester-push-workers=2000` by default and mark feature as `advanced`. #7128
* [ENHANCEMENT] All: set `-server.grpc.num-workers=100` by default and mark feature as `advanced`. #7131
Expand Down
3 changes: 1 addition & 2 deletions pkg/querier/blocks_store_queryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ func newBlocksStoreQueryableMetrics(reg prometheus.Registerer) *blocksStoreQuery
Name: "cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total",
Help: "Blocks that couldn't be checked for query and compactor sharding optimization due to incompatible shard counts.",
}),
// Named to be consistent with distributor_query_ingester_chunks_total
chunksTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "cortex_query_storegateway_chunks_total",
Name: "cortex_querier_query_storegateway_chunks_total",
Help: "Number of chunks received from store gateways at query time.",
}),
}
Expand Down
25 changes: 22 additions & 3 deletions pkg/querier/blocks_store_queryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
storeSetResponses: []interface{}{
map[BlocksStoreClient][]ulid.ULID{
&storeGatewayClientMock{remoteAddr: "1.1.1.1", mockedSeriesResponses: []*storepb.SeriesResponse{
mockSeriesResponse(series1Label, minT+1, 2),
mockSeriesResponse(series1Label, minT+1, 2), // a chunk is written for each mockSeriesResponse
mockSeriesResponse(series2Label, minT, 1),
mockHintsResponse(block1),
}}: {block1},
Expand Down Expand Up @@ -340,6 +340,9 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
# HELP cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total Blocks that couldn't be checked for query and compactor sharding optimization due to incompatible shard counts.
# TYPE cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total counter
cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total 0
# HELP cortex_querier_query_storegateway_chunks_total Number of chunks received from store gateways at query time.
# TYPE cortex_querier_query_storegateway_chunks_total counter
cortex_querier_query_storegateway_chunks_total 6
`,
},
"a single store-gateway instance has some missing blocks (consistency check failed)": {
Expand Down Expand Up @@ -476,6 +479,9 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
# HELP cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total Blocks that couldn't be checked for query and compactor sharding optimization due to incompatible shard counts.
# TYPE cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total counter
cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total 0
# HELP cortex_querier_query_storegateway_chunks_total Number of chunks received from store gateways at query time.
# TYPE cortex_querier_query_storegateway_chunks_total counter
cortex_querier_query_storegateway_chunks_total 4
`,
},
"max chunks per query limit greater then the number of chunks fetched": {
Expand Down Expand Up @@ -679,6 +685,9 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
cortex_querier_storegateway_refetches_per_query_bucket{le="+Inf"} 1
cortex_querier_storegateway_refetches_per_query_sum 0
cortex_querier_storegateway_refetches_per_query_count 1
# HELP cortex_querier_query_storegateway_chunks_total Number of chunks received from store gateways at query time.
# TYPE cortex_querier_query_storegateway_chunks_total counter
cortex_querier_query_storegateway_chunks_total 2
`,
},
"all blocks are queried if shards don't match": {
Expand Down Expand Up @@ -746,6 +755,9 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
cortex_querier_storegateway_refetches_per_query_bucket{le="+Inf"} 1
cortex_querier_storegateway_refetches_per_query_sum 0
cortex_querier_storegateway_refetches_per_query_count 1
# HELP cortex_querier_query_storegateway_chunks_total Number of chunks received from store gateways at query time.
# TYPE cortex_querier_query_storegateway_chunks_total counter
cortex_querier_query_storegateway_chunks_total 2
`,
},
"multiple store-gateways have the block, but one of them fails to return": {
Expand Down Expand Up @@ -813,13 +825,16 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
cortex_querier_storegateway_refetches_per_query_bucket{le="+Inf"} 1
cortex_querier_storegateway_refetches_per_query_sum 1
cortex_querier_storegateway_refetches_per_query_count 1
# HELP cortex_querier_query_storegateway_chunks_total Number of chunks received from store gateways at query time.
# TYPE cortex_querier_query_storegateway_chunks_total counter
cortex_querier_query_storegateway_chunks_total 1
`,
},
}

for testName, testData := range tests {
t.Run(testName, func(t *testing.T) {
for _, streaming := range []bool{true, false} {
jhalterman marked this conversation as resolved.
Show resolved Hide resolved
for _, streaming := range []bool{false} {
t.Run(fmt.Sprintf("streaming=%t", streaming), func(t *testing.T) {
reg := prometheus.NewPedanticRegistry()

Expand Down Expand Up @@ -942,7 +957,8 @@ func TestBlocksStoreQuerier_Select(t *testing.T) {
if testData.expectedMetrics != "" {
assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(testData.expectedMetrics),
"cortex_querier_storegateway_instances_hit_per_query", "cortex_querier_storegateway_refetches_per_query",
"cortex_querier_blocks_found_total", "cortex_querier_blocks_queried_total", "cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total"))
"cortex_querier_blocks_found_total", "cortex_querier_blocks_queried_total", "cortex_querier_blocks_with_compactor_shard_but_incompatible_query_shard_total",
"cortex_querier_query_storegateway_chunks_total"))
}
})
}
Expand Down Expand Up @@ -1618,6 +1634,9 @@ func TestBlocksStoreQuerier_Labels(t *testing.T) {
cortex_querier_storegateway_refetches_per_query_bucket{le="+Inf"} 1
cortex_querier_storegateway_refetches_per_query_sum 2
cortex_querier_storegateway_refetches_per_query_count 1
# HELP cortex_querier_query_storegateway_chunks_total Number of chunks received from store gateways at query time.
# TYPE cortex_querier_query_storegateway_chunks_total counter
cortex_querier_query_storegateway_chunks_total 4
`,
},
"multiple store-gateways have the block, but one of them fails to return": {
Expand Down
Loading