Skip to content

Commit 6edbb25

Browse files
committed
ref(relay): Remove cardinality limiter
1 parent 46e2b98 commit 6edbb25

File tree

41 files changed

+26
-4706
lines changed

Some content is hidden

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

41 files changed

+26
-4706
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
- Calculate and track accepted bytes per individual trace metric item via `TraceMetricByte` data category. ([#5744](https://github.com/getsentry/relay/pull/5744), [#5767](https://github.com/getsentry/relay/pull/5767))
3232
- Graduate standalone span ingestion feature flag. ([#5786](https://github.com/getsentry/relay/pull/5786))
33+
- Remove cardinality limiter. ([#5809](https://github.com/getsentry/relay/pull/5809))
3334
- Use new processor architecture to process standalone profiles. ([#5741](https://github.com/getsentry/relay/pull/5741))
3435
- TUS: Disallow creation with upload. ([#5734](https://github.com/getsentry/relay/pull/5734))
3536
- Add logic to verify attachment placeholders and correctly store them. ([#5747](https://github.com/getsentry/relay/pull/5747))

Cargo.lock

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4218,7 +4218,6 @@ dependencies = [
42184218
"regex",
42194219
"relay-auth",
42204220
"relay-base-schema",
4221-
"relay-cardinality",
42224221
"relay-common",
42234222
"relay-dynamic-config",
42244223
"relay-event-normalization",
@@ -4233,27 +4232,6 @@ dependencies = [
42334232
"uuid",
42344233
]
42354234

4236-
[[package]]
4237-
name = "relay-cardinality"
4238-
version = "26.3.1"
4239-
dependencies = [
4240-
"async-trait",
4241-
"criterion",
4242-
"hash32",
4243-
"hashbrown 0.15.4",
4244-
"parking_lot",
4245-
"relay-base-schema",
4246-
"relay-common",
4247-
"relay-log",
4248-
"relay-redis",
4249-
"relay-statsd",
4250-
"serde",
4251-
"serde_json",
4252-
"thiserror 2.0.17",
4253-
"tokio",
4254-
"uuid",
4255-
]
4256-
42574235
[[package]]
42584236
name = "relay-cogs"
42594237
version = "26.3.1"
@@ -4329,7 +4307,6 @@ dependencies = [
43294307
"anyhow",
43304308
"relay-auth",
43314309
"relay-base-schema",
4332-
"relay-cardinality",
43334310
"relay-common",
43344311
"relay-event-normalization",
43354312
"relay-filter",
@@ -4503,7 +4480,6 @@ dependencies = [
45034480
"priority-queue",
45044481
"rand 0.9.2",
45054482
"relay-base-schema",
4506-
"relay-cardinality",
45074483
"relay-cogs",
45084484
"relay-common",
45094485
"relay-log",
@@ -4801,7 +4777,6 @@ dependencies = [
48014777
"regex",
48024778
"relay-auth",
48034779
"relay-base-schema",
4804-
"relay-cardinality",
48054780
"relay-cogs",
48064781
"relay-common",
48074782
"relay-config",

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(sentry)'] }
4141
[workspace.dependencies]
4242
relay-auth = { path = "relay-auth" }
4343
relay-base-schema = { path = "relay-base-schema" }
44-
relay-cardinality = { path = "relay-cardinality" }
4544
relay-cogs = { path = "relay-cogs" }
4645
relay-common = { path = "relay-common" }
4746
relay-config = { path = "relay-config" }

py/sentry_relay/processing.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"validate_sampling_condition",
3232
"validate_sampling_configuration",
3333
"normalize_project_config",
34-
"normalize_cardinality_limit_config",
3534
"normalize_global_config",
3635
]
3736

@@ -327,34 +326,6 @@ def normalize_project_config(
327326
raise ValueError(rv)
328327

329328

330-
def normalize_cardinality_limit_config(
331-
config,
332-
json_dumps: Callable[[Any], Any] = json.dumps,
333-
json_loads: Callable[[str | bytes], Any] = json.loads,
334-
):
335-
"""Normalize the cardinality limit config.
336-
337-
Normalization consists of deserializing and serializing back the given
338-
cardinality limit config. If deserializing fails, throw an exception. Note that even if
339-
the roundtrip doesn't produce errors, the given config may differ from
340-
normalized one.
341-
342-
:param config: the cardinality limit config to validate.
343-
:param json_dumps: a function that stringifies python objects
344-
:param json_loads: a function that parses and converts JSON strings
345-
"""
346-
serialized = json_dumps(config)
347-
normalized = rustcall(
348-
lib.normalize_cardinality_limit_config, encode_str(serialized)
349-
)
350-
rv = decode_str(normalized, free=True)
351-
try:
352-
return json_loads(rv)
353-
except Exception:
354-
# Catch all errors since json.loads implementation can change.
355-
raise ValueError(rv)
356-
357-
358329
def normalize_global_config(
359330
config,
360331
json_dumps: Callable[[Any], Any] = json.dumps,

py/tests/test_processing.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -329,53 +329,6 @@ def test_normalize_project_config():
329329
assert config != normalized
330330

331331

332-
def test_cardinality_limit_config_equal_normalization():
333-
config = {
334-
"id": "project-override-custom",
335-
"window": {"windowSeconds": 3600, "granularitySeconds": 600},
336-
"limit": 1000,
337-
"namespace": "custom",
338-
"scope": "name",
339-
"passive": True,
340-
"report": True,
341-
}
342-
sentry_relay.normalize_cardinality_limit_config(config)
343-
assert config == sentry_relay.normalize_cardinality_limit_config(config)
344-
345-
346-
def test_cardinality_limit_config_subset_normalized():
347-
config = {
348-
"id": "project-override-custom",
349-
"window": {"windowSeconds": 3600, "granularitySeconds": 600},
350-
"limit": 1000,
351-
"namespace": "custom",
352-
"scope": "name",
353-
"passive": False,
354-
"report": False,
355-
"unknown": "value",
356-
}
357-
normalized = sentry_relay.normalize_cardinality_limit_config(config)
358-
config.pop("passive")
359-
config.pop("report")
360-
config.pop("unknown")
361-
assert config == normalized
362-
363-
364-
def test_cardinality_limit_config_unparsable():
365-
config = {
366-
"id": "project-override-custom",
367-
"window": {"windowSeconds": 3600, "granularitySeconds": 600},
368-
"limit": -1,
369-
"namespace": "custom",
370-
"scope": "name",
371-
}
372-
with pytest.raises(ValueError) as e:
373-
sentry_relay.normalize_cardinality_limit_config(config)
374-
assert (
375-
str(e.value) == "invalid value: integer `-1`, expected u32 at line 1 column 107"
376-
)
377-
378-
379332
def test_global_config_equal_normalization():
380333
config = {"measurements": {"maxCustomMeasurements": 0}}
381334
assert config == sentry_relay.normalize_global_config(config)

relay-cabi/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ lru = { workspace = true }
2424
regex = { workspace = true }
2525
relay-auth = { workspace = true }
2626
relay-base-schema = { workspace = true }
27-
relay-cardinality = { workspace = true }
2827
relay-common = { workspace = true }
2928
relay-dynamic-config = { workspace = true }
3029
relay-event-normalization = { workspace = true }

relay-cabi/src/processing.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::slice;
1010
use std::sync::OnceLock;
1111

1212
use chrono::{DateTime, Utc};
13-
use relay_cardinality::CardinalityLimit;
1413
use relay_dynamic_config::{GlobalConfig, ProjectConfig};
1514
use relay_event_normalization::{
1615
BreakdownsConfig, ClientHints, EventValidationConfig, GeoIpLookup, NormalizationConfig,
@@ -456,17 +455,6 @@ pub unsafe extern "C" fn relay_normalize_project_config(value: *const RelayStr)
456455
}
457456
}
458457

459-
/// Normalize a cardinality limit config.
460-
#[unsafe(no_mangle)]
461-
#[relay_ffi::catch_unwind]
462-
pub unsafe extern "C" fn normalize_cardinality_limit_config(value: *const RelayStr) -> RelayStr {
463-
let value = unsafe { (*value).as_str() };
464-
match normalize_json::<CardinalityLimit>(value) {
465-
Ok(normalized) => RelayStr::from_string(normalized),
466-
Err(e) => RelayStr::from_string(e.to_string()),
467-
}
468-
}
469-
470458
/// Normalize a global config.
471459
#[unsafe(no_mangle)]
472460
#[relay_ffi::catch_unwind]

relay-cardinality/Cargo.toml

Lines changed: 0 additions & 42 deletions
This file was deleted.

relay-cardinality/benches/redis.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)