Skip to content

Commit 81c6c80

Browse files
committed
Merge branch 'main' into feature/helm-add-lifecycle-for-index-gateway
2 parents 4a8b780 + 7eda674 commit 81c6c80

File tree

100 files changed

+6834
-2687
lines changed

Some content is hidden

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

100 files changed

+6834
-2687
lines changed

docs/sources/operations/blocking-queries.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ overrides:
3434
# block any query that matches this query hash
3535
- hash: 2943214005 # hash of {stream="stdout",pod="loki-canary-9w49x"}
3636
types: filter,limited
37+
38+
# block queries originating from specific sources via X-Query-Tags
39+
# Keys and values are matched case-insensitively.
40+
- pattern: '.*' # optional; if pattern and regex are omittied they will default to '.*' and true
41+
regex: true
42+
tags:
43+
source: grafana
44+
feature: beta
3745
```
3846
{{< admonition type="note" >}}
3947
Changes to these configurations **do not require a restart**; they are defined in the [runtime configuration file](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#runtime-configuration-file).
@@ -61,6 +69,48 @@ The order of patterns is preserved, so the first matching pattern will be used.
6169

6270
Blocked queries are logged, as well as counted in the `loki_blocked_queries` metric on a per-tenant basis.
6371

72+
When a policy matches by pattern/hash/regex, Loki logs whether the query type and request tags matched that policy:
73+
74+
```logfmt
75+
level=warn msg="query blocker matched with regex policy" user=29 type=metric pattern=".*rate\\(.*\\).*" query="sum(rate({app=\"foo\"}[5m]))" typesMatched=true tagsMatched=false blocked=false
76+
```
77+
78+
If tag constraints fail to match, Loki emits a debug log showing the missing key and the raw header value that was received:
79+
80+
```logfmt
81+
level=debug msg="query blocker tags mismatch: missing or mismatched key" key=feature tagsRaw="Source=grafana,Feature=alpha"
82+
```
83+
6484
## Scope
6585

6686
Queries received via the API and executed as [alerting/recording rules](../../alert/) will be blocked.
87+
88+
## Tag-based blocking
89+
90+
You can scope a blocked query rule to requests that include specific key=value pairs in the `X-Query-Tags` header.
91+
92+
- Header format: `key=value` pairs separated by commas, for example: `Source=grafana,Feature=beta`.
93+
- Allowed characters are alphanumeric plus space, comma, equals, '@', '.', and '-'. Any other characters are replaced with `_`.
94+
- Parsing keeps only canonical `key=value` tokens; malformed tokens are ignored.
95+
- Matching rules:
96+
- Keys are matched case-insensitively (the server lowercases keys).
97+
- Values are matched case-insensitively.
98+
- All specified `tags:` pairs in the rule must be present in the request to apply the block.
99+
100+
Examples:
101+
102+
```yaml
103+
overrides:
104+
tenant-a:
105+
blocked_queries:
106+
# Block only metric queries from a beta feature flag
107+
- types: metric
108+
tags:
109+
feature: beta
110+
111+
# Combine with regex to narrow scope further
112+
- pattern: '.*rate\\(.*\\).*'
113+
regex: true
114+
tags:
115+
source: grafana
116+
```

docs/sources/setup/install/helm/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3913,7 +3913,7 @@ null
39133913
"pullPolicy": "IfNotPresent",
39143914
"registry": "docker.io",
39153915
"repository": "grafana/enterprise-logs",
3916-
"tag": "3.5.5"
3916+
"tag": "3.5.7"
39173917
},
39183918
"license": {
39193919
"contents": "NOTAVALIDLICENSE"
@@ -4060,7 +4060,7 @@ null
40604060
<td>string</td>
40614061
<td>Docker image tag</td>
40624062
<td><pre lang="json">
4063-
"3.5.5"
4063+
"3.5.7"
40644064
</pre>
40654065
</td>
40664066
</tr>

docs/sources/shared/configuration.md

Lines changed: 223 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,205 @@ dataobj:
10731073
# CLI flag: -dataobj-consumer.section-stripe-merge-limit
10741074
[section_stripe_merge_limit: <int> | default = 2]
10751075

1076+
lifecycler:
1077+
ring:
1078+
kvstore:
1079+
# Backend storage to use for the ring. Supported values are: consul,
1080+
# etcd, inmemory, memberlist, multi.
1081+
# CLI flag: -dataobj-consumer.store
1082+
[store: <string> | default = "consul"]
1083+
1084+
# The prefix for the keys in the store. Should end with a /.
1085+
# CLI flag: -dataobj-consumer.prefix
1086+
[prefix: <string> | default = "collectors/"]
1087+
1088+
# Configuration for a Consul client. Only applies if the selected
1089+
# kvstore is consul.
1090+
# The CLI flags prefix for this block configuration is:
1091+
# dataobj-consumer
1092+
[consul: <consul>]
1093+
1094+
# Configuration for an ETCD v3 client. Only applies if the selected
1095+
# kvstore is etcd.
1096+
# The CLI flags prefix for this block configuration is:
1097+
# dataobj-consumer
1098+
[etcd: <etcd>]
1099+
1100+
multi:
1101+
# Primary backend storage used by multi-client.
1102+
# CLI flag: -dataobj-consumer.multi.primary
1103+
[primary: <string> | default = ""]
1104+
1105+
# Secondary backend storage used by multi-client.
1106+
# CLI flag: -dataobj-consumer.multi.secondary
1107+
[secondary: <string> | default = ""]
1108+
1109+
# Mirror writes to secondary store.
1110+
# CLI flag: -dataobj-consumer.multi.mirror-enabled
1111+
[mirror_enabled: <boolean> | default = false]
1112+
1113+
# Timeout for storing value to secondary store.
1114+
# CLI flag: -dataobj-consumer.multi.mirror-timeout
1115+
[mirror_timeout: <duration> | default = 2s]
1116+
1117+
# The heartbeat timeout after which ingesters are skipped for
1118+
# reads/writes. 0 = never (timeout disabled).
1119+
# CLI flag: -dataobj-consumer.ring.heartbeat-timeout
1120+
[heartbeat_timeout: <duration> | default = 1m]
1121+
1122+
# The number of ingesters to write to and read from.
1123+
# CLI flag: -dataobj-consumer.distributor.replication-factor
1124+
[replication_factor: <int> | default = 3]
1125+
1126+
# True to enable the zone-awareness and replicate ingested samples
1127+
# across different availability zones.
1128+
# CLI flag: -dataobj-consumer.distributor.zone-awareness-enabled
1129+
[zone_awareness_enabled: <boolean> | default = false]
1130+
1131+
# Comma-separated list of zones to exclude from the ring. Instances in
1132+
# excluded zones will be filtered out from the ring.
1133+
# CLI flag: -dataobj-consumer.distributor.excluded-zones
1134+
[excluded_zones: <string> | default = ""]
1135+
1136+
# Number of tokens for each ingester.
1137+
# CLI flag: -dataobj-consumer.num-tokens
1138+
[num_tokens: <int> | default = 128]
1139+
1140+
# Period at which to heartbeat to consul. 0 = disabled.
1141+
# CLI flag: -dataobj-consumer.heartbeat-period
1142+
[heartbeat_period: <duration> | default = 5s]
1143+
1144+
# Heartbeat timeout after which instance is assumed to be unhealthy. 0 =
1145+
# disabled.
1146+
# CLI flag: -dataobj-consumer.heartbeat-timeout
1147+
[heartbeat_timeout: <duration> | default = 1m]
1148+
1149+
# Observe tokens after generating to resolve collisions. Useful when using
1150+
# gossiping ring.
1151+
# CLI flag: -dataobj-consumer.observe-period
1152+
[observe_period: <duration> | default = 0s]
1153+
1154+
# Period to wait for a claim from another member; will join automatically
1155+
# after this.
1156+
# CLI flag: -dataobj-consumer.join-after
1157+
[join_after: <duration> | default = 0s]
1158+
1159+
# Minimum duration to wait after the internal readiness checks have passed
1160+
# but before succeeding the readiness endpoint. This is used to slowdown
1161+
# deployment controllers (eg. Kubernetes) after an instance is ready and
1162+
# before they proceed with a rolling update, to give the rest of the
1163+
# cluster instances enough time to receive ring updates.
1164+
# CLI flag: -dataobj-consumer.min-ready-duration
1165+
[min_ready_duration: <duration> | default = 15s]
1166+
1167+
# Name of network interface to read address from.
1168+
# CLI flag: -dataobj-consumer.lifecycler.interface
1169+
[interface_names: <list of strings> | default = [<private network interfaces>]]
1170+
1171+
# Enable IPv6 support. Required to make use of IP addresses from IPv6
1172+
# interfaces.
1173+
# CLI flag: -dataobj-consumer.enable-inet6
1174+
[enable_inet6: <boolean> | default = false]
1175+
1176+
# Duration to sleep for before exiting, to ensure metrics are scraped.
1177+
# CLI flag: -dataobj-consumer.final-sleep
1178+
[final_sleep: <duration> | default = 0s]
1179+
1180+
# File path where tokens are stored. If empty, tokens are not stored at
1181+
# shutdown and restored at startup.
1182+
# CLI flag: -dataobj-consumer.tokens-file-path
1183+
[tokens_file_path: <string> | default = ""]
1184+
1185+
# The availability zone where this instance is running.
1186+
# CLI flag: -dataobj-consumer.availability-zone
1187+
[availability_zone: <string> | default = ""]
1188+
1189+
# Unregister from the ring upon clean shutdown. It can be useful to
1190+
# disable for rolling restarts with consistent naming in conjunction with
1191+
# -distributor.extend-writes=false.
1192+
# CLI flag: -dataobj-consumer.unregister-on-shutdown
1193+
[unregister_on_shutdown: <boolean> | default = true]
1194+
1195+
# When enabled the readiness probe succeeds only after all instances are
1196+
# ACTIVE and healthy in the ring, otherwise only the instance itself is
1197+
# checked. This option should be disabled if in your cluster multiple
1198+
# instances can be rolled out simultaneously, otherwise rolling updates
1199+
# may be slowed down.
1200+
# CLI flag: -dataobj-consumer.readiness-check-ring-health
1201+
[readiness_check_ring_health: <boolean> | default = true]
1202+
1203+
# IP address to advertise in the ring.
1204+
# CLI flag: -dataobj-consumer.lifecycler.addr
1205+
[address: <string> | default = ""]
1206+
1207+
# port to advertise in consul (defaults to server.grpc-listen-port).
1208+
# CLI flag: -dataobj-consumer.lifecycler.port
1209+
[port: <int> | default = 0]
1210+
1211+
# ID to register in the ring.
1212+
# CLI flag: -dataobj-consumer.lifecycler.ID
1213+
[id: <string> | default = "<hostname>"]
1214+
1215+
partition_ring:
1216+
# The key-value store used to share the hash ring across multiple
1217+
# instances. This option needs be set on ingesters, distributors,
1218+
# queriers, and rulers when running in microservices mode.
1219+
kvstore:
1220+
# Backend storage to use for the ring. Supported values are: consul,
1221+
# etcd, inmemory, memberlist, multi.
1222+
# CLI flag: -dataobj-consumer.partition-ring.store
1223+
[store: <string> | default = "memberlist"]
1224+
1225+
# The prefix for the keys in the store. Should end with a /.
1226+
# CLI flag: -dataobj-consumer.partition-ring.prefix
1227+
[prefix: <string> | default = "collectors/"]
1228+
1229+
# Configuration for a Consul client. Only applies if the selected
1230+
# kvstore is consul.
1231+
# The CLI flags prefix for this block configuration is:
1232+
# dataobj-consumer.partition-ring
1233+
[consul: <consul>]
1234+
1235+
# Configuration for an ETCD v3 client. Only applies if the selected
1236+
# kvstore is etcd.
1237+
# The CLI flags prefix for this block configuration is:
1238+
# dataobj-consumer.partition-ring
1239+
[etcd: <etcd>]
1240+
1241+
multi:
1242+
# Primary backend storage used by multi-client.
1243+
# CLI flag: -dataobj-consumer.partition-ring.multi.primary
1244+
[primary: <string> | default = ""]
1245+
1246+
# Secondary backend storage used by multi-client.
1247+
# CLI flag: -dataobj-consumer.partition-ring.multi.secondary
1248+
[secondary: <string> | default = ""]
1249+
1250+
# Mirror writes to secondary store.
1251+
# CLI flag: -dataobj-consumer.partition-ring.multi.mirror-enabled
1252+
[mirror_enabled: <boolean> | default = false]
1253+
1254+
# Timeout for storing value to secondary store.
1255+
# CLI flag: -dataobj-consumer.partition-ring.multi.mirror-timeout
1256+
[mirror_timeout: <duration> | default = 2s]
1257+
1258+
# Minimum number of owners to wait before a PENDING partition gets
1259+
# switched to ACTIVE.
1260+
# CLI flag: -dataobj-consumer.partition-ring.min-partition-owners-count
1261+
[min_partition_owners_count: <int> | default = 1]
1262+
1263+
# How long the minimum number of owners are enforced before a PENDING
1264+
# partition gets switched to ACTIVE.
1265+
# CLI flag: -dataobj-consumer.partition-ring.min-partition-owners-duration
1266+
[min_partition_owners_duration: <duration> | default = 10s]
1267+
1268+
# How long to wait before an INACTIVE partition is eligible for deletion.
1269+
# The partition is deleted only if it has been in INACTIVE state for at
1270+
# least the configured duration and it has no owners registered. A value
1271+
# of 0 disables partitions deletion.
1272+
# CLI flag: -dataobj-consumer.partition-ring.delete-inactive-partition-after
1273+
[delete_inactive_partition_after: <duration> | default = 13h]
1274+
10761275
uploader:
10771276
# The size of the SHA prefix to use for generating object storage keys for
10781277
# data objects.
@@ -1084,6 +1283,10 @@ dataobj:
10841283
# CLI flag: -dataobj-consumer.idle-flush-timeout
10851284
[idle_flush_timeout: <duration> | default = 1h]
10861285

1286+
# The name of the Kafka topic
1287+
# CLI flag: -dataobj-consumer.topic
1288+
[topic: <string> | default = ""]
1289+
10871290
index:
10881291
# The size of the target page to use for the index object builder.
10891292
# CLI flag: -dataobj-index-builder.target-page-size
@@ -2652,6 +2855,8 @@ Configuration for a Consul client. Only applies if the selected kvstore is `cons
26522855

