| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package internal // import "go.opentelemetry.io/collector/pdata/internal" |
| 5 |
|
| 6 |
// MetricsToProto internal helper to convert Metrics to protobuf representation. |
| 7 |
func MetricsToProto(l MetricsWrapper) MetricsData { |
| 8 |
return MetricsData{ |
| 9 |
ResourceMetrics: l.orig.ResourceMetrics, |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
// MetricsFromProto internal helper to convert protobuf representation to Metrics. |
| 14 |
// This function set exclusive state assuming that it's called only once per Metrics. |
| 15 |
func MetricsFromProto(orig MetricsData) MetricsWrapper { |
| 16 |
return NewMetricsWrapper(&ExportMetricsServiceRequest{ |
| 17 |
ResourceMetrics: orig.ResourceMetrics, |
| 18 |
}, NewState()) |
| 19 |
} |