mirror of
https://github.com/hanzoai/metrics.git
synced 2026-10-30 20:03:39 +00:00
20 lines
633 B
Go
20 lines
633 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package otlp // import "go.opentelemetry.io/collector/pdata/internal/otlp"
|
|
|
|
import (
|
|
"go.opentelemetry.io/collector/pdata/internal"
|
|
)
|
|
|
|
// MigrateMetrics implements any translation needed due to deprecation in OTLP metrics protocol.
|
|
// Any pmetric.Unmarshaler implementation from OTLP (proto/json) MUST call this, and the gRPC Server implementation.
|
|
func MigrateMetrics(rms []*internal.ResourceMetrics) {
|
|
for _, rm := range rms {
|
|
if len(rm.ScopeMetrics) == 0 {
|
|
rm.ScopeMetrics = rm.DeprecatedScopeMetrics
|
|
}
|
|
rm.DeprecatedScopeMetrics = nil
|
|
}
|
|
}
|