Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] add new metric with input_type configuration #9784

Merged
merged 1 commit into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/mdatagen/internal/samplereceiver/documentation.md
Expand Up @@ -42,6 +42,24 @@ The metric will be will be removed soon.
| ---- | ----------- | ---------- | ----------------------- | --------- |
| s | Sum | Double | Delta | false |

### metric.input_type

Monotonic cumulative sum int metric with string input_type enabled by default.

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| s | Sum | Int | Cumulative | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| string_attr | Attribute with any string value. | Any Str |
| state | Integer attribute with overridden name. | Any Int |
| enum_attr | Attribute with a known set of string values. | Str: ``red``, ``green``, ``blue`` |
| slice_attr | Attribute with a slice value. | Any Slice |
| map_attr | Attribute with a map value. | Any Map |

## Optional Metrics

The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -5,6 +5,8 @@ all_set:
enabled: true
default.metric.to_be_removed:
enabled: true
metric.input_type:
enabled: true
optional.metric:
enabled: true
optional.metric.empty_unit:
Expand Down Expand Up @@ -32,6 +34,8 @@ none_set:
enabled: false
default.metric.to_be_removed:
enabled: false
metric.input_type:
enabled: false
optional.metric:
enabled: false
optional.metric.empty_unit:
Expand Down
11 changes: 11 additions & 0 deletions cmd/mdatagen/internal/samplereceiver/metadata.yaml
Expand Up @@ -137,3 +137,14 @@ metrics:
aggregation_temporality: delta
warnings:
if_enabled: This metric is deprecated and will be removed soon.

metric.input_type:
enabled: true
description: Monotonic cumulative sum int metric with string input_type enabled by default.
unit: s
sum:
value_type: int
input_type: string
monotonic: true
aggregation_temporality: cumulative
attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr ]
12 changes: 12 additions & 0 deletions cmd/mdatagen/loader_test.go
Expand Up @@ -217,6 +217,18 @@ func TestLoadMetadata(t *testing.T) {
Mono: Mono{Monotonic: false},
},
},
"metric.input_type": {
Enabled: true,
Description: "Monotonic cumulative sum int metric with string input_type enabled by default.",
Unit: strPtr("s"),
Sum: &sum{
MetricValueType: MetricValueType{pmetric.NumberDataPointValueTypeInt},
MetricInputType: MetricInputType{InputType: "string"},
AggregationTemporality: AggregationTemporality{Aggregation: pmetric.AggregationTemporalityCumulative},
Mono: Mono{Monotonic: true},
},
Attributes: []attributeName{"string_attr", "overridden_int_attr", "enum_attr", "slice_attr", "map_attr"},
},
},
ScopeName: "go.opentelemetry.io/collector/internal/receiver/samplereceiver",
ShortFolderName: "sample",
Expand Down