Skip to content

Commit 073833c

Browse files
authored
feat(relay): add configuration option to allow high cardinality tags in metric calls (#4805)
This PR adds a configuration option to allow high cardinality tags, such as project id, in metrics. High cardinality tags are prefixed with `hc.`. By default, it will always strip those tags. ref INGEST-140
1 parent 83f16fe commit 073833c

File tree

6 files changed

+221
-48
lines changed

6 files changed

+221
-48
lines changed

CHANGELOG.md

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

33
## Unreleased
44

5+
**Features**:
6+
7+
- Add configuration to allow high cardinality tags in metrics. ([#4805](https://github.com/getsentry/relay/pull/4805))
8+
59
**Internal**:
610

711
- Produce spans to the items topic. ([#4735](https://github.com/getsentry/relay/pull/4735))

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ smallvec = { version = "1.13.2", features = ["serde"] }
193193
socket2 = "0.5.8"
194194
sqlparser = "0.44.0"
195195
sqlx = { version = "0.8.2", default-features = false }
196-
statsdproxy = { version = "0.3.0", default-features = false }
196+
statsdproxy = { version = "0.4.1", default-features = false }
197197
symbolic-common = { version = "12.12.3", default-features = false }
198198
symbolic-unreal = { version = "12.12.3", default-features = false }
199199
syn = { version = "2.0.90" }

relay-config/src/config.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,14 @@ pub struct Metrics {
557557
///
558558
/// Defaults to `true`.
559559
pub aggregate: bool,
560+
/// Allows emission of metrics with high cardinality tags.
561+
///
562+
/// High cardinality tags are dynamic values attached to metrics,
563+
/// such as project IDs. When enabled, these tags will be included
564+
/// in the emitted metrics. When disabled, the tags will be omitted.
565+
///
566+
/// Defaults to `false`.
567+
pub allow_high_cardinality_tags: bool,
560568
}
561569

562570
impl Default for Metrics {
@@ -569,6 +577,7 @@ impl Default for Metrics {
569577
sample_rate: 1.0,
570578
periodic_secs: 5,
571579
aggregate: true,
580+
allow_high_cardinality_tags: false,
572581
}
573582
}
574583
}
@@ -2123,6 +2132,11 @@ impl Config {
21232132
self.values.metrics.aggregate
21242133
}
21252134

2135+
/// Returns whether high cardinality tags should be removed before sending metrics.
2136+
pub fn metrics_allow_high_cardinality_tags(&self) -> bool {
2137+
self.values.metrics.allow_high_cardinality_tags
2138+
}
2139+
21262140
/// Returns the interval for periodic metrics emitted from Relay.
21272141
///
21282142
/// `None` if periodic metrics are disabled.

0 commit comments

Comments
 (0)