| 1 | // Copyright The OpenTelemetry Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper" |
| 5 | |
| 6 | import ( |
| 7 | "go.opentelemetry.io/collector/component" |
| 8 | "go.opentelemetry.io/collector/config/configretry" |
| 9 | "go.opentelemetry.io/collector/consumer" |
| 10 | "go.opentelemetry.io/collector/exporter/exporterhelper/internal" |
| 11 | ) |
| 12 | |
| 13 | // Option apply changes to BaseExporter. |
| 14 | type Option = internal.Option |
| 15 | |
| 16 | // WithStart overrides the default Start function for an exporter. |
| 17 | // The default start function does nothing and always returns nil. |
| 18 | func WithStart(start component.StartFunc) Option { |
| 19 | return internal.WithStart(start) |
| 20 | } |
| 21 | |
| 22 | // WithShutdown overrides the default Shutdown function for an exporter. |
| 23 | // The default shutdown function does nothing and always returns nil. |
| 24 | func WithShutdown(shutdown component.ShutdownFunc) Option { |
| 25 | return internal.WithShutdown(shutdown) |
| 26 | } |
| 27 | |
| 28 | // WithTimeout overrides the default TimeoutConfig for an exporter. |
| 29 | // The default TimeoutConfig is 5 seconds. |
| 30 | func WithTimeout(timeoutConfig TimeoutConfig) Option { |
| 31 | return internal.WithTimeout(timeoutConfig) |
| 32 | } |
| 33 | |
| 34 | // WithRetry overrides the default configretry.BackOffConfig for an exporter. |
| 35 | // The default configretry.BackOffConfig is to disable retries. |
| 36 | func WithRetry(config configretry.BackOffConfig) Option { |
| 37 | return internal.WithRetry(config) |
| 38 | } |
| 39 | |
| 40 | // WithCapabilities overrides the default Capabilities() function for a Consumer. |
| 41 | // The default is non-mutable data. |
| 42 | // TODO: Verify if we can change the default to be mutable as we do for processors. |
| 43 | func WithCapabilities(capabilities consumer.Capabilities) Option { |
| 44 | return internal.WithCapabilities(capabilities) |
| 45 | } |