| 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 |
// MigrateLogs implements any translation needed due to deprecation in OTLP logs protocol. |
| 11 |
// Any plog.Unmarshaler implementation from OTLP (proto/json) MUST call this, and the gRPC Server implementation. |
| 12 |
func MigrateLogs(rls []*internal.ResourceLogs) { |
| 13 |
for _, rl := range rls { |
| 14 |
if len(rl.ScopeLogs) == 0 { |
| 15 |
rl.ScopeLogs = rl.DeprecatedScopeLogs |
| 16 |
} |
| 17 |
rl.DeprecatedScopeLogs = nil |
| 18 |
} |
| 19 |
} |