Skip to content

Commit d43516d

Browse files
committed
Revert "mdatagen: improve deprecated metric validation tests"
This reverts commit ff1cdf8.
1 parent 22e76aa commit d43516d

File tree

22 files changed

+134
-264
lines changed

22 files changed

+134
-264
lines changed

cmd/mdatagen/internal/metric_test.go

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import (
77
"testing"
88

99
"github.com/stretchr/testify/assert"
10-
"github.com/stretchr/testify/require"
1110

12-
"go.opentelemetry.io/collector/component"
13-
"go.opentelemetry.io/collector/confmap"
1411
"go.opentelemetry.io/collector/pdata/pmetric"
1512
)
1613

@@ -41,56 +38,3 @@ func TestMetricData(t *testing.T) {
4138
assert.Equal(t, arg.wantAsync, arg.metricData.IsAsync())
4239
}
4340
}
44-
45-
func TestStability_Unmarshal(t *testing.T) {
46-
tests := []struct {
47-
name string
48-
conf map[string]any
49-
want Stability
50-
wantErr string
51-
}{
52-
{
53-
name: "with level and from",
54-
conf: map[string]any{
55-
"level": "beta",
56-
"from": "1.0.0",
57-
},
58-
want: Stability{
59-
Level: component.StabilityLevelBeta,
60-
From: "1.0.0",
61-
},
62-
},
63-
{
64-
name: "with level only",
65-
conf: map[string]any{
66-
"level": "stable",
67-
},
68-
want: Stability{
69-
Level: component.StabilityLevelStable,
70-
From: "",
71-
},
72-
},
73-
{
74-
name: "missing level",
75-
conf: map[string]any{
76-
"from": "1.0.0",
77-
},
78-
wantErr: "missing required field: `stability.level`",
79-
},
80-
}
81-
for _, tt := range tests {
82-
t.Run(tt.name, func(t *testing.T) {
83-
conf := confmap.NewFromStringMap(tt.conf)
84-
var s Stability
85-
err := s.Unmarshal(conf)
86-
if tt.wantErr != "" {
87-
require.Error(t, err)
88-
assert.ErrorContains(t, err, tt.wantErr)
89-
} else {
90-
require.NoError(t, err)
91-
assert.Equal(t, tt.want.Level, s.Level)
92-
assert.Equal(t, tt.want.From, s.From)
93-
}
94-
})
95-
}
96-
}

cmd/mdatagen/internal/metric_validation_test.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Copyright The OpenTelemetry Authors
2-
// SPDX-License-Identifier: Apache-2.0
31
package internal
42

