mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Split off from #11131. Adds new module for consumer errors for profiles. --------- Co-authored-by: Damien Mathieu <[email protected]>
32 lines
863 B
Go
32 lines
863 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package internal // import "go.opentelemetry.io/collector/consumer/consumererror/internal"
|
|
|
|
import (
|
|
"go.opentelemetry.io/collector/pdata/plog"
|
|
"go.opentelemetry.io/collector/pdata/pmetric"
|
|
"go.opentelemetry.io/collector/pdata/pprofile"
|
|
"go.opentelemetry.io/collector/pdata/ptrace"
|
|
)
|
|
|
|
type Retryable[V ptrace.Traces | pmetric.Metrics | plog.Logs | pprofile.Profiles] struct {
|
|
Err error
|
|
Value V
|
|
}
|
|
|
|
// Error provides the error message
|
|
func (err Retryable[V]) Error() string {
|
|
return err.Err.Error()
|
|
}
|
|
|
|
// Unwrap returns the wrapped error for functions Is and As in standard package errors.
|
|
func (err Retryable[V]) Unwrap() error {
|
|
return err.Err
|
|
}
|
|
|
|
// Data returns the telemetry data that failed to be processed or sent.
|
|
func (err Retryable[V]) Data() V {
|
|
return err.Value
|
|
}
|