Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* [CHANGE] Ingester: Make `close_idle_tsdb_timeout` a per-tenant limit (`-limits.close-idle-tsdb-timeout`). `-blocks-storage.tsdb.close-idle-tsdb-timeout` is deprecated and will be removed in v1.24.0. A positive `close_idle_tsdb_timeout` must now be at least `query_store_after` when `query_ingesters_within` is 0. #7813
* [CHANGE] Compactor: Add the `time_range_milliseconds` label to `cortex_compactor_remaining_planned_compactions` and `cortex_compactor_oldest_partition_offset`, reporting them per compaction time range instead of summed over all of them. #7959
* [CHANGE] Ingester: Enable native histogram ingestion by default (`-blocks-storage.tsdb.enable-native-histograms=true`). Set it to `false`, globally or per tenant via `enable_native_histograms`, to keep discarding native histogram samples. During a rolling upgrade, recent native histogram samples may be missing from query results because ingesters still running the previous version discard them. #7968
* [FEATURE] Ruler: Add experimental support for federated rule groups. A rule group listing tenants in its `source_tenants` field is evaluated against those tenants while the resulting series and alerts are written to the tenant owning the rule group. Enabled with `-ruler.enable-federated-rules` (requires `-tenant-federation.enabled`), and restricted to selected tenants with `-ruler.allowed-federated-tenants` and `-ruler.disallowed-federated-tenants`. #7828
* [FEATURE] Distributor: Add experimental OTLP metrics ingestion over gRPC (`opentelemetry.proto.collector.metrics.v1.MetricsService/Export`) on the gRPC server port. Enable it with `-distributor.otlp.grpc-enabled`. The tenant is read from the `X-Scope-OrgID` gRPC metadata, and the request size is limited by `-server.grpc-max-recv-msg-size-bytes`. #7873
* [FEATURE] Storage: Add support for Alibaba Cloud OSS as a backend for blocks, ruler, and alertmanager storage. Configured via `-<prefix>.oss.*` flags with `backend: oss`. #7907
Expand Down
5 changes: 3 additions & 2 deletions docs/configuration/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4682,9 +4682,10 @@ The `limits_config` configures default and per-tenant limits imposed by Cortex s
# series matching its matchers and exposes the count as a metric.
[active_series_trackers: <list of ActiveSeriesTrackerConfig> | default = []]

# True to enable native histogram.
# Enable ingestion of native histogram samples. When disabled, native histogram
# samples are discarded.
# CLI flag: -blocks-storage.tsdb.enable-native-histograms
[enable_native_histograms: <boolean> | default = false]
[enable_native_histograms: <boolean> | default = true]

