Skip to content

Commit 7cbc87c

Browse files
committed
add test coverage
Signed-off-by: ChrsMark <[email protected]>
1 parent c40ff18 commit 7cbc87c

File tree

5 files changed

+65
-8
lines changed

5 files changed

+65
-8
lines changed

cmd/mdatagen/internal/loader_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@ func TestLoadMetadata(t *testing.T) {
519519
want: Metadata{},
520520
wantErr: "decoding failed due to the following error(s):\n\n'attributes[used_attr].type' invalid type: \"invalidtype\"",
521521
},
522+
{
523+
name: "testdata/invalid_metric_stability.yaml",
524+
want: Metadata{},
525+
wantErr: "decoding failed due to the following error(s):\n\n'metrics[default.metric]' decoding failed due to the following error(s):\n\n'stability' decoding failed due to the following error(s):\n\n'level' unsupported stability level: \"development42\"",
526+
},
527+
{
528+
name: "testdata/no_metric_stability.yaml",
529+
want: Metadata{},
530+
wantErr: "decoding failed due to the following error(s):\n\n'metrics[default.metric]' decoding failed due to the following error(s):\n\n'stability' missing required field: `stability.level`",
531+
},
522532
{
523533
name: "testdata/~~this file doesn't exist~~.yaml",
524534
wantErr: "unable to read the file file:testdata/~~this file doesn't exist~~.yaml",

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

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
type: metricreceiver
2+
3+
status:
4+
class: receiver
5+
stability:
6+
development: [logs]
7+
beta: [traces]
8+
stable: [metrics]
9+
distributions: [contrib]
10+
warnings:
11+
- Any additional information that should be brought to the consumer's attention
12+
13+
metrics:
14+
default.metric:
15+
enabled: true
16+
description: Monotonic cumulative sum int metric enabled by default.
17+
extended_documentation: The metric will be become optional soon.
18+
stability:
19+
level: development42
20+
unit: s
21+
sum:
22+
value_type: int
23+
monotonic: true
24+
aggregation_temporality: cumulative
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
type: metricreceiver
2+
3+
status:
4+
class: receiver
5+
stability:
6+
development: [logs]
7+
beta: [traces]
8+
stable: [metrics]
9+
distributions: [contrib]
10+
warnings:
11+
- Any additional information that should be brought to the consumer's attention
12+
13+
metrics:
14+
default.metric:
15+
enabled: true
16+
description: Monotonic cumulative sum int metric enabled by default.
17+
extended_documentation: The metric will be become optional soon.
18+
stability: ~
19+
unit: s
20+
sum:
21+
value_type: int
22+
monotonic: true
23+
aggregation_temporality: cumulative

receiver/otlpreceiver/otlp_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ func assertReceiverTraces(t *testing.T, tt *componenttest.Telemetry, id componen
13221322
metricdatatest.AssertEqual(t,
13231323
metricdata.Metrics{
13241324
Name: "otelcol_receiver_failed_spans",
1325-
Description: "The number of spans that failed to be processed by the receiver due to internal errors. [alpha]",
1325+
Description: "The number of spans that failed to be processed by the receiver due to internal errors. [Alpha]",
13261326
Unit: "{spans}",
13271327
Data: metricdata.Sum[int64]{
13281328
Temporality: metricdata.CumulativeTemporality,
@@ -1343,7 +1343,7 @@ func assertReceiverTraces(t *testing.T, tt *componenttest.Telemetry, id componen
13431343
metricdatatest.AssertEqual(t,
13441344
metricdata.Metrics{
13451345
Name: "otelcol_receiver_accepted_spans",
1346-
Description: "Number of spans successfully pushed into the pipeline. [alpha]",
1346+
Description: "Number of spans successfully pushed into the pipeline. [Alpha]",
13471347
Unit: "{spans}",
13481348
Data: metricdata.Sum[int64]{
13491349
Temporality: metricdata.CumulativeTemporality,
@@ -1364,7 +1364,7 @@ func assertReceiverTraces(t *testing.T, tt *componenttest.Telemetry, id componen
13641364
metricdatatest.AssertEqual(t,
13651365
metricdata.Metrics{
13661366
Name: "otelcol_receiver_refused_spans",
1367-
Description: "Number of spans that could not be pushed into the pipeline. [alpha]",
1367+
Description: "Number of spans that could not be pushed into the pipeline. [Alpha]",
13681368
Unit: "{spans}",
13691369
Data: metricdata.Sum[int64]{
13701370
Temporality: metricdata.CumulativeTemporality,
@@ -1441,7 +1441,7 @@ func assertReceiverMetrics(t *testing.T, tt *componenttest.Telemetry, id compone
14411441
metricdatatest.AssertEqual(t,
14421442
metricdata.Metrics{
14431443
Name: "otelcol_receiver_failed_metric_points",
1444-
Description: "The number of metric points that failed to be processed by the receiver due to internal errors. [alpha]",
1444+
Description: "The number of metric points that failed to be processed by the receiver due to internal errors. [Alpha]",
14451445
Unit: "{datapoints}",
14461446
Data: metricdata.Sum[int64]{
14471447
Temporality: metricdata.CumulativeTemporality,
@@ -1462,7 +1462,7 @@ func assertReceiverMetrics(t *testing.T, tt *componenttest.Telemetry, id compone
14621462
metricdatatest.AssertEqual(t,
14631463
metricdata.Metrics{
14641464
Name: "otelcol_receiver_accepted_metric_points",
1465-
Description: "Number of metric points successfully pushed into the pipeline. [alpha]",
1465+
Description: "Number of metric points successfully pushed into the pipeline. [Alpha]",
14661466
Unit: "{datapoints}",
14671467
Data: metricdata.Sum[int64]{
14681468
Temporality: metricdata.CumulativeTemporality,
@@ -1483,7 +1483,7 @@ func assertReceiverMetrics(t *testing.T, tt *componenttest.Telemetry, id compone
14831483
metricdatatest.AssertEqual(t,
14841484
metricdata.Metrics{
14851485
Name: "otelcol_receiver_refused_metric_points",
1486-
Description: "Number of metric points that could not be pushed into the pipeline. [alpha]",
1486+
Description: "Number of metric points that could not be pushed into the pipeline. [Alpha]",
14871487
Unit: "{datapoints}",
14881488
Data: metricdata.Sum[int64]{
14891489
Temporality: metricdata.CumulativeTemporality,

0 commit comments

Comments
 (0)