Commit 15b7c86
authored
[receiver/ntpreceiver] fix ntp.host was not being emitted (open-telemetry#43132)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR fixes the `ntp.host` resource attribute was not being emitted
even though it was enabled by default.
I'm also proposing being an additional code owner for this component.
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#43129
<!--Describe what testing was performed and which tests were added.-->
#### Testing
I added new tests for `receiver.go`.
Also tested it locally with the same configuration shared on the issue.
```sh
2025-10-05T00:16:24.452+0100 info [email protected]/service.go:222 Starting otelcontribcol... {"resource": {"service.instance.id": "9202fda2-095d-4055-8412-dc4de4b8308d", "service.name": "otelcontribcol", "service.version": "0.136.0-dev"}, "Version": "0.136.0-dev", "NumCPU": 12}
2025-10-05T00:16:24.452+0100 info extensions/extensions.go:41 Starting extensions... {"resource": {"service.instance.id": "9202fda2-095d-4055-8412-dc4de4b8308d", "service.name": "otelcontribcol", "service.version": "0.136.0-dev"}}
2025-10-05T00:16:24.452+0100 info [email protected]/service.go:245 Everything is ready. Begin running and processing data. {"resource": {"service.instance.id": "9202fda2-095d-4055-8412-dc4de4b8308d", "service.name": "otelcontribcol", "service.version": "0.136.0-dev"}}
2025-10-05T00:16:25.658+0100 info Metrics {"resource": {"service.instance.id": "9202fda2-095d-4055-8412-dc4de4b8308d", "service.name": "otelcontribcol", "service.version": "0.136.0-dev"}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "metrics", "resource metrics": 1, "metrics": 1, "data points": 1}
2025-10-05T00:16:25.659+0100 info ResourceMetrics #0
Resource SchemaURL:
Resource attributes:
-> ntp.host: Str(time.nist.gov:123)
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ntpreceiver 0.136.0-dev
Metric #0
Descriptor:
-> Name: ntp.offset
-> Description: Time difference between local and NTP server clocks
-> Unit: ns
-> DataType: Gauge
NumberDataPoints #0
StartTimestamp: 2025-10-04 23:16:24.452351 +0000 UTC
Timestamp: 2025-10-04 23:16:25.647124 +0000 UTC
Value: 91327175
{"resource": {"service.instance.id": "9202fda2-095d-4055-8412-dc4de4b8308d", "service.name": "otelcontribcol", "service.version": "0.136.0-dev"}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "metrics"}
```
---------
Signed-off-by: Paulo Dias <[email protected]>1 parent 5806cfe commit 15b7c86
File tree
6 files changed
+150
-6
lines changed- .chloggen
- .github
- receiver/ntpreceiver
6 files changed
+150
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
0 commit comments