Skip to content

Commit edaab80

Browse files
Adding the Ruler to the Single Binary (#2854)
* Moved queryable and engine creation into initStoreQueryables Signed-off-by: Joe Elliott <[email protected]> * Enabled ruler sharding in local dev mode Signed-off-by: Joe Elliott <[email protected]> * Added local filesystem option. Added ruler config to single binary. Signed-off-by: Joe Elliott <[email protected]> * StoreQueryable => Queryable Signed-off-by: Joe Elliott <[email protected]> * Made queryable dependent on the distributor Signed-off-by: Joe Elliott <[email protected]> * lint + doc Signed-off-by: Joe Elliott <[email protected]> * changelog Signed-off-by: Joe Elliott <[email protected]> * Fixed test Signed-off-by: Joe Elliott <[email protected]> * Url => URL Signed-off-by: Joe Elliott <[email protected]> * Url => URL Signed-off-by: Joe Elliott <[email protected]> * Added local storage option for ruler and added tests Signed-off-by: Joe Elliott <[email protected]> * lint Signed-off-by: Joe Elliott <[email protected]> * make doc Signed-off-by: Joe Elliott <[email protected]> * Split promql query engine in two Signed-off-by: Joe Elliott <[email protected]> * Addressed review concerns Signed-off-by: Joe Elliott <[email protected]> * removed 2s poll interval from standard configs and moved to test Signed-off-by: Joe Elliott <[email protected]> * Added notes about local storage Signed-off-by: Joe Elliott <[email protected]> * Clarified creation/deletion Signed-off-by: Joe Elliott <[email protected]> * readme cleanup Signed-off-by: Joe Elliott <[email protected]> * Removed ruler config from integration tests. Allow single binary to start without a ruler config Signed-off-by: Joe Elliott <[email protected]> * Reworked the CHANGELOG Signed-off-by: Marco Pracucci <[email protected]> Co-authored-by: Marco Pracucci <[email protected]>
1 parent a2310b9 commit edaab80

19 files changed

+406
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
* [CHANGE] Ingester: Chunks flushed via /flush stay in memory until retention period is reached. This affects `cortex_ingester_memory_chunks` metric. #2778
1515
* [CHANGE] Querier: the error message returned when the query time range exceeds `-store.max-query-length` has changed from `invalid query, length > limit (X > Y)` to `the query time range exceeds the limit (query length: X, limit: Y)`. #2826
1616
* [CHANGE] KV: The `role` label which was a label of `multi` KV store client only has been added to metrics of every KV store client. If KV store client is not `multi`, then the value of `role` label is `primary`. #2837
17+
* [CHANGE] Added the `engine` label to the metrics exposed by the Prometheus query engine, to distinguish between `ruler` and `querier` metrics. #2854
18+
* [CHANGE] Added ruler to the single binary when started with `-target=all` (default). #2854
1719
* [CHANGE] Experimental TSDB: compact head when opening TSDB. This should only affect ingester startup after it was unable to compact head in previous run. #2870
1820
* [FEATURE] Introduced `ruler.for-outage-tolerance`, Max time to tolerate outage for restoring "for" state of alert. #2783
1921
* [FEATURE] Introduced `ruler.for-grace-period`, Minimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period. #2783
2022
* [FEATURE] Introduced `ruler.resend-delay`, Minimum amount of time to wait before resending an alert to Alertmanager. #2783
23+
* [FEATURE] Ruler: added `local` filesystem support to store rules (read-only). #2854
2124
* [ENHANCEMENT] Upgraded Docker base images to `alpine:3.12`. #2862
2225
* [ENHANCEMENT] Experimental: Querier can now optionally query secondary store. This is specified by using `-querier.second-store-engine` option, with values `chunks` or `tsdb`. Standard configuration options for this store are used. Additionally, this querying can be configured to happen only for queries that need data older than `-querier.use-second-store-before-time`. Default value of zero will always query secondary store. #2747
2326
* [ENHANCEMENT] Query-tee: increased the `cortex_querytee_request_duration_seconds` metric buckets granularity. #2799
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*
2+
!cortex-rules
23
!cortex-tsdb
34
!.gitignore
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

development/tsdb-blocks-storage-s3-single-binary/config/cortex.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,19 @@ tsdb:
5656

5757
storage:
5858
engine: tsdb
59+
60+
ruler:
61+
enable_api: true
62+
enable_sharding: true
63+
poll_interval: 2s
64+
storage:
65+
type: s3
66+
s3:
67+
bucketnames: cortex-rules
68+
s3forcepathstyle: true
69+
s3: http://cortex:supersecret@minio.:9000
70+
ring:
71+
kvstore:
72+
store: consul
73+
consul:
74+
host: consul:8500

docs/configuration/config-file-reference.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,8 @@ ruler_client:
818818
[poll_interval: <duration> | default = 1m]
819819
820820
storage:
821-
# Method to use for backend rule storage (configdb, azure, gcs, s3)
821+
# Method to use for backend rule storage (configdb, azure, gcs, s3, swift,
822+
# local)
822823
# CLI flag: -ruler.storage.type
823824
[type: <string> | default = "configdb"]
824825
@@ -998,6 +999,11 @@ storage:
998999
# CLI flag: -ruler.storage.swift.container-name
9991000
[container_name: <string> | default = "cortex"]
10001001

1002+
local:
1003+
# Directory to scan for rules
1004+
# CLI flag: -ruler.storage.local.directory
1005+
[directory: <string> | default = ""]
1006+
10011007
# file path to store temporary rule files for the prometheus rule managers
10021008
# CLI flag: -ruler.rule-path
10031009
[rule_path: <string> | default = "/rules"]

docs/configuration/single-process-config-blocks-gossip-1.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,15 @@ tsdb:
8080
dir: /tmp/cortex/storage
8181

8282
frontend_worker:
83-
match_max_concurrent: true
83+
match_max_concurrent: true
84+
85+
ruler:
86+
enable_api: true
87+
enable_sharding: true
88+
storage:
89+
type: local
90+
local:
91+
directory: /tmp/cortex/rules
92+
ring:
93+
kvstore:
94+
store: memberlist

docs/configuration/single-process-config-blocks-gossip-2.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,15 @@ tsdb:
7979
dir: /tmp/cortex/storage
8080

8181
frontend_worker:
82-
match_max_concurrent: true
82+
match_max_concurrent: true
83+
84+
ruler:
85+
enable_api: true
86+
enable_sharding: true
87+
storage:
88+
type: local
89+
local:
90+
directory: /tmp/cortex/rules
91+
ring:
92+
kvstore:
93+
store: memberlist

docs/configuration/single-process-config-blocks-tls.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,11 @@ frontend_worker:
9898
tls_cert_path: "client.crt"
9999
tls_key_path: "client.key"
100100
tls_ca_path: "root.crt"
101+
102+
ruler:
103+
enable_api: true
104+
enable_sharding: false
105+
storage:
106+
type: local
107+
local:
108+
directory: /tmp/cortex/rules

docs/configuration/single-process-config-blocks.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,12 @@ compactor:
8484
store: inmemory
8585

8686
frontend_worker:
87-
match_max_concurrent: true
87+
match_max_concurrent: true
88+
89+
ruler:
90+
enable_api: true
91+
enable_sharding: false
92+
storage:
93+
type: local
94+
local:
95+
directory: /tmp/cortex/rules

docs/configuration/single-process-config.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,14 @@ storage:
7676
# to max_concurrent on the queriers.
7777
frontend_worker:
7878
match_max_concurrent: true
79+
80+
# Configure the ruler to scan the /tmp/cortex/rules directory for prometheus
81+
# rules: https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules
82+
ruler:
83+
enable_api: true
84+
enable_sharding: false
85+
storage:
86+
type: local
87+
local:
88+
directory: /tmp/cortex/rules
7989
```

0 commit comments

Comments
 (0)