46 lines
1.7 KiB
Go
46 lines
1.7 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper"
|
|
|
|
import (
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/config/configretry"
|
|
"go.opentelemetry.io/collector/consumer"
|
|
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
|
)
|
|
|
|
// Option apply changes to BaseExporter.
|
|
type Option = internal.Option
|
|
|
|
// WithStart overrides the default Start function for an exporter.
|
|
// The default start function does nothing and always returns nil.
|
|
func WithStart(start component.StartFunc) Option {
|
|
return internal.WithStart(start)
|
|
}
|
|
|
|
// WithShutdown overrides the default Shutdown function for an exporter.
|
|
// The default shutdown function does nothing and always returns nil.
|
|
func WithShutdown(shutdown component.ShutdownFunc) Option {
|
|
return internal.WithShutdown(shutdown)
|
|
}
|
|
|
|
// WithTimeout overrides the default TimeoutConfig for an exporter.
|
|
// The default TimeoutConfig is 5 seconds.
|
|
func WithTimeout(timeoutConfig TimeoutConfig) Option {
|
|
return internal.WithTimeout(timeoutConfig)
|
|
}
|
|
|
|
// WithRetry overrides the default configretry.BackOffConfig for an exporter.
|
|
// The default configretry.BackOffConfig is to disable retries.
|
|
func WithRetry(config configretry.BackOffConfig) Option {
|
|
return internal.WithRetry(config)
|
|
}
|
|
|
|
// WithCapabilities overrides the default Capabilities() function for a Consumer.
|
|
// The default is non-mutable data.
|
|
// TODO: Verify if we can change the default to be mutable as we do for processors.
|
|
func WithCapabilities(capabilities consumer.Capabilities) Option {
|
|
return internal.WithCapabilities(capabilities)
|
|
}
|