You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ADOPTERS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
This is the list of organisations that are using Cortex in **production environments** to power their metrics and monitoring systems. Please send PRs to add or remove organisations.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,15 @@
1
+
# Changelog
2
+
1
3
## master / unreleased
2
4
5
+
*[CHANGE] The frontend component has been refactored to be easier to re-use. When upgrading the frontend, cache entries will be discarded and re-created with the new protobuf schema. #1734
6
+
*[CHANGE] Remove direct DB/API access from the ruler
3
7
*[CHANGE] Removed `Delta` encoding. Any old chunks with `Delta` encoding cannot be read anymore. If `ingester.chunk-encoding` is set to `Delta` the ingester will fail to start. #1706
8
+
*[FEATURE] Global limit on the max series per user and metric #1760
9
+
*`-ingester.max-global-series-per-user`
10
+
*`-ingester.max-global-series-per-metric`
11
+
*[FEATURE] Flush chunks with stale markers early with `ingester.max-stale-chunk-idle`. #1759
12
+
*[FEATURE] EXPERIMENTAL: Added new KV Store backend based on memberlist library. Components can gossip about tokens and ingester states, instead of using Consul or Etcd. #1721
4
13
*[ENHANCEMENT] Allocation improvements in adding samples to Chunk. #1706
5
14
*[ENHANCEMENT] Consul client now follows recommended practices for blocking queries wrt returned Index value. #1708
6
15
*[ENHANCEMENT] Consul client can optionally rate-limit itself during Watch (used e.g. by ring watchers) and WatchPrefix (used by HA feature) operations. Rate limiting is disabled by default. New flags added: `--consul.watch-rate-limit`, and `--consul.watch-burst-size`. #1708
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,15 @@ Welcome! We're excited that you're interested in contributing. Below are some ba
6
6
7
7
Cortex follows a standard GitHub pull request workflow. If you're unfamiliar with this workflow, read the very helpful [Understanding the GitHub flow](https://guides.github.com/introduction/flow/) guide from GitHub.
8
8
9
+
You are welcome to create draft PRs at any stage of readiness - this
10
+
can be helpful to ask for assistance or to develop an idea. But before
11
+
a piece of work is finished it should:
12
+
13
+
* Be organised into one or more commits, each of which has a commit message that describes all changes made in that commit ('why' more than 'what' - we can read the diffs to see the code that changed).
14
+
* Each commit should build towards the whole - don't leave in back-tracks and mistakes that you later corrected.
15
+
* Have tests for new functionality or tests that would have caught the bug being fixed.
16
+
* Include a CHANGELOG message if users of Cortex need to hear about what you did.
17
+
9
18
## Developer Certificates of Origin (DCOs)
10
19
11
20
Before submitting your work in a pull request, make sure that *all* commits are signed off with a **Developer Certificate of Origin** (DCO). Here's an example:
Copy file name to clipboardExpand all lines: docs/architecture.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,4 +145,4 @@ The interface works somewhat differently across the supported databases:
145
145
146
146
A set of schemas are used to map the matchers and label sets used on reads and writes to the chunk store into appropriate operations on the index. Schemas have been added as Cortex has evolved, mainly in an attempt to better load balance writes and improve query performance.
147
147
148
-
> The current schema recommendation is the **v10 schema**.
148
+
> The current schema recommendation is the **v10 schema**. v11 schema is an experimental schema.
Copy file name to clipboardExpand all lines: docs/arguments.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,6 +142,39 @@ prefix these flags with `distributor.ha-tracker.`
142
142
-`etcd.max-retries`
143
143
The maximum number of retries to do for failed ops.
144
144
145
+
#### memberlist (EXPERIMENTAL)
146
+
147
+
Flags for configuring KV store based on memberlist library. This feature is experimental, please don't use it yet.
148
+
149
+
-`memberlist.nodename`
150
+
Name of the node in memberlist cluster. Defaults to hostname.
151
+
-`memberlist.retransmit-factor`
152
+
Multiplication factor used when sending out messages (factor * log(N+1)). If not set, default value is used.
153
+
-`memberlist.join`
154
+
Other cluster members to join. Can be specified multiple times.
155
+
-`memberlist.abort-if-join-fails`
156
+
If this node fails to join memberlist cluster, abort.
157
+
-`memberlist.left-ingesters-timeout`
158
+
How long to keep LEFT ingesters in the ring. Note: this is only used for gossiping, LEFT ingesters are otherwise invisible.
159
+
-`memberlist.leave-timeout`
160
+
Timeout for leaving memberlist cluster.
161
+
-`memberlist.gossip-interval`
162
+
How often to gossip with other cluster members. Uses memberlist LAN defaults if 0.
163
+
-`memberlist.gossip-nodes`
164
+
How many nodes to gossip with in each gossip interval. Uses memberlist LAN defaults if 0.
165
+
-`memberlist.pullpush-interval`
166
+
How often to use pull/push sync. Uses memberlist LAN defaults if 0.
167
+
-`memberlist.bind-addr`
168
+
IP address to listen on for gossip messages. Multiple addresses may be specified. Defaults to 0.0.0.0.
169
+
-`memberlist.bind-port`
170
+
Port to listen on for gossip messages. Defaults to 7946.
171
+
-`memberlist.packet-dial-timeout`
172
+
Timeout used when connecting to other nodes to send packet.
173
+
-`memberlist.packet-write-timeout`
174
+
Timeout for writing 'packet' data.
175
+
-`memberlist.transport-debug`
176
+
Log debug transport messages. Note: global log.level must be at debug level as well.
177
+
145
178
### HA Tracker
146
179
147
180
HA tracking has two of it's own flags:
@@ -175,6 +208,14 @@ It also talks to a KVStore and has it's own copies of the same flags used by the
175
208
176
209
The maximum duration of a timeseries chunk in memory. If a timeseries runs for longer than this the current chunk will be flushed to the store and a new chunk created. (default 12h)
177
210
211
+
- `-ingester.max-chunk-idle`
212
+
213
+
If a series doesn't receive a sample for this duration, it is flushed and removed from memory.
214
+
215
+
- `-ingester.max-stale-chunk-idle`
216
+
217
+
If a series receives a [staleness marker](https://www.robustperception.io/staleness-and-promql), then we wait for this duration to get another sample before we close and flush this series, removing it from memory. You want it to be at least 2x the scrape interval as you don't want a single failed scrape to cause a chunk flush.
218
+
178
219
- `-ingester.chunk-age-jitter`
179
220
180
221
To reduce load on the database exactly 12 hours after starting, the age limit is reduced by a varying amount up to this. (default 20m)
You can have more than a single Prometheus monitoring and ingesting the same metrics for redundancy. Cortex already does replication for redundancy and it doesn't make sense to ingest the same data twice. So in Cortex, we made sure we can dedupe the data we receive from HA Pairs of Prometheus. We do this via the following:
6
+
7
+
Assume that there are two teams, each running their own Prometheus, monitoring different services. Let's call the Prometheis T1 and T2. Now, if the teams are running HA pairs, let's call the individual Prometheis, T1.a, T1.b and T2.a and T2.b.
8
+
9
+
In Cortex we make sure we only ingest from one of T1.a and T1.b, and only from one of T2.a and T2.b. We do this by electing a leader replica for each cluster of Prometheus. For example, in the case of T1, let it be T1.a. As long as T1.a is the leader, we drop the samples sent by T1.b. And if Cortex sees no new samples from T1.a for a short period (30s by default), it'll switch the leader to be T1.b.
10
+
11
+
This means if T1.a goes down for a few minutes Cortex's HA sample handling will have switched and elected T1.b as the leader. This failover timeout is what enables us to only accept samples from a single replica at a time, but ensure we don't drop too much data in case of issues. Note that with the default scrape period of 15s, and the default timeouts in Cortex, in most cases you'll only lose a single scrape of data in the case of a leader election failover. For any rate queries the rate window should be at least 4x the scrape period to account for any of these failover scenarios, for example with the default scrape period of 15s then you should calculate rates over at least 1m periods.
12
+
13
+
Now we do the same leader election process T2.
14
+
15
+
## Config
16
+
17
+
### Client Side
18
+
19
+
So for Cortex to achieve this, we need 2 identifiers for each process, one identifier for the cluster (T1 or T2, etc) and one identifier to identify the replica in the cluster (a or b). The easiest way to do with is by setting external labels, ideally `cluster` and `replica` (note the default is `__replica__`). For example:
20
+
21
+
```
22
+
cluster: prom-team1
23
+
replica: replica1 (or pod-name)
24
+
```
25
+
26
+
and
27
+
28
+
```
29
+
cluster: prom-team1
30
+
replica: replica2
31
+
```
32
+
33
+
Note: These are external labels and have nothing to do with remote_write config.
34
+
35
+
These two label names are configurable per-tenant within Cortex, and should be set to something sensible. For example, cluster label is already used by some workloads, and you should set the label to be something else but uniquely identifies the cluster. Good examples for this label-name would be `team`, `cluster`, `prometheus`, etc.
36
+
37
+
The replica label should be set so that the value for each prometheus is unique in that cluster. Note: Cortex drops this label when ingesting data, but preserves the cluster label. This way, your timeseries won't change when replicas change.
38
+
39
+
### Server Side
40
+
41
+
To enable handling of samples, see the [distibutor flags](./arguments.md#ha-tracker) having `ha-tracker` in them.
0 commit comments