Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -13,7 +13,7 @@
* [ENHANCEMENT] Added `cortex_alertmanager_config_hash` metric to expose hash of Alertmanager Config loaded per user. #3388
* [ENHANCEMENT] Query-Frontend / Query-Scheduler: New component called "Query-Scheduler" has been introduced. Query-Scheduler is simply a queue of requests, moved outside of Query-Frontend. This allows Query-Frontend to be scaled separately from number of queues. To make Query-Frontend and Querier use Query-Scheduler, they need to be started with `-frontend.scheduler-address` and `-querier.scheduler-address` options respectively. #3374 #3471
* [ENHANCEMENT] Query-frontend / Querier / Ruler: added `-querier.max-query-lookback` to limit how long back data (series and metadata) can be queried. This setting can be overridden on a per-tenant basis and is enforced in the query-frontend, querier and ruler. #3452 #3458
* [ENHANCEMENT] Querier: added `-querier.query-store-for-labels-enabled` to query store for series API. Only works with blocks storage engine. #3461
* [ENHANCEMENT] Querier: added `-querier.query-store-for-labels-enabled` to query store for label names, label values and series APIs. Only works with blocks storage engine. #3461 #3520
* [ENHANCEMENT] Ingester: exposed `-blocks-storage.tsdb.wal-segment-size-bytes` config option to customise the TSDB WAL segment max size. #3476
* [ENHANCEMENT] Compactor: concurrently run blocks cleaner for multiple tenants. Concurrency can be configured via `-compactor.cleanup-concurrency`. #3483
* [ENHANCEMENT] Compactor: shuffle tenants before running compaction. #3483
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pkg/ruler/rules/rules.pb.go: pkg/ruler/rules/rules.proto
pkg/ruler/ruler.pb.go: pkg/ruler/rules/rules.proto
pkg/ring/kv/memberlist/kv.pb.go: pkg/ring/kv/memberlist/kv.proto
pkg/scheduler/schedulerpb/scheduler.pb.go: pkg/scheduler/schedulerpb/scheduler.proto
pkg/storegateway/storegatewaypb/gateway.pb.go: pkg/storegateway/storegatewaypb/gateway.proto
pkg/chunk/grpc/grpc.pb.go: pkg/chunk/grpc/grpc.proto
tools/blocksconvert/scheduler.pb.go: tools/blocksconvert/scheduler.proto

Expand Down
4 changes: 2 additions & 2 deletions docs/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ GET,POST <prometheus-http-prefix>/api/v1/labels
GET,POST <legacy-http-prefix>/api/v1/labels
```

Get label names of ingested series. Differently than Prometheus and due to scalability and performances reasons, Cortex currently ignores the `start` and `end` request parameters and always fetches the label names from in-memory data stored in the ingesters.
Get label names of ingested series. Differently than Prometheus and due to scalability and performances reasons, Cortex currently ignores the `start` and `end` request parameters and always fetches the label names from in-memory data stored in the ingesters. There is experimental support to query the long-term store with the *blocks* storage engine when `-querier.query-store-for-labels-enabled` is set.

_For more information, please check out the Prometheus [get label names](https://prometheus.io/docs/prometheus/latest/querying/api/#getting-label-names) documentation._

Expand All @@ -309,7 +309,7 @@ GET <prometheus-http-prefix>/api/v1/label/{name}/values
GET <legacy-http-prefix>/api/v1/label/{name}/values
```

Get label values for a given label name. Differently than Prometheus and due to scalability and performances reasons, Cortex currently ignores the `start` and `end` request parameters and always fetches the label values from in-memory data stored in the ingesters.
Get label values for a given label name. Differently than Prometheus and due to scalability and performances reasons, Cortex currently ignores the `start` and `end` request parameters and always fetches the label values from in-memory data stored in the ingesters. There is experimental support to query the long-term store with the *blocks* storage engine when `-querier.query-store-for-labels-enabled` is set.

_For more information, please check out the Prometheus [get label values](https://prometheus.io/docs/prometheus/latest/querying/api/#querying-label-values) documentation._

Expand Down
10 changes: 5 additions & 5 deletions integration/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,10 @@ func testMetadataQueriesWithBlocksStorage(
labelValuesTests: []labelValuesTest{
{
label: labels.MetricName,
resp: []string{lastSeriesInIngesterBlocksName, firstSeriesInIngesterHeadName},
resp: []string{lastSeriesInStorageName, lastSeriesInIngesterBlocksName, firstSeriesInIngesterHeadName},
},
},
labelNames: []string{labels.MetricName, lastSeriesInIngesterBlocksName, firstSeriesInIngesterHeadName},
labelNames: []string{labels.MetricName, lastSeriesInStorageName, lastSeriesInIngesterBlocksName, firstSeriesInIngesterHeadName},
},
"query metadata entirely outside the ingester range should return the head data as well": {
from: lastSeriesInStorageTs.Add(-2 * blockRangePeriod),
Expand All @@ -563,10 +563,10 @@ func testMetadataQueriesWithBlocksStorage(
labelValuesTests: []labelValuesTest{
{
label: labels.MetricName,
resp: []string{firstSeriesInIngesterHeadName},
resp: []string{lastSeriesInStorageName, firstSeriesInIngesterHeadName},
},
},
labelNames: []string{labels.MetricName, firstSeriesInIngesterHeadName},
labelNames: []string{labels.MetricName, lastSeriesInStorageName, firstSeriesInIngesterHeadName},
},
}

Expand All @@ -590,7 +590,7 @@ func testMetadataQueriesWithBlocksStorage(
for _, val := range lvt.resp {
exp = append(exp, model.LabelValue(val))
}
require.ElementsMatch(t, exp, labelsRes)
require.Equal(t, exp, labelsRes)
}

labelNames, err := c.LabelNames(tc.from, tc.to)
Expand Down
9 changes: 6 additions & 3 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ func (d *Distributor) LabelValuesForLabelName(ctx context.Context, from, to mode
for v := range valueSet {
values = append(values, v)
}

// We need the values returned to be sorted.
sort.Strings(values)

return values, nil
}

Expand Down Expand Up @@ -704,9 +708,8 @@ func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time) ([]st
for v := range valueSet {
values = append(values, v)
}
sort.Slice(values, func(i, j int) bool {
return values[i] < values[j]
})

sort.Strings(values)

return values, nil
}
Expand Down
Loading