Skip to content

Commit

Permalink
Support metric.metadata in pdata/pmetric (#10006)
Browse files Browse the repository at this point in the history
#### Description

After
#9985, add
support for the new metric.metadata field in the pmetric package.

I plan to use the metric.metadata field to support additional prometheus
types per
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#metric-metadata
  • Loading branch information
dashpole committed Apr 19, 2024
1 parent 7b046d9 commit cb0637f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .chloggen/metric-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pmetric

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Support metric.metadata in pdata/pmetric

# One or more tracking issues or pull requests related to the change
issues: [10006]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
4 changes: 4 additions & 0 deletions pdata/internal/cmd/pdatagen/internal/pmetric_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ var metric = &messageValueStruct{
defaultVal: `""`,
testVal: `"1"`,
},
&sliceField{
fieldName: "Metadata",
returnSlice: mapStruct,
},
&oneOfField{
typeName: "MetricType",
originFieldName: "Data",
Expand Down
7 changes: 7 additions & 0 deletions pdata/pmetric/generated_metric.go

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

9 changes: 9 additions & 0 deletions pdata/pmetric/generated_metric_test.go

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

0 comments on commit cb0637f

Please sign in to comment.