1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-03 22:52:30 +02:00

Fix incorrect "all" and "resource" definition for Schema File (#3777)

The "all" and "resource" sections had incorrect definitions of "attribute_rename"
transform. It was missing the subkey "attribute_map".

This is a bug fix and makes the implementation compliant with the spec:
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/schemas/file_format_v1.1.0.md#resources-section

Related issue: https://github.com/open-telemetry/opentelemetry-specification/issues/3245

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
Tigran Najaryan 2023-02-27 11:38:41 -05:00 committed by GitHub
parent fe6856e804
commit 071d317394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 114 additions and 100 deletions

View File

@ -51,6 +51,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) - Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743)
- Data race issue in OTLP exporter retry mechanism. (#3756) - Data race issue in OTLP exporter retry mechanism. (#3756)
- Fixes wrapping a nil error in some cases (#????) - Fixes wrapping a nil error in some cases (#????)
- Fix incorrect "all" and "resource" definition for Schema File (#3777)
### Deprecated ### Deprecated

View File

@ -52,5 +52,5 @@ type Attributes struct {
// AttributeChange corresponds to a section representing attribute changes. // AttributeChange corresponds to a section representing attribute changes.
type AttributeChange struct { type AttributeChange struct {
RenameAttributes *AttributeMap `yaml:"rename_attributes"` RenameAttributes *RenameAttributes `yaml:"rename_attributes"`
} }

View File

@ -39,7 +39,8 @@ func TestParseSchemaFile(t *testing.T) {
All: ast.Attributes{ All: ast.Attributes{
Changes: []ast.AttributeChange{ Changes: []ast.AttributeChange{
{ {
RenameAttributes: &ast.AttributeMap{ RenameAttributes: &ast.RenameAttributes{
AttributeMap: ast.AttributeMap{
"k8s.cluster.name": "kubernetes.cluster.name", "k8s.cluster.name": "kubernetes.cluster.name",
"k8s.namespace.name": "kubernetes.namespace.name", "k8s.namespace.name": "kubernetes.namespace.name",
"k8s.node.name": "kubernetes.node.name", "k8s.node.name": "kubernetes.node.name",
@ -64,16 +65,19 @@ func TestParseSchemaFile(t *testing.T) {
}, },
}, },
}, },
},
Resources: ast.Attributes{ Resources: ast.Attributes{
Changes: []ast.AttributeChange{ Changes: []ast.AttributeChange{
{ {
RenameAttributes: &ast.AttributeMap{ RenameAttributes: &ast.RenameAttributes{
AttributeMap: ast.AttributeMap{
"telemetry.auto.version": "telemetry.auto_instr.version", "telemetry.auto.version": "telemetry.auto_instr.version",
}, },
}, },
}, },
}, },
},
Spans: ast.Spans{ Spans: ast.Spans{
Changes: []ast.SpansChange{ Changes: []ast.SpansChange{

View File

@ -18,6 +18,7 @@ versions:
all: all:
changes: changes:
- rename_attributes: - rename_attributes:
attribute_map:
# Mapping of attribute names (label names for metrics). The key is the old name # Mapping of attribute names (label names for metrics). The key is the old name
# used prior to this version, the value is the new name starting from this version. # used prior to this version, the value is the new name starting from this version.
@ -50,6 +51,7 @@ versions:
resources: resources:
changes: changes:
- rename_attributes: - rename_attributes:
attribute_map:
# Mapping of attribute names. The key is the old name # Mapping of attribute names. The key is the old name
# used prior to this version, the value is the new name starting from this version. # used prior to this version, the value is the new name starting from this version.
telemetry.auto.version: telemetry.auto_instr.version telemetry.auto.version: telemetry.auto_instr.version

View File

@ -40,7 +40,8 @@ func TestParseSchemaFile(t *testing.T) {
All: ast10.Attributes{ All: ast10.Attributes{
Changes: []ast10.AttributeChange{ Changes: []ast10.AttributeChange{
{ {
RenameAttributes: &ast10.AttributeMap{ RenameAttributes: &ast10.RenameAttributes{
AttributeMap: ast10.AttributeMap{
"k8s.cluster.name": "kubernetes.cluster.name", "k8s.cluster.name": "kubernetes.cluster.name",
"k8s.namespace.name": "kubernetes.namespace.name", "k8s.namespace.name": "kubernetes.namespace.name",
"k8s.node.name": "kubernetes.node.name", "k8s.node.name": "kubernetes.node.name",
@ -65,16 +66,19 @@ func TestParseSchemaFile(t *testing.T) {
}, },
}, },
}, },
},
Resources: ast10.Attributes{ Resources: ast10.Attributes{
Changes: []ast10.AttributeChange{ Changes: []ast10.AttributeChange{
{ {
RenameAttributes: &ast10.AttributeMap{ RenameAttributes: &ast10.RenameAttributes{
AttributeMap: ast10.AttributeMap{
"telemetry.auto.version": "telemetry.auto_instr.version", "telemetry.auto.version": "telemetry.auto_instr.version",
}, },
}, },
}, },
}, },
},
Spans: ast10.Spans{ Spans: ast10.Spans{
Changes: []ast10.SpansChange{ Changes: []ast10.SpansChange{

View File

@ -6,5 +6,6 @@ versions:
all: all:
changes: changes:
- rename_attributes: - rename_attributes:
attribute_map:
k8s.cluster.name: kubernetes.cluster.name k8s.cluster.name: kubernetes.cluster.name
1.0.0: 1.0.0:

View File

@ -18,6 +18,7 @@ versions:
all: all:
changes: changes:
- rename_attributes: - rename_attributes:
attribute_map:
# Mapping of attribute names (label names for metrics). The key is the old name # Mapping of attribute names (label names for metrics). The key is the old name
# used prior to this version, the value is the new name starting from this version. # used prior to this version, the value is the new name starting from this version.
@ -50,6 +51,7 @@ versions:
resources: resources:
changes: changes:
- rename_attributes: - rename_attributes:
attribute_map:
# Mapping of attribute names. The key is the old name # Mapping of attribute names. The key is the old name
# used prior to this version, the value is the new name starting from this version. # used prior to this version, the value is the new name starting from this version.
telemetry.auto.version: telemetry.auto_instr.version telemetry.auto.version: telemetry.auto_instr.version