# Maximum length (in bytes) of an unoptimized regex pattern. This is a
# pre-flight check to reject expensive regex queries. 0 to disable. This is only
Expand Down
1 change: 1 addition & 0 deletions docs/guides/native-histograms.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ And via yaml:
limits:
enable_native_histograms: <bool>
```
<!-- TODO: Update this guide when v1.23.0 is released: native histogram ingestion is enabled by default, document how to disable it and the recommended limits. -->
By default, it is disabled, so make sure to enable it if you need native histograms for your system monitoring.

When a `write request` contains both `samples` and `native histogram`, the ingestion behavior is as follows:
Expand Down
10 changes: 4 additions & 6 deletions integration/native_histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ func TestOOONativeHistogramIngestion(t *testing.T) {

flags := mergeFlags(baseFlags, map[string]string{
// ooo setting
"-blocks-storage.tsdb.enable-native-histograms": "true",
"-ingester.out-of-order-time-window": "5m",
"-ingester.out-of-order-time-window": "5m",
// alert manager
"-alertmanager.web.external-url": "http://localhost/alertmanager",
// consul
Expand Down Expand Up @@ -117,10 +116,9 @@ func TestNativeHistogramIngestionAndQuery(t *testing.T) {
// Configure the blocks storage to frequently compact TSDB head
// and ship blocks to the storage.
flags := mergeFlags(BlocksStorageFlags(), map[string]string{
"-blocks-storage.tsdb.block-ranges-period": blockRangePeriod.String(),
"-blocks-storage.tsdb.ship-interval": "1s",
"-blocks-storage.tsdb.retention-period": ((blockRangePeriod * 2) - 1).String(),
"-blocks-storage.tsdb.enable-native-histograms": "true",
"-blocks-storage.tsdb.block-ranges-period": blockRangePeriod.String(),
"-blocks-storage.tsdb.ship-interval": "1s",
"-blocks-storage.tsdb.retention-period": ((blockRangePeriod * 2) - 1).String(),
})

// Start dependencies.
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/validation/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestOverridesExporter_withConfig(t *testing.T) {
cortex_overrides{limit_name="compactor_partition_series_count",user="tenant-a"} 0
cortex_overrides{limit_name="compactor_tenant_shard_size",user="tenant-a"} 0
cortex_overrides{limit_name="creation_grace_period",user="tenant-a"} 600
cortex_overrides{limit_name="enable_native_histograms",user="tenant-a"} 0
cortex_overrides{limit_name="enable_native_histograms",user="tenant-a"} 1
cortex_overrides{limit_name="enable_start_timestamp",user="tenant-a"} 0
cortex_overrides{limit_name="enable_type_and_unit_labels",user="tenant-a"} 0
cortex_overrides{limit_name="enforce_metadata_metric_name",user="tenant-a"} 1
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/validation/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (l *Limits) RegisterFlags(f *flag.FlagSet) {
f.IntVar(&l.MaxGlobalSeriesPerMetric, "ingester.max-global-series-per-metric", 0, "The maximum number of active series per metric name, across the cluster before replication. 0 to disable.")
f.IntVar(&l.MaxLocalNativeHistogramSeriesPerUser, "ingester.max-native-histogram-series-per-user", 0, "The maximum number of active native histogram series per user, per ingester. 0 to disable. Supported only if ingester.active-series-metrics-enabled is true.")
f.IntVar(&l.MaxGlobalNativeHistogramSeriesPerUser, "ingester.max-global-native-histogram-series-per-user", 0, "The maximum number of active native histogram series per user, across the cluster before replication. 0 to disable. Supported only if -distributor.shard-by-all-labels and ingester.active-series-metrics-enabled is true.")
f.BoolVar(&l.EnableNativeHistograms, "blocks-storage.tsdb.enable-native-histograms", false, "True to enable native histogram.")
f.BoolVar(&l.EnableNativeHistograms, "blocks-storage.tsdb.enable-native-histograms", true, "Enable ingestion of native histogram samples. When disabled, native histogram samples are discarded.")
f.IntVar(&l.MaxExemplars, "ingester.max-exemplars", 0, "Enables support for exemplars in TSDB and sets the maximum number that will be stored. less than zero means disabled. If the value is set to zero, cortex will fallback to the deprecated blocks-storage.tsdb.max-exemplars value; that fallback is removed in v1.24.0.")
f.Var(&l.OutOfOrderTimeWindow, "ingester.out-of-order-time-window", "[Experimental] Configures the allowed time window for ingestion of out-of-order samples. Disabled (0s) by default.")

Expand Down
25 changes: 25 additions & 0 deletions pkg/util/validation/limits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,31 @@ func TestOverrides_MaxChunksPerQueryFromStore(t *testing.T) {
assert.Equal(t, 2000000, overrides.MaxChunksPerQueryFromStore("test"))
}

func TestOverrides_EnableNativeHistograms(t *testing.T) {
defaults := Limits{}
flagext.DefaultValues(&defaults)
SetDefaultLimitsForYAMLUnmarshalling(defaults)

var yamlUnset, yamlDisabled, jsonUnset, jsonDisabled Limits
require.NoError(t, yaml.UnmarshalStrict([]byte(`ingestion_rate: 1`), &yamlUnset))
require.NoError(t, yaml.UnmarshalStrict([]byte(`enable_native_histograms: false`), &yamlDisabled))
require.NoError(t, json.Unmarshal([]byte(`{"ingestion_rate": 1}`), &jsonUnset))
require.NoError(t, json.Unmarshal([]byte(`{"enable_native_histograms": false}`), &jsonDisabled))

overrides := NewOverrides(defaults, newMockTenantLimits(map[string]*Limits{
"yaml-unset": &yamlUnset,
"yaml-disabled": &yamlDisabled,
"json-unset": &jsonUnset,
"json-disabled": &jsonDisabled,
}))

assert.True(t, overrides.EnableNativeHistograms("no-override"))
assert.True(t, overrides.EnableNativeHistograms("yaml-unset"))
assert.False(t, overrides.EnableNativeHistograms("yaml-disabled"))
assert.True(t, overrides.EnableNativeHistograms("json-unset"))
assert.False(t, overrides.EnableNativeHistograms("json-disabled"))
}

func TestOverridesManager_GetOverrides(t *testing.T) {
tenantLimits := map[string]*Limits{}

Expand Down
4 changes: 2 additions & 2 deletions schemas/cortex-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5739,8 +5739,8 @@
"x-cli-flag": "distributor.drop-label"
},
"enable_native_histograms": {
"default": false,
"description": "True to enable native histogram.",
"default": true,
"description": "Enable ingestion of native histogram samples. When disabled, native histogram samples are discarded.",
"type": "boolean",
"x-cli-flag": "blocks-storage.tsdb.enable-native-histograms"
},
Expand Down