Debian Codegraph @

pdata/internal/otlp/traces.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package otlp // import "go.opentelemetry.io/collector/pdata/internal/otlp"
5
6 import (
7 "go.opentelemetry.io/collector/pdata/internal"
8 )
9
10 // MigrateTraces implements any translation needed due to deprecation in OTLP traces protocol.
11 // Any ptrace.Unmarshaler implementation from OTLP (proto/json) MUST call this, and the gRPC Server implementation.
12 func MigrateTraces(rss []*internal.ResourceSpans) {
13 for _, rs := range rss {
14 if len(rs.ScopeSpans) == 0 {
15 rs.ScopeSpans = rs.DeprecatedScopeSpans
16 }
17 rs.DeprecatedScopeSpans = nil
18 }
19 }