26532856
- `common.storage.ring`
26542857
- `compactor.ring`
2858+
- `dataobj-consumer`
2859+
- `dataobj-consumer.partition-ring`
26552860
- `distributor.ring`
26562861
- `index-gateway.ring`
26572862
- `ingest-limits`
@@ -2895,6 +3100,19 @@ otlp_config:
28953100
# not enforced. Defaults to false.
28963101
# CLI flag: -distributor.ingest-limits-dry-run-enabled
28973102
[ingest_limits_dry_run_enabled: <boolean> | default = false]
3103+
3104+
dataobj_tee:
3105+
# Enable data object tee.
3106+
# CLI flag: -distributor.dataobj-tee.enabled
3107+
[enabled: <boolean> | default = false]
3108+
3109+
# Topic for data object tee.
3110+
# CLI flag: -distributor.dataobj-tee.topic
3111+
[topic: <string> | default = ""]
3112+
3113+
# Maximum number of bytes to buffer.
3114+
# CLI flag: -distributor.dataobj-tee.max-buffered-bytes
3115+
[max_buffered_bytes: <int> | default = 104857600]
28983116
```
28993117

29003118
### etcd
@@ -2903,6 +3121,8 @@ Configuration for an ETCD v3 client. Only applies if the selected kvstore is `et
29033121

