Skip to content

Commit 59e05f8

Browse files
committed
Fix formating
1 parent 6395814 commit 59e05f8

3 files changed

Lines changed: 57 additions & 31 deletions

File tree

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
The `tag_cardinality_limit` transform gained an optional sliding-window TTL
2-
for tracked tag values, controlled by two new settings on the global block,
3-
each `per_metric_limits` entry, and the `Inner`/`OverrideInner` config schemas:
4-
5-
- **`ttl_secs`**: expire tracked tag values after this many seconds since they
6-
were last seen. Useful when the downstream system (e.g. Datadog custom
7-
metrics) bills on a rolling unique-series window — without TTL, the
8-
cardinality cache saturates `value_limit` and starts rejecting fresh values
9-
long after the old ones have aged out of the billing window. When unset
10-
(default), behavior is unchanged from previous releases.
11-
- **`ttl_generations`**: tune how the TTL window is sliced for the
12-
`probabilistic` backend. Defaults to `4` (eviction granularity =
13-
`ttl_secs / 4`). Memory cost is `ttl_generations * cache_size_per_key` per
14-
(metric, tag-key) pair; lower `cache_size_per_key` to keep total memory flat.
15-
In `exact` mode this knob only controls the sweep cadence.
16-
17-
A new internal counter `tag_cardinality_ttl_expirations_total` reports how
18-
many distinct values are evicted by TTL.
19-
20-
authors: kaarolch
1+
The `tag_cardinality_limit` transform gained an optional sliding-window TTL
2+
for tracked tag values, controlled by two new settings on the global block,
3+
each `per_metric_limits` entry, and the `Inner`/`OverrideInner` config schemas:
4+
5+
- **`ttl_secs`**: expire tracked tag values after this many seconds since they
6+
were last seen. Useful when the downstream system (e.g. Datadog custom
7+
metrics) bills on a rolling unique-series window — without TTL, the
8+
cardinality cache saturates `value_limit` and starts rejecting fresh values
9+
long after the old ones have aged out of the billing window. When unset
10+
(default), behavior is unchanged from previous releases.
11+
- **`ttl_generations`**: tune how the TTL window is sliced for the
12+
`probabilistic` backend. Defaults to `4` (eviction granularity =
13+
`ttl_secs / 4`). Memory cost is `ttl_generations * cache_size_per_key` per
14+
(metric, tag-key) pair; lower `cache_size_per_key` to keep total memory flat.
15+
In `exact` mode this knob only controls the sweep cadence.
16+
17+
A new internal counter `tag_cardinality_ttl_expirations_total` reports how
18+
many distinct values are evicted by TTL.
19+
20+
authors: kaarolch

src/transforms/tag_cardinality_limit/tag_value_set.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ use std::{
2222
use bloomy::BloomFilter;
2323

2424
use crate::{
25-
event::metric::TagValueSet,
26-
internal_events::TagCardinalityTtlExpired,
25+
event::metric::TagValueSet, internal_events::TagCardinalityTtlExpired,
2726
transforms::tag_cardinality_limit::config::Mode,
2827
};
2928

src/transforms/tag_cardinality_limit/tests.rs

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,13 +1511,28 @@ fn contains_no_refresh_finds_inserted_values_on_all_backends() {
15111511
});
15121512

15131513
for (label, mut set) in [
1514-
("exact no-ttl", AcceptedTagValueSet::new(4, &Mode::Exact, None, 4)),
1515-
("bloom no-ttl", AcceptedTagValueSet::new(4, &bloom_mode, None, 4)),
1516-
("exact ttl", AcceptedTagValueSet::new(4, &Mode::Exact, Some(60), 4)),
1517-
("bloom ttl", AcceptedTagValueSet::new(4, &bloom_mode, Some(60), 4)),
1514+
(
1515+
"exact no-ttl",
1516+
AcceptedTagValueSet::new(4, &Mode::Exact, None, 4),
1517+
),
1518+
(
1519+
"bloom no-ttl",
1520+
AcceptedTagValueSet::new(4, &bloom_mode, None, 4),
1521+
),
1522+
(
1523+
"exact ttl",
1524+
AcceptedTagValueSet::new(4, &Mode::Exact, Some(60), 4),
1525+
),
1526+
(
1527+
"bloom ttl",
1528+
AcceptedTagValueSet::new(4, &bloom_mode, Some(60), 4),
1529+
),
15181530
] {
15191531
set.insert(v1.clone());
1520-
assert!(set.contains_no_refresh(&v1), "{label}: should find inserted value");
1532+
assert!(
1533+
set.contains_no_refresh(&v1),
1534+
"{label}: should find inserted value"
1535+
);
15211536
}
15221537
}
15231538

@@ -1534,10 +1549,22 @@ fn ttl_zero_disables_ttl() {
15341549
cache_size_per_key: default_cache_size(),
15351550
});
15361551
for (label, set) in [
1537-
("exact ttl=0", AcceptedTagValueSet::new(4, &Mode::Exact, Some(0), 4)),
1538-
("bloom ttl=0", AcceptedTagValueSet::new(4, &bloom_mode, Some(0), 4)),
1539-
("exact ttl=None", AcceptedTagValueSet::new(4, &Mode::Exact, None, 4)),
1540-
("bloom ttl=None", AcceptedTagValueSet::new(4, &bloom_mode, None, 4)),
1552+
(
1553+
"exact ttl=0",
1554+
AcceptedTagValueSet::new(4, &Mode::Exact, Some(0), 4),
1555+
),
1556+
(
1557+
"bloom ttl=0",
1558+
AcceptedTagValueSet::new(4, &bloom_mode, Some(0), 4),
1559+
),
1560+
(
1561+
"exact ttl=None",
1562+
AcceptedTagValueSet::new(4, &Mode::Exact, None, 4),
1563+
),
1564+
(
1565+
"bloom ttl=None",
1566+
AcceptedTagValueSet::new(4, &bloom_mode, None, 4),
1567+
),
15411568
] {
15421569
assert!(
15431570
!set.ttl_enabled(),

0 commit comments

Comments
 (0)