You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[mdatagen] Add semconv reference for attributes in metadata schema (#14646)
#### Description
This PR adds support in mdatagen for defining semantic conventions
references for attributes.
Updating your attribute in `metadata.yaml`:
```yaml
attributes:
state:
description: Breakdown of memory usage by type.
type: string
enum: [buffered, cached, inactive, free, slab_reclaimable, slab_unreclaimable, used]
semantic_convention:
ref: system.md#system-memory-state
```
> [!IMPORTANT]
> This work also updates the `semantic_convention: ref:` to use a
relative URL, this was done as we want to ensure the same semconv
version from the metadata schema is used, otherwise the end user could
have a full url in `ref` with one semconv version and the schema version
being a different version. A new method has been introduced in mdatagen
that builds the semconv url at runtime.
Creates this table in the generated docs for that component:
#### Attributes
| Name | Description | Values | Requirement Level | Semantic Convention
|
| ---- | ----------- | ------ | ----------------- | -------------------
|
| state | Breakdown of memory usage by type. | Str: ``buffered``,
``cached``, ``inactive``, ``free``, ``slab_reclaimable``,
``slab_unreclaimable``, ``used`` | Recommended |
[state](https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/registry/attributes/system.md#system-memory-state)
|
<!-- Issue number if applicable -->
#### Link to tracking issue
This work is linked to #13297 but doesn't close it.
<!--Describe what testing was performed and which tests were added.-->
#### Testing
- loader_test.go was updated with attributes for `cpu` and `state`.
- Also `cmd/mdatagen/internal/samplereciever` was updated and generate
code created which creates tests.
<!--Describe the documentation added.-->
#### Documentation
The documentation template has been updated to reference the semconv
definition for attributes if provided in the schema.
0 commit comments