Files
MarioandGitHub e0354d1bed Update Prometheus to v0.307.2, OTel collector contrib to v0.138.0, OTel to v1.44.0 (#5810)
* Update Prometheus to v0.307.2

* Update otel collector

* Update OTel collector
2025-10-28 11:30:17 +01:00

47 lines
1.3 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package pprofile // import "go.opentelemetry.io/collector/pdata/pprofile"
import (
"go.opentelemetry.io/collector/pdata/internal"
)
var _ MarshalSizer = (*ProtoMarshaler)(nil)
type ProtoMarshaler struct{}
func (e *ProtoMarshaler) MarshalProfiles(pd Profiles) ([]byte, error) {
size := internal.SizeProtoOrigExportProfilesServiceRequest(pd.getOrig())
buf := make([]byte, size)
_ = internal.MarshalProtoOrigExportProfilesServiceRequest(pd.getOrig(), buf)
return buf, nil
}
func (e *ProtoMarshaler) ProfilesSize(pd Profiles) int {
return internal.SizeProtoOrigExportProfilesServiceRequest(pd.getOrig())
}
func (e *ProtoMarshaler) ResourceProfilesSize(pd ResourceProfiles) int {
return internal.SizeProtoOrigResourceProfiles(pd.orig)
}
func (e *ProtoMarshaler) ScopeProfilesSize(pd ScopeProfiles) int {
return internal.SizeProtoOrigScopeProfiles(pd.orig)
}
func (e *ProtoMarshaler) ProfileSize(pd Profile) int {
return internal.SizeProtoOrigProfile(pd.orig)
}
type ProtoUnmarshaler struct{}
func (d *ProtoUnmarshaler) UnmarshalProfiles(buf []byte) (Profiles, error) {
pd := NewProfiles()
err := internal.UnmarshalProtoOrigExportProfilesServiceRequest(pd.getOrig(), buf)
if err != nil {
return Profiles{}, err
}
return pd, nil
}