Skip to content

Commit ea7e141

Browse files
committed
incr test coverage
Signed-off-by: ChrsMark <[email protected]>
1 parent e2173c6 commit ea7e141

File tree

9 files changed

+134
-4
lines changed

9 files changed

+134
-4
lines changed

cmd/mdatagen/internal/loader_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestLoadMetadata(t *testing.T) {
4343
GithubProject: "open-telemetry/opentelemetry-collector",
4444
GeneratedPackageName: "metadata",
4545
Type: "sample",
46-
SemConvVersion: "1.9.0",
46+
SemConvVersion: "1.37.0",
4747
PackageName: "go.opentelemetry.io/collector/cmd/mdatagen/internal/samplereceiver",
4848
Status: &Status{
4949
DisableCodeCov: true,
@@ -233,6 +233,21 @@ func TestLoadMetadata(t *testing.T) {
233233
Mono: Mono{Monotonic: true},
234234
},
235235
},
236+
"system.cpu.time": {
237+
Signal: Signal{
238+
Enabled: true,
239+
Stability: Stability{Level: "beta"},
240+
SemanticConvention: &SemanticConvention{SemanticConventionRef: "https://github.com/open-telemetry/semantic-conventions/blob/v1.37.0/docs/system/system-metrics.md#metric-systemcputime"},
241+
Description: "Monotonic cumulative sum int metric enabled by default.",
242+
ExtendedDocumentation: "The metric will be become optional soon.",
243+
},
244+
Unit: strPtr("s"),
245+
Sum: &Sum{
246+
MetricValueType: MetricValueType{pmetric.NumberDataPointValueTypeInt},
247+
AggregationTemporality: AggregationTemporality{Aggregation: pmetric.AggregationTemporalityCumulative},
248+
Mono: Mono{Monotonic: true},
249+
},
250+
},
236251
"optional.metric": {
237252
Signal: Signal{
238253
Enabled: false,

cmd/mdatagen/internal/samplereceiver/documentation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ Monotonic cumulative sum int metric with string input_type enabled by default.
6262
| slice_attr | Attribute with a slice value. | Any Slice | false |
6363
| map_attr | Attribute with a map value. | Any Map | false |
6464
65+
### system.cpu.time
66+
67+
Monotonic cumulative sum int metric enabled by default.
68+
69+
The metric will be become optional soon.
70+
71+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic | Stability | Semantic Convention |
72+
| ---- | ----------- | ---------- | ----------------------- | --------- | --------- | ------------------- |
73+
| s | Sum | Int | Cumulative | true | beta | [system.cpu.time](https://github.com/open-telemetry/semantic-conventions/blob/v1.37.0/docs/system/system-metrics.md#metric-systemcputime) |
74+
6575
## Optional Metrics
6676
6777
The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:

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

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_logs.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/metadata/generated_metrics.go

Lines changed: 64 additions & 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/metadata/generated_metrics_test.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/internal/metadata/testdata/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ all_set:
1111
enabled: true
1212
optional.metric.empty_unit:
1313
enabled: true
14+
system.cpu.time:
15+
enabled: true
1416
events:
1517
default.event:
1618
enabled: true
@@ -47,6 +49,8 @@ none_set:
4749
enabled: false
4850
optional.metric.empty_unit:
4951
enabled: false
52+
system.cpu.time:
53+
enabled: false
5054
events:
5155
default.event:
5256
enabled: false

cmd/mdatagen/internal/samplereceiver/metadata.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type: sample
44
scope_name: go.opentelemetry.io/collector/internal/receiver/samplereceiver
55
github_project: open-telemetry/opentelemetry-collector
66

7-
sem_conv_version: 1.9.0
7+
sem_conv_version: 1.37.0
88

99
status:
1010
disable_codecov_badge: true
@@ -141,6 +141,20 @@ events:
141141
attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr ]
142142

143143
metrics:
144+
system.cpu.time:
145+
enabled: true
146+
stability:
147+
level: beta
148+
description: Monotonic cumulative sum int metric enabled by default.
149+
extended_documentation: The metric will be become optional soon.
150+
unit: s
151+
sum:
152+
value_type: int
153+
monotonic: true
154+
aggregation_temporality: cumulative
155+
semantic_convention:
156+
semconv_ref: https://github.com/open-telemetry/semantic-conventions/blob/v1.37.0/docs/system/system-metrics.md#metric-systemcputime
157+
144158
default.metric:
145159
enabled: true
146160
description: Monotonic cumulative sum int metric enabled by default.

0 commit comments

Comments
 (0)