| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package internal // import "go.opentelemetry.io/collector/consumer/consumererror/internal" |
| 5 |
|
| 6 |
import ( |
| 7 |
"go.opentelemetry.io/collector/pdata/plog" |
| 8 |
"go.opentelemetry.io/collector/pdata/pmetric" |
| 9 |
"go.opentelemetry.io/collector/pdata/pprofile" |
| 10 |
"go.opentelemetry.io/collector/pdata/ptrace" |
| 11 |
) |
| 12 |
|
| 13 |
type Retryable[V ptrace.Traces | pmetric.Metrics | plog.Logs | pprofile.Profiles] struct { |
| 14 |
Err error |
| 15 |
Value V |
| 16 |
} |
| 17 |
|
| 18 |
// Error provides the error message |
| 19 |
func (err Retryable[V]) Error() string { |
| 20 |
return err.Err.Error() |
| 21 |
} |
| 22 |
|
| 23 |
// Unwrap returns the wrapped error for functions Is and As in standard package errors. |
| 24 |
func (err Retryable[V]) Unwrap() error { |
| 25 |
return err.Err |
| 26 |
} |
| 27 |
|
| 28 |
// Data returns the telemetry data that failed to be processed or sent. |
| 29 |
func (err Retryable[V]) Data() V { |
| 30 |
return err.Value |
| 31 |
} |