53
import (
@@ -38,8 +36,6 @@ func TestMetricValidate_DeprecatedWithoutDeprecatedStability(t *testing.T) {
3836
}
3937

4038
func TestMetricValidate_DeprecatedStabilityWithoutDeprecatedBlock(t *testing.T) {
41-
// Backward compatibility: deprecated metrics without deprecated block are allowed
42-
// (for existing metrics in contrib). New metrics should include the deprecated block.
4339
m := &Metric{
4440
Signal: Signal{
4541
Stability: Stability{
@@ -111,29 +107,3 @@ func TestMetricValidate_DeprecatedMissingNote(t *testing.T) {
111107
func ptr[T any](v T) *T {
112108
return &v
113109
}
114-
115-
func TestMetricValidate_DeprecatedHappyPath(t *testing.T) {
116-
m := Metric{
117-
Signal: Signal{
118-
Stability: Stability{
119-
Level: component.StabilityLevelDeprecated,
120-
From: "1.0.0",
121-
},
122-
Description: "test metric",
123-
},
124-
125-
Deprecated: &Deprecated{
126-
Since: "1.0.0",
127-
Note: "will be removed",
128-
},
129-
Unit: ptr("1"),
130-
Sum: &Sum{
131-
MetricValueType: MetricValueType{
132-
ValueType: pmetric.NumberDataPointValueTypeInt,
133-
},
134-
},
135-
}
136-
137-
err := m.validate("test.metric", "1.0.0")
138-
require.NoError(t, err)
139-
}

cmd/mdatagen/internal/sampleconnector/documentation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ The metric will be become optional soon.
3838
3939
The metric will be removed soon.
4040
41-
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability | Deprecation |
42-
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- | ----------- |
43-
| s | Sum | Double | Delta | false | Deprecated | since 1.0.0 (This metric will be removed) |
41+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability |
42+
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- |
43+
| s | Sum | Double | Delta | false | Deprecated |
4444
4545
### metric.input_type
4646
@@ -89,9 +89,9 @@ metrics:
8989
9090
[DEPRECATED] Gauge double metric disabled by default.
9191
92-
| Unit | Metric Type | Value Type | Stability | Deprecation |
93-
| ---- | ----------- | ---------- | --------- | ----------- |
94-
| 1 | Gauge | Double | Deprecated | since 1.0.0 (This metric will be removed) |
92+
| Unit | Metric Type | Value Type | Stability |
93+
| ---- | ----------- | ---------- | --------- |
94+
| 1 | Gauge | Double | Deprecated |
9595
9696
#### Attributes
9797
@@ -105,9 +105,9 @@ metrics:
105105
106106
[DEPRECATED] Gauge double metric disabled by default.
107107
108-
| Unit | Metric Type | Value Type | Stability | Deprecation |
109-
| ---- | ----------- | ---------- | --------- | ----------- |
110-
| | Gauge | Double | Deprecated | since 1.0.0 (This metric will be removed) |
108+
| Unit | Metric Type | Value Type | Stability |
109+
| ---- | ----------- | ---------- | --------- |
110+
| | Gauge | Double | Deprecated |
111111
112112
#### Attributes
113113

cmd/mdatagen/internal/samplereceiver/documentation.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Monotonic cumulative sum int metric enabled by default.
1818
1919
The metric will be become optional soon.
2020
21-
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability | Deprecation |
22-
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- | ----------- |
23-
| s | Sum | Int | Cumulative | true | Deprecated | since 1.0.0 (This metric will be removed) |
21+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability |
22+
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- |
23+
| s | Sum | Int | Cumulative | true | Development |
2424
2525
#### Attributes
2626
@@ -41,9 +41,9 @@ The metric will be become optional soon.
4141
4242
The metric will be removed soon.
4343
44-
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability | Deprecation |
45-
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- | ----------- |
46-
| s | Sum | Double | Delta | false | Deprecated | since 1.0.0 (This metric will be removed) |
44+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability |
45+
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- |
46+
| s | Sum | Double | Delta | false | Deprecated |
4747
4848
### metric.input_type
4949
@@ -102,9 +102,9 @@ metrics:
102102
103103
[DEPRECATED] Gauge double metric disabled by default.
104104
105-
| Unit | Metric Type | Value Type | Stability | Deprecation |
106-
| ---- | ----------- | ---------- | --------- | ----------- |
107-
| 1 | Gauge | Double | Deprecated | since 1.0.0 (This metric will be removed) |
105+
| Unit | Metric Type | Value Type | Stability |
106+
| ---- | ----------- | ---------- | --------- |
107+
| 1 | Gauge | Double | Deprecated |
108108
109109
#### Attributes
110110
@@ -119,9 +119,9 @@ metrics:
119119
120120
[DEPRECATED] Gauge double metric disabled by default.
121121
122-
| Unit | Metric Type | Value Type | Stability | Deprecation |
123-
| ---- | ----------- | ---------- | --------- | ----------- |
124-
| | Gauge | Double | Deprecated | since 1.0.0 (This metric will be removed) |
122+
| Unit | Metric Type | Value Type | Stability |
123+
| ---- | ----------- | ---------- | --------- |
124+
| | Gauge | Double | Deprecated |
125125
126126
#### Attributes
127127
@@ -217,14 +217,11 @@ The following telemetry is emitted by this component.
217217
218218
### otelcol_batch_size_trigger_send
219219
220-
Number of times the batch was sent due to a size trigger
220+
Number of times the batch was sent due to a size trigger [Deprecated since v0.110.0]
221221
222-
> **Deprecated since 1.5.0**
223-
> This metric will be removed in favor of batch_send_trigger_size
224-
225-
| Unit | Metric Type | Value Type | Monotonic | Stability | Deprecation |
226-
| ---- | ----------- | ---------- | --------- | --------- | ----------- |
227-
| {times} | Sum | Int | true | Deprecated | since 1.5.0, note: This metric will be removed in favor of batch_send_trigger_size |
222+
| Unit | Metric Type | Value Type | Monotonic | Stability |
223+
| ---- | ----------- | ---------- | --------- | --------- |
224+
| {times} | Sum | Int | true | Deprecated |
228225
229226
### otelcol_process_runtime_total_alloc_bytes
230227
@@ -236,15 +233,15 @@ Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalA
236233
237234
### otelcol_queue_capacity
238235
239-
Queue capacity - sync gauge example.
236+
Queue capacity - sync gauge example. [Development]
240237
241238
| Unit | Metric Type | Value Type | Stability |
242239
| ---- | ----------- | ---------- | --------- |
243240
| {items} | Gauge | Int | Development |
244241
245242
### otelcol_queue_length
246243
247-
This metric is optional and therefore not initialized in NewTelemetryBuilder.
244+
This metric is optional and therefore not initialized in NewTelemetryBuilder. [Alpha]
248245
249246
For example this metric only exists if feature A is enabled.
250247
@@ -254,7 +251,7 @@ For example this metric only exists if feature A is enabled.
254251
255252
### otelcol_request_duration
256253
257-
Duration of request
254+
Duration of request [Alpha]
258255
259256
| Unit | Metric Type | Value Type | Stability |
260257
| ---- | ----------- | ---------- | --------- |

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/internal/metadatatest/generated_telemetrytest.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplescraper/documentation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ The metric will be become optional soon.
3838
3939
The metric will be removed soon.
4040
41-
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability | Deprecation |
42-
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- | ----------- |
43-
| s | Sum | Double | Delta | false | Deprecated | since 1.0.0 (This metric will be removed) |
41+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability |
42+
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- |
43+
| s | Sum | Double | Delta | false | Deprecated |
4444
4545
### metric.input_type
4646
@@ -99,9 +99,9 @@ metrics:
9999
100100
[DEPRECATED] Gauge double metric disabled by default.
101101
102-
| Unit | Metric Type | Value Type | Stability | Deprecation |
103-
| ---- | ----------- | ---------- | --------- | ----------- |
104-
| 1 | Gauge | Double | Deprecated | since 1.0.0 (This metric will be removed) |
102+
| Unit | Metric Type | Value Type | Stability |
103+
| ---- | ----------- | ---------- | --------- |
104+
| 1 | Gauge | Double | Deprecated |
105105
106106
#### Attributes
107107
@@ -115,9 +115,9 @@ metrics:
115115
116116
[DEPRECATED] Gauge double metric disabled by default.
117117
118-
| Unit | Metric Type | Value Type | Stability | Deprecation |
119-
| ---- | ----------- | ---------- | --------- | ----------- |
120-
| | Gauge | Double | Deprecated | since 1.0.0 (This metric will be removed) |
118+
| Unit | Metric Type | Value Type | Stability |
119+
| ---- | ----------- | ---------- | --------- |
120+
| | Gauge | Double | Deprecated |
121121
122122
#### Attributes
123123

0 commit comments

Comments
 (0)