29043122
- `common.storage.ring`
29053123
- `compactor.ring`
3124+
- `dataobj-consumer`
3125+
- `dataobj-consumer.partition-ring`
29063126
- `distributor.ring`
29073127
- `index-gateway.ring`
29083128
- `ingest-limits`
@@ -3860,7 +4080,7 @@ discover_generic_fields:
38604080
# Field name to use for log levels. If not set, log level would be detected
38614081
# based on pre-defined labels as mentioned above.
38624082
# CLI flag: -validation.log-level-fields
3863-
[log_level_fields: <list of strings> | default = [level LEVEL Level Severity severity SEVERITY lvl LVL Lvl severity_text Severity_Text SEVERITY_TEXT]]
4083+
[log_level_fields: <list of strings> | default = [level LEVEL Level log.level severity SEVERITY Severity SeverityText lvl LVL Lvl severity_text Severity_Text SEVERITY_TEXT]]
38644084

38654085
# Maximum depth to search for log level fields in JSON logs. A value of 0 or
38664086
# less means unlimited depth. Default is 2 which searches the first 2 levels of
@@ -7369,6 +7589,8 @@ The TLS configuration. The supported CLI flags `<prefix>` used to reference this
73697589
- `common.storage.ring.etcd`
73707590
- `compactor.grpc-client`
73717591
- `compactor.ring.etcd`
7592+
- `dataobj-consumer.etcd`
7593+
- `dataobj-consumer.partition-ring.etcd`
73727594
- `distributor.ring.etcd`
73737595
- `etcd`
73747596
- `frontend.grpc-client-config`

0 commit comments

Comments
 (0)