Skip to content

Commit 2125fe8

Browse files
authored
[chore][samplereceiver] Update internal telemetry metric units (#10672)
#### Description Update telemetry units to be more clear. Related to #10658, we may be blocked here waiting for official units to use. Note: I've kept [one metric](https://github.com/open-telemetry/opentelemetry-collector/blob/7d5b1ba387e4e171e25bfeea9b70d6fdfbe08fab/cmd/mdatagen/internal/samplereceiver/metadata.yaml#L110) with the unit "1", as it's not meant to be meaningful, just to show a metric that's disabled by default. Since this code is internal and only used for tests, from what I can tell, I don't believe we need a changelog entry. #### Link to tracking issue Fixes #10653
1 parent 458c4f9 commit 2125fe8

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

cmd/mdatagen/internal/samplereceiver/documentation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Number of times the batch was sent due to a size trigger
123123
124124
| Unit | Metric Type | Value Type | Monotonic |
125125
| ---- | ----------- | ---------- | --------- |
126-
| 1 | Sum | Int | true |
126+
| {times} | Sum | Int | true |
127127
128128
### otelcol_process_runtime_total_alloc_bytes
129129
@@ -141,7 +141,7 @@ For example this metric only exists if feature A is enabled.
141141
142142
| Unit | Metric Type | Value Type |
143143
| ---- | ----------- | ---------- |
144-
| 1 | Gauge | Int |
144+
| {items} | Gauge | Int |
145145
146146
### otelcol_request_duration
147147

cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/metadata.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ telemetry:
155155
batch_size_trigger_send:
156156
enabled: true
157157
description: Number of times the batch was sent due to a size trigger
158-
unit: "1"
158+
unit: "{times}"
159159
sum:
160160
value_type: int
161161
monotonic: true
@@ -178,7 +178,7 @@ telemetry:
178178
enabled: true
179179
description: This metric is optional and therefore not initialized in NewTelemetryBuilder.
180180
extended_documentation: For example this metric only exists if feature A is enabled.
181-
unit: "1"
181+
unit: "{items}"
182182
optional: true
183183
gauge:
184184
async: true

cmd/mdatagen/internal/samplereceiver/metrics_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestComponentTelemetry(t *testing.T) {
3232
{
3333
Name: "otelcol_batch_size_trigger_send",
3434
Description: "Number of times the batch was sent due to a size trigger",
35-
Unit: "1",
35+
Unit: "{times}",
3636
Data: metricdata.Sum[int64]{
3737
Temporality: metricdata.CumulativeTemporality,
3838
IsMonotonic: true,
@@ -65,7 +65,7 @@ func TestComponentTelemetry(t *testing.T) {
6565
{
6666
Name: "otelcol_batch_size_trigger_send",
6767
Description: "Number of times the batch was sent due to a size trigger",
68-
Unit: "1",
68+
Unit: "{times}",
6969
Data: metricdata.Sum[int64]{
7070
Temporality: metricdata.CumulativeTemporality,
7171
IsMonotonic: true,
@@ -93,7 +93,7 @@ func TestComponentTelemetry(t *testing.T) {
9393
{
9494
Name: "otelcol_queue_length",
9595
Description: "This metric is optional and therefore not initialized in NewTelemetryBuilder.",
96-
Unit: "1",
96+
Unit: "{items}",
9797
Data: metricdata.Gauge[int64]{
9898
DataPoints: []metricdata.DataPoint[int64]{
9999
{

cmd/mdatagen/loader_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func TestLoadMetadata(t *testing.T) {
236236
"batch_size_trigger_send": {
237237
Enabled: true,
238238
Description: "Number of times the batch was sent due to a size trigger",
239-
Unit: strPtr("1"),
239+
Unit: strPtr("{times}"),
240240
Sum: &sum{
241241
MetricValueType: MetricValueType{pmetric.NumberDataPointValueTypeInt},
242242
Mono: Mono{Monotonic: true},
@@ -267,7 +267,7 @@ func TestLoadMetadata(t *testing.T) {
267267
Enabled: true,
268268
Description: "This metric is optional and therefore not initialized in NewTelemetryBuilder.",
269269
ExtendedDocumentation: "For example this metric only exists if feature A is enabled.",
270-
Unit: strPtr("1"),
270+
Unit: strPtr("{items}"),
271271
Optional: true,
272272
Gauge: &gauge{
273273
MetricValueType: MetricValueType{

0 commit comments

Comments
 (0)