You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
Add missing apply_to_spans section support (#2301)
This bug was uncovered during spec review here: https://github.com/open-telemetry/opentelemetry-specification/pull/2008#discussion_r731359448 apply_to_spans section was missing although it is implied to be present in the description of how span changes section is supposed to work. This fixes the omission by adding apply_to_spans section. This is not a new feature, just fixing a bug in file format description and in the corresponding implementation. Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
This commit is contained in:
@@ -30,7 +30,14 @@ type SpanEvents struct {
|
||||
|
||||
// SpansChange corresponds to a section representing spans change.
|
||||
type SpansChange struct {
|
||||
RenameAttributes *RenameAttributes `yaml:"rename_attributes"`
|
||||
RenameAttributes *AttributeMapForSpans `yaml:"rename_attributes"`
|
||||
}
|
||||
|
||||
// AttributeMapForSpans corresponds to a section representing a translation of
|
||||
// attributes for specific spans.
|
||||
type AttributeMapForSpans struct {
|
||||
ApplyToSpans []types.SpanName `yaml:"apply_to_spans"`
|
||||
AttributeMap AttributeMap `yaml:"attribute_map"`
|
||||
}
|
||||
|
||||
// SpanEventsChange corresponds to a section representing span events change.
|
||||
|
||||
@@ -75,10 +75,11 @@ func TestParseSchemaFile(t *testing.T) {
|
||||
Spans: ast.Spans{
|
||||
Changes: []ast.SpansChange{
|
||||
{
|
||||
RenameAttributes: &ast.RenameAttributes{
|
||||
RenameAttributes: &ast.AttributeMapForSpans{
|
||||
AttributeMap: ast.AttributeMap{
|
||||
"peer.service": "peer.service.name",
|
||||
},
|
||||
ApplyToSpans: []types.SpanName{"HTTP GET"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
+3
-1
@@ -65,7 +65,9 @@ versions:
|
||||
# the new attribute name starting from this version.
|
||||
attribute_map:
|
||||
peer.service: peer.service.name
|
||||
|
||||
apply_to_spans:
|
||||
# apply only to spans named "HTTP GET"
|
||||
- "HTTP GET"
|
||||
span_events:
|
||||
changes:
|
||||
# Sequence of translations to apply to convert the schema from a prior version
|
||||
|
||||
Reference in New Issue
Block a user