Skip to content

Commit 882ebb0

Browse files
authored
Merge branch 'master' into fix-default-root-path-for-runtime-config
Signed-off-by: Charlie Le <[email protected]>
2 parents ebd158f + cccfd73 commit 882ebb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2909
-502
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
## master / unreleased
44

5+
* [FEATURE] Query Frontend/Querier: Add protobuf codec `-api.querier-default-codec` and the option to choose response compression type `-querier.response-compression`. #5527
6+
* [CHANGE] Enable Compactor and Alertmanager in target all. #6204
57
* [FEATURE] Ruler: Experimental: Add `ruler.frontend-address` to allow query to query frontends instead of ingesters. #6151
68
* [FEATURE] Ruler: Minimize chances of missed rule group evaluations that can occur due to OOM kills, bad underlying nodes, or due to an unhealthy ruler that appears in the ring as healthy. This feature is enabled via `-ruler.enable-ha-evaluation` flag. #6129
9+
* [ENHANCEMENT] Ingester: Add `blocks-storage.tsdb.wal-compression-type` to support zstd wal compression type. #6232
710
* [ENHANCEMENT] Query Frontend: Add info field to query response. #6207
811
* [ENHANCEMENT] Query Frontend: Add peakSample in query stats response. #6188
912
* [ENHANCEMENT] Ruler: Add new ruler metric `cortex_ruler_rule_groups_in_store` that is the total rule groups per tenant in store, which can be used to compare with `cortex_prometheus_rule_group_rules` to count the number of rule groups that are not loaded by a ruler. #5869
@@ -12,6 +15,7 @@
1215
* [ENHANCEMENT] Ingester: Add new API `/ingester/all_user_stats` which shows loaded blocks, active timeseries and ingestion rate for a specific ingester. #6178
1316
* [ENHANCEMENT] Distributor: Add new `cortex_reduced_resolution_histogram_samples_total` metric to track the number of histogram samples which resolution was reduced. #6182
1417
* [ENHANCEMENT] StoreGateway: Implement metadata API limit in queryable. #6195
18+
* [ENHANCEMENT] Ingester: Add matchers to ingester LabelNames() and LabelNamesStream() RPC. #6209
1519
* [BUGFIX] Runtime-config: Handle absolute file paths when working directory is not / #6224
1620

1721
## 1.18.0 2024-09-03

docs/blocks-storage/querier.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ querier:
109109
# CLI flag: -querier.ingester-metadata-streaming
110110
[ingester_metadata_streaming: <boolean> | default = true]
111111

112+
# Use LabelNames ingester RPCs with match params.
113+
# CLI flag: -querier.ingester-label-names-with-matchers
114+
[ingester_label_names_with_matchers: <boolean> | default = false]
115+
112116
# Maximum number of samples a single query can load into memory.
113117
# CLI flag: -querier.max-samples
114118
[max_samples: <int> | default = 50000000]
@@ -122,6 +126,11 @@ querier:
122126
# CLI flag: -querier.per-step-stats-enabled
123127
[per_step_stats_enabled: <boolean> | default = false]
124128

129+
# Use compression for metrics query API or instant and range query APIs.
130+
# Supports 'gzip' and '' (disable compression)
131+
# CLI flag: -querier.response-compression
132+
[response_compression: <string> | default = "gzip"]
133+
125134
# The time after which a metric should be queried from storage and not just
126135
# ingesters. 0 means all queries are sent to store. When running the blocks
127136
# storage, if this option is enabled, the time range of the query sent to the
@@ -1414,10 +1423,16 @@ blocks_storage:
14141423
# CLI flag: -blocks-storage.tsdb.stripe-size
14151424
[stripe_size: <int> | default = 16384]
14161425

1417-
# True to enable TSDB WAL compression.
1426+
# Deprecated (use blocks-storage.tsdb.wal-compression-type instead): True to
1427+
# enable TSDB WAL compression.
14181428
# CLI flag: -blocks-storage.tsdb.wal-compression-enabled
14191429
[wal_compression_enabled: <boolean> | default = false]
14201430

1431+
# TSDB WAL type. Supported values are: 'snappy', 'zstd' and '' (disable
1432+
# compression)
1433+
# CLI flag: -blocks-storage.tsdb.wal-compression-type
1434+
[wal_compression_type: <string> | default = ""]
1435+
14211436
# TSDB WAL segments files max size (bytes).
14221437
# CLI flag: -blocks-storage.tsdb.wal-segment-size-bytes
14231438
[wal_segment_size_bytes: <int> | default = 134217728]

docs/blocks-storage/store-gateway.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,10 +1538,16 @@ blocks_storage:
15381538
# CLI flag: -blocks-storage.tsdb.stripe-size
15391539
[stripe_size: <int> | default = 16384]
15401540

1541-
# True to enable TSDB WAL compression.
1541+
# Deprecated (use blocks-storage.tsdb.wal-compression-type instead): True to
1542+
# enable TSDB WAL compression.
15421543
# CLI flag: -blocks-storage.tsdb.wal-compression-enabled
15431544
[wal_compression_enabled: <boolean> | default = false]
15441545

1546+
# TSDB WAL type. Supported values are: 'snappy', 'zstd' and '' (disable
1547+
# compression)
1548+
# CLI flag: -blocks-storage.tsdb.wal-compression-type
1549+
[wal_compression_type: <string> | default = ""]
1550+
15451551
# TSDB WAL segments files max size (bytes).
15461552
# CLI flag: -blocks-storage.tsdb.wal-segment-size-bytes
15471553
[wal_segment_size_bytes: <int> | default = 134217728]

docs/configuration/config-file-reference.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ api:
9595
# CLI flag: -api.build-info-enabled
9696
[build_info_enabled: <boolean> | default = false]
9797

98+
# Choose default codec for querier response serialization. Supports 'json' and
99+
# 'protobuf'.
100+
# CLI flag: -api.querier-default-codec
101+
[querier_default_codec: <string> | default = "json"]
102+
98103
# The server_config configures the HTTP and gRPC server of the launched
99104
# service(s).
100105
[server: <server_config>]
@@ -1963,10 +1968,16 @@ tsdb:
19631968
# CLI flag: -blocks-storage.tsdb.stripe-size
19641969
[stripe_size: <int> | default = 16384]
19651970

1966-
# True to enable TSDB WAL compression.
1971+
# Deprecated (use blocks-storage.tsdb.wal-compression-type instead): True to
1972+
# enable TSDB WAL compression.
19671973
# CLI flag: -blocks-storage.tsdb.wal-compression-enabled
19681974
[wal_compression_enabled: <boolean> | default = false]
19691975

1976+
# TSDB WAL type. Supported values are: 'snappy', 'zstd' and '' (disable
1977+
# compression)
1978+
# CLI flag: -blocks-storage.tsdb.wal-compression-type
1979+
[wal_compression_type: <string> | default = ""]
1980+
19701981
# TSDB WAL segments files max size (bytes).
19711982
# CLI flag: -blocks-storage.tsdb.wal-segment-size-bytes
19721983
[wal_segment_size_bytes: <int> | default = 134217728]
@@ -3701,6 +3712,10 @@ The `querier_config` configures the Cortex querier.
37013712
# CLI flag: -querier.ingester-metadata-streaming
37023713
[ingester_metadata_streaming: <boolean> | default = true]
37033714
3715+
# Use LabelNames ingester RPCs with match params.
3716+
# CLI flag: -querier.ingester-label-names-with-matchers
3717+
[ingester_label_names_with_matchers: <boolean> | default = false]
3718+
37043719
# Maximum number of samples a single query can load into memory.
37053720
# CLI flag: -querier.max-samples
37063721
[max_samples: <int> | default = 50000000]
@@ -3714,6 +3729,11 @@ The `querier_config` configures the Cortex querier.
37143729
# CLI flag: -querier.per-step-stats-enabled
37153730
[per_step_stats_enabled: <boolean> | default = false]
37163731
3732+
# Use compression for metrics query API or instant and range query APIs.
3733+
# Supports 'gzip' and '' (disable compression)
3734+
# CLI flag: -querier.response-compression
3735+
[response_compression: <string> | default = "gzip"]
3736+
37173737
# The time after which a metric should be queried from storage and not just
37183738
# ingesters. 0 means all queries are sent to store. When running the blocks
37193739
# storage, if this option is enabled, the time range of the query sent to the
@@ -4460,6 +4480,12 @@ ring:
44604480
# Enable high availability
44614481
# CLI flag: -ruler.enable-ha-evaluation
44624482
[enable_ha_evaluation: <boolean> | default = false]
4483+
4484+
# Timeout duration for non-primary rulers during liveness checks. If the check
4485+
# times out, the non-primary ruler will evaluate the rule group. Applicable when
4486+
# ruler.enable-ha-evaluation is true.
4487+
# CLI flag: -ruler.liveness-check-timeout
4488+
[liveness_check_timeout: <duration> | default = 1s]
44634489
```
44644490

44654491
### `ruler_storage_config`

docs/configuration/v1-guarantees.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ Currently experimental features are:
115115
- String interning for metrics labels
116116
- Enable string interning for metrics labels by setting `-ingester.labels-string-interning-enabled` on Ingester.
117117
- Query-frontend: query rejection (`-frontend.query-rejection.enabled`)
118+
- Querier: protobuf codec (`-api.querier-default-codec`)

integration/api_endpoints_test.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"net/http"
10+
"path/filepath"
1011
"testing"
1112

1213
"github.com/stretchr/testify/assert"
@@ -22,10 +23,19 @@ func TestIndexAPIEndpoint(t *testing.T) {
2223
require.NoError(t, err)
2324
defer s.Close()
2425

26+
configOverrides := map[string]string{
27+
// alert manager
28+
"-alertmanager.web.external-url": "http://localhost/alertmanager",
29+
"-alertmanager-storage.backend": "local",
30+
"-alertmanager-storage.local.path": filepath.Join(e2e.ContainerSharedDir, "alertmanager_configs"),
31+
}
32+
// make alert manager config dir
33+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
34+
2535
// Start Cortex in single binary mode, reading the config from file.
2636
require.NoError(t, copyFileToSharedDir(s, "docs/configuration/single-process-config-blocks-local.yaml", cortexConfigFile))
2737

28-
cortex1 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", cortexConfigFile, nil, "", 9009, 9095)
38+
cortex1 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", cortexConfigFile, configOverrides, "", 9009, 9095)
2939
require.NoError(t, s.StartAndWaitReady(cortex1))
3040

3141
// GET / should succeed
@@ -44,10 +54,19 @@ func TestConfigAPIEndpoint(t *testing.T) {
4454
require.NoError(t, err)
4555
defer s.Close()
4656

57+
configOverrides := map[string]string{
58+
// alert manager
59+
"-alertmanager.web.external-url": "http://localhost/alertmanager",
60+
"-alertmanager-storage.backend": "local",
61+
"-alertmanager-storage.local.path": filepath.Join(e2e.ContainerSharedDir, "alertmanager_configs"),
62+
}
63+
// make alert manager config dir
64+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
65+
4766
// Start Cortex in single binary mode, reading the config from file.
4867
require.NoError(t, copyFileToSharedDir(s, "docs/configuration/single-process-config-blocks-local.yaml", cortexConfigFile))
4968

50-
cortex1 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", cortexConfigFile, nil, "", 9009, 9095)
69+
cortex1 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", cortexConfigFile, configOverrides, "", 9009, 9095)
5170
require.NoError(t, s.StartAndWaitReady(cortex1))
5271

5372
// Get config from /config API endpoint.
@@ -62,6 +81,7 @@ func TestConfigAPIEndpoint(t *testing.T) {
6281
// Start again Cortex in single binary with the exported config
6382
// and ensure it starts (pass the readiness probe).
6483
require.NoError(t, writeFileToSharedDir(s, cortexConfigFile, body))
65-
cortex2 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-2", cortexConfigFile, nil, "", 9009, 9095)
84+
configOverrides["-alertmanager.cluster.peers"] = cortex1.HTTPEndpoint()
85+
cortex2 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-2", cortexConfigFile, configOverrides, "", 9009, 9095)
6686
require.NoError(t, s.StartAndWaitReady(cortex2))
6787
}

integration/getting_started_single_process_config_local_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package integration
55

66
import (
7+
"path/filepath"
78
"testing"
89
"time"
910

@@ -24,7 +25,14 @@ func TestGettingStartedSingleProcessConfigWithFilesystem(t *testing.T) {
2425
// Start Cortex components.
2526
require.NoError(t, copyFileToSharedDir(s, "docs/configuration/single-process-config-blocks-local.yaml", cortexConfigFile))
2627

27-
flags := map[string]string{}
28+
flags := map[string]string{
29+
// alert manager
30+
"-alertmanager.web.external-url": "http://localhost/alertmanager",
31+
"-alertmanager-storage.backend": "local",
32+
"-alertmanager-storage.local.path": filepath.Join(e2e.ContainerSharedDir, "alertmanager_configs"),
33+
}
34+
// make alert manager config dir
35+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
2836

2937
cortex := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", cortexConfigFile, flags, "", 9009, 9095)
3038
require.NoError(t, s.StartAndWaitReady(cortex))

integration/getting_started_single_process_config_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package integration
55

66
import (
77
"fmt"
8+
"path/filepath"
89
"testing"
910
"time"
1011

@@ -38,7 +39,13 @@ func TestGettingStartedSingleProcessConfigWithBlocksStorage(t *testing.T) {
3839
"-blocks-storage.s3.bucket-name": bucketName,
3940
"-blocks-storage.s3.endpoint": fmt.Sprintf("%s-minio-9000:9000", networkName),
4041
"-blocks-storage.s3.insecure": "true",
42+
// alert manager
43+
"-alertmanager.web.external-url": "http://localhost/alertmanager",
44+
"-alertmanager-storage.backend": "local",
45+
"-alertmanager-storage.local.path": filepath.Join(e2e.ContainerSharedDir, "alertmanager_configs"),
4146
}
47+
// make alert manager config dir
48+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
4249

4350
cortex := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", cortexConfigFile, flags, "", 9009, 9095)
4451
require.NoError(t, s.StartAndWaitReady(cortex))

integration/getting_started_with_gossiped_ring_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package integration
55

66
import (
77
"fmt"
8+
"path/filepath"
89
"testing"
910
"time"
1011

@@ -45,8 +46,15 @@ func TestGettingStartedWithGossipedRing(t *testing.T) {
4546
"-blocks-storage.s3.insecure": "true",
4647
"-store-gateway.sharding-ring.wait-stability-min-duration": "0", // start quickly
4748
"-store-gateway.sharding-ring.wait-stability-max-duration": "0", // start quickly
49+
// alert manager
50+
"-alertmanager.web.external-url": "http://localhost/alertmanager",
51+
"-alertmanager-storage.backend": "local",
52+
"-alertmanager-storage.local.path": filepath.Join(e2e.ContainerSharedDir, "alertmanager_configs"),
4853
}
4954

55+
// make alert manager config dir
56+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
57+
5058
// This cortex will fail to join the cluster configured in yaml file. That's fine.
5159
cortex1 := e2ecortex.NewSingleBinaryWithConfigFile("cortex-1", "config1.yaml", e2e.MergeFlags(flags, map[string]string{
5260
"-ingester.lifecycler.addr": networkName + "-cortex-1", // Ingester's hostname in docker setup

integration/integration_memberlist_single_binary_test.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func testSingleBinaryEnv(t *testing.T, tlsEnabled bool, flags map[string]string)
4343
require.NoError(t, err)
4444
defer s.Close()
4545

46+
// make alert manager config dir
47+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
48+
4649
// Start dependencies
4750
minio := e2edb.NewMinio(9000, bucketName)
4851
// Look ma, no Consul!
@@ -116,16 +119,21 @@ func testSingleBinaryEnv(t *testing.T, tlsEnabled bool, flags map[string]string)
116119
}
117120

118121
func newSingleBinary(name string, servername string, join string, testFlags map[string]string) *e2ecortex.CortexService {
119-
flags := map[string]string{
120-
"-ingester.final-sleep": "0s",
121-
"-ingester.join-after": "0s", // join quickly
122-
"-ingester.min-ready-duration": "0s",
123-
"-ingester.num-tokens": "512",
124-
"-ingester.observe-period": "5s", // to avoid conflicts in tokens
125-
"-ring.store": "memberlist",
126-
"-memberlist.bind-port": "8000",
127-
"-memberlist.left-ingesters-timeout": "600s", // effectively disable
128-
}
122+
flags := mergeFlags(
123+
AlertmanagerLocalFlags(),
124+
map[string]string{
125+
"-ingester.final-sleep": "0s",
126+
"-ingester.join-after": "0s", // join quickly
127+
"-ingester.min-ready-duration": "0s",
128+
"-ingester.num-tokens": "512",
129+
"-ingester.observe-period": "5s", // to avoid conflicts in tokens
130+
"-ring.store": "memberlist",
131+
"-memberlist.bind-port": "8000",
132+
"-memberlist.left-ingesters-timeout": "600s", // effectively disable
133+
// alert manager
134+
"-alertmanager.web.external-url": "http://localhost/alertmanager",
135+
},
136+
)
129137

130138
if join != "" {
131139
flags["-memberlist.join"] = join
@@ -158,6 +166,9 @@ func TestSingleBinaryWithMemberlistScaling(t *testing.T) {
158166
require.NoError(t, err)
159167
defer s.Close()
160168

169+
// make alert manager config dir
170+
require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
171+
161172
minio := e2edb.NewMinio(9000, bucketName)
162173
require.NoError(t, s.StartAndWaitReady(minio))
163174

0 commit comments

Comments
 (0)