Skip to content

Commit

Permalink
[chore] Schema Processor Revamp [Part 3] - Translation (#37403)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This is a slice of changes from
#35248
This PR details Translation which defines the complete abstraction of
schema translation file. It manages Revisions to move between two
versions of a schema

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests
  • Loading branch information
ankitpatel96 authored Feb 5, 2025
1 parent 10a547a commit 3cc420c
Show file tree
Hide file tree
Showing 11 changed files with 1,546 additions and 0 deletions.
10 changes: 10 additions & 0 deletions processor/schemaprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.22.0

require (
github.com/google/go-cmp v0.6.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.118.0
github.com/stretchr/testify v1.10.0
go.opentelemetry.io/collector/component v0.119.0
go.opentelemetry.io/collector/component/componenttest v0.119.0
Expand All @@ -21,6 +22,8 @@ require (
)

require (
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
Expand All @@ -39,6 +42,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.119.0 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.11.1 // indirect
Expand Down Expand Up @@ -77,3 +81,9 @@ retract (
v0.76.1
v0.65.0
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden
4 changes: 4 additions & 0 deletions processor/schemaprocessor/go.sum

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

7 changes: 7 additions & 0 deletions processor/schemaprocessor/internal/translation/testdata/1.6.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file_format: 1.0.0
schema_url: https://opentelemetry.io/schemas/1.6.1
versions:
1.6.1:
1.5.0:
1.4.0:
1.0.0:
16 changes: 16 additions & 0 deletions processor/schemaprocessor/internal/translation/testdata/1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
file_format: 1.0.0
schema_url: https://opentelemetry.io/schemas/1.9.0
versions:
1.9.0:
1.8.0:
spans:
changes:
- rename_attributes:
attribute_map:
db.cassandra.keyspace: db.name
db.hbase.namespace: db.name
1.7.0:
1.6.1:
1.5.0:
1.4.0:
1.0.0:
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
file_format: 1.0.0
schema_url: https://example.com/1.7.0
versions:
1.7.0:
logs:
changes:
- rename_attributes:
attribute_map:
process.stacktrace: application.stacktrace
1.5.0:
metrics:
changes:
- rename_metrics:
container.restart: container.restart.total
1.4.0: # The time we cared about privacy within spans and span events
spans:
changes:
- rename_attributes:
attribute_map:
user.operation: privacy.user.operation
span_events:
changes:
- rename_attributes:
attribute_map:
net.user.ip: privacy.net.user.ip
1.2.0:
all:
changes:
- rename_attributes:
attribute_map:
test.suite: test.name
1.1.0:
all:
changes:
- rename_attributes:
attribute_map:
test-suite: test.suite
resources:
changes:
- rename_attributes:
attribute_map:
resource-description: resource.description
spans:
changes:
- rename_attributes:
attribute_map:
operation: user.operation
- rename_attributes:
attribute_map:
operation.failure: operation.failed.reason
apply_to_spans:
- HTTP GET
- HTTP POST
span_events:
changes:
- rename_events:
name_map:
stacktrace: stack_trace
- rename_attributes:
attribute_map:
net.peer.ip : net.user.ip
- rename_attributes:
attribute_map:
proxy-addr: proxy.addr
apply_to_events:
- proxy.dial
metrics:
changes:
- rename_metrics:
container.respawn: container.restart
- rename_attributes:
attribute_map:
container-exit-code: container.exit.status
apply_to_metrics:
- container.stop
- container.restart
logs:
changes:
- rename_attributes:
attribute_map:
go.stacktrace: process.stacktrace
1.0.0:
Loading

0 comments on commit 3cc420c

Please sign in to comment.