Files
telemetry/pdata/pprofile/encoding.go
Damien MathieuandGitHub d19ebe4fb4 Pprofile marshal/unmarshalling and gRPC implementations (#11048)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This adds pprofile marshaling/unmarshaling, as well as the gRPC
implementation, so we can start setup the OTLP receivers and exporters.
2024-09-06 11:53:20 +02:00

32 lines
1.0 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package pprofile // import "go.opentelemetry.io/collector/pdata/pprofile"
// MarshalSizer is the interface that groups the basic Marshal and Size methods
type MarshalSizer interface {
Marshaler
Sizer
}
// Marshaler marshals pprofile.Profiles into bytes.
type Marshaler interface {
// MarshalProfiles the given pprofile.Profiles into bytes.
// If the error is not nil, the returned bytes slice cannot be used.
MarshalProfiles(td Profiles) ([]byte, error)
}
// Unmarshaler unmarshalls bytes into pprofile.Profiles.
type Unmarshaler interface {
// UnmarshalProfiles the given bytes into pprofile.Profiles.
// If the error is not nil, the returned pprofile.Profiles cannot be used.
UnmarshalProfiles(buf []byte) (Profiles, error)
}
// Sizer is an optional interface implemented by the Marshaler,
// that calculates the size of a marshaled Profiles.
type Sizer interface {
// ProfilesSize returns the size in bytes of a marshaled Profiles.
ProfilesSize(td Profiles) int
}