Skip to content

Commit a0eac20

Browse files
authored
[receiver/chrony] Enable re-aggregation feature (#47533)
#### Description Enables dynamic metric reaggregation in the Chrony receiver. Collector configuration files can now define a set of attributes per metric to aggregate data by. This can be done for any metric attribute at a [requirement level](open-telemetry/opentelemetry-collector#13913) of `recommended` or below. For more information about how reaggregation works, see open-telemetry/opentelemetry-collector#14281. Changes: - Set `reaggregation_enabled: true` in `metadata.yaml` - Set `leap.status` attribute to `requirement_level: recommended` - Ran `go generate ./...` to regenerate all derived files #### Link to tracking issue Fixes #46350 Part of #45396 #### Testing - `go test -race ./...` in `receiver/chronyreceiver/` — all 27 tests pass (including `reaggregate_set`) - `go vet ./...` — clean - `make chlog-validate` — valid #### Documentation No documentation changes needed. The generated `documentation.md` is updated automatically by `go generate`.
1 parent 8e1a225 commit a0eac20

9 files changed

Lines changed: 949 additions & 164 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'enhancement'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: receiver/chrony
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Enables dynamic metric reaggregation in the Chrony receiver. This does not break existing configuration files.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [46350]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user, api]

receiver/chronyreceiver/factory_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ func TestCreatingMetricsReceiver(t *testing.T) {
3535

3636
factory := NewFactory()
3737
mbc := metadata.DefaultMetricsBuilderConfig()
38-
mbc.Metrics = metadata.MetricsConfig{
39-
NtpTimeCorrection: metadata.MetricConfig{
40-
Enabled: true,
41-
},
42-
NtpSkew: metadata.MetricConfig{
43-
Enabled: true,
44-
},
45-
}
38+
mbc.Metrics.NtpFrequencyOffset.Enabled = false
39+
mbc.Metrics.NtpSkew.Enabled = true
40+
mbc.Metrics.NtpStratum.Enabled = false
41+
mbc.Metrics.NtpTimeCorrection.Enabled = true
42+
mbc.Metrics.NtpTimeLastOffset.Enabled = false
43+
mbc.Metrics.NtpTimeRmsOffset.Enabled = false
44+
mbc.Metrics.NtpTimeRootDelay.Enabled = false
4645
mem, err := factory.CreateMetrics(
4746
t.Context(),
4847
receivertest.NewNopSettings(metadata.Type),

receiver/chronyreceiver/internal/metadata/config.schema.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ $defs:
1111
enabled:
1212
type: boolean
1313
default: false
14+
aggregation_strategy:
15+
type: string
16+
enum:
17+
- "sum"
18+
- "avg"
19+
- "min"
20+
- "max"
21+
default: "avg"
22+
attributes:
23+
type: array
24+
items:
25+
type: string
26+
enum:
27+
- "leap.status"
28+
default:
29+
- "leap.status"
1430
ntp.skew:
1531
description: "NtpSkewMetricConfig provides config for the ntp.skew metric."
1632
type: object
@@ -32,27 +48,91 @@ $defs:
3248
enabled:
3349
type: boolean
3450
default: true
51+
aggregation_strategy:
52+
type: string
53+
enum:
54+
- "sum"
55+
- "avg"
56+
- "min"
57+
- "max"
58+
default: "avg"
59+
attributes:
60+
type: array
61+
items:
62+
type: string
63+
enum:
64+
- "leap.status"
65+
default:
66+
- "leap.status"
3567
ntp.time.last_offset:
3668
description: "NtpTimeLastOffsetMetricConfig provides config for the ntp.time.last_offset metric."
3769
type: object
3870
properties:
3971
enabled:
4072
type: boolean
4173
default: true
74+
aggregation_strategy:
75+
type: string
76+
enum:
77+
- "sum"
78+
- "avg"
79+
- "min"
80+
- "max"
81+
default: "avg"
82+
attributes:
83+
type: array
84+
items:
85+
type: string
86+
enum:
87+
- "leap.status"
88+
default:
89+
- "leap.status"
4290
ntp.time.rms_offset:
4391
description: "NtpTimeRmsOffsetMetricConfig provides config for the ntp.time.rms_offset metric."
4492
type: object
4593
properties:
4694
enabled:
4795
type: boolean
4896
default: false
97+
aggregation_strategy:
98+
type: string
99+
enum:
100+
- "sum"
101+
- "avg"
102+
- "min"
103+
- "max"
104+
default: "avg"
105+
attributes:
106+
type: array
107+
items:
108+
type: string
109+
enum:
110+
- "leap.status"
111+
default:
112+
- "leap.status"
49113
ntp.time.root_delay:
50114
description: "NtpTimeRootDelayMetricConfig provides config for the ntp.time.root_delay metric."
51115
type: object
52116
properties:
53117
enabled:
54118
type: boolean
55119
default: false
120+
aggregation_strategy:
121+
type: string
122+
enum:
123+
- "sum"
124+
- "avg"
125+
- "min"
126+
- "max"
127+
default: "avg"
128+
attributes:
129+
type: array
130+
items:
131+
type: string
132+
enum:
133+
- "leap.status"
134+
default:
135+
- "leap.status"
56136
metrics_builder_config:
57137
description: MetricsBuilderConfig is a configuration for chrony metrics builder.
58138
type: object

0 commit comments

Comments
 (0)