Skip to content

Commit d1e5588

Browse files
jszwedkoneuronull
andauthored
chore(docs): Clarify key_field for sample and throttle transforms (#17372)
* chore(docs): Clarify `key_field` for `sample` and `throttle` transforms The current wording is somewhat confusing. I'm hopeful that this new wording is more clear. Signed-off-by: Jesse Szwedko <[email protected]> * Apply suggestions from code review Co-authored-by: neuronull <[email protected]> --------- Signed-off-by: Jesse Szwedko <[email protected]> Co-authored-by: neuronull <[email protected]>
1 parent 7350e1a commit d1e5588

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

src/transforms/sample.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ pub struct SampleConfig {
2727
/// dropped.
2828
pub rate: u64,
2929

30-
/// The name of the log field whose value is hashed to determine if the event should be
31-
/// passed.
30+
/// The name of the field whose value is hashed to determine if the event should be
31+
/// sampled.
3232
///
33-
/// Consistently samples the same events. Actual rate of sampling may differ from the configured
34-
/// one if values in the field are not uniformly distributed. If left unspecified, or if the
35-
/// event doesn't have `key_field`, then events are count rated.
33+
/// Each unique value for the key creates a bucket of related events to be sampled together
34+
/// and the rate is applied to the buckets themselves to sample `1/N` buckets. The overall rate
35+
/// of sampling may differ from the configured one if values in the field are not uniformly
36+
/// distributed. If left unspecified, or if the event doesn’t have `key_field`, then the
37+
/// event is sampled independently.
38+
///
39+
/// This can be useful to, for example, ensure that all logs for a given transaction are
40+
/// sampled together, but that overall `1/N` transactions are sampled.
3641
#[configurable(metadata(docs::examples = "message",))]
3742
pub key_field: Option<String>,
3843

src/transforms/throttle.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ pub struct ThrottleConfig {
3333
#[serde_as(as = "serde_with::DurationSeconds<f64>")]
3434
window_secs: Duration,
3535

36-
/// The name of the log field whose value is hashed to determine if the event should be
37-
/// rate limited.
36+
/// The value to group events into separate buckets to be rate limited independently.
3837
///
39-
/// Each unique key creates a bucket of related events to be rate limited separately. If
40-
/// left unspecified, or if the event doesn't have `key_field`, then the event is not rate
38+
/// If left unspecified, or if the event doesn't have `key_field`, then the event is not rate
4139
/// limited separately.
4240
#[configurable(metadata(docs::examples = "{{ message }}", docs::examples = "{{ hostname }}",))]
4341
key_field: Option<Template>,

website/cue/reference/components/transforms/base/sample.cue

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ base: components: transforms: sample: configuration: {
88
}
99
key_field: {
1010
description: """
11-
The name of the log field whose value is hashed to determine if the event should be
12-
passed.
11+
The name of the field whose value is hashed to determine if the event should be
12+
sampled.
1313
14-
Consistently samples the same events. Actual rate of sampling may differ from the configured
15-
one if values in the field are not uniformly distributed. If left unspecified, or if the
16-
event doesn't have `key_field`, then events are count rated.
14+
Each unique value for the key creates a bucket of related events to be sampled together
15+
and the rate is applied to the buckets themselves to sample `1/N` buckets. Overall rate
16+
of sampling may differ from the configured one if values in the field are not uniformly
17+
distributed. If left unspecified, or if the event doesn’t have `key_field`, then the
18+
event is sampled independently.
19+
20+
This can be useful to, for example, ensure that all logs for a given transaction are
21+
sampled together, but that overall `1/N` transactions are sampled.
1722
"""
1823
required: false
1924
type: string: examples: ["message"]

website/cue/reference/components/transforms/base/throttle.cue

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ base: components: transforms: throttle: configuration: {
88
}
99
key_field: {
1010
description: """
11-
The name of the log field whose value is hashed to determine if the event should be
12-
rate limited.
11+
The value to group events into a separate buckets to be rate limited independently.
1312
14-
Each unique key creates a bucket of related events to be rate limited separately. If
15-
left unspecified, or if the event doesn't have `key_field`, then the event is not rate
13+
If left unspecified, or if the event doesn't have `key_field`, then the event is not rate
1614
limited separately.
1715
"""
1816
required: false

0 commit comments

Comments
 (0)