@@ -25,7 +25,7 @@ import (
2525 "go.opentelemetry.io/collector/config/configmodels"
2626)
2727
28- // ComponentSettings for timeout. The timeout applies to individual attempts to send data to the backend.
28+ // TimeoutSettings for timeout. The timeout applies to individual attempts to send data to the backend.
2929type TimeoutSettings struct {
3030 // Timeout is the timeout for every attempt to send data to the backend.
3131 Timeout time.Duration `mapstructure:"timeout"`
@@ -72,7 +72,7 @@ func (req *baseRequest) setContext(ctx context.Context) {
7272
7373// baseSettings represents all the options that users can configure.
7474type baseSettings struct {
75- * componenthelper.ComponentSettings
75+ componentOptions [] componenthelper.Option
7676 TimeoutSettings
7777 QueueSettings
7878 RetrySettings
@@ -83,8 +83,7 @@ type baseSettings struct {
8383func fromOptions (options []Option ) * baseSettings {
8484 // Start from the default options:
8585 opts := & baseSettings {
86- ComponentSettings : componenthelper .DefaultComponentSettings (),
87- TimeoutSettings : DefaultTimeoutSettings (),
86+ TimeoutSettings : DefaultTimeoutSettings (),
8887 // TODO: Enable queuing by default (call DefaultQueueSettings)
8988 QueueSettings : QueueSettings {Enabled : false },
9089 // TODO: Enable retry by default (call DefaultRetrySettings)
@@ -102,19 +101,19 @@ func fromOptions(options []Option) *baseSettings {
102101// Option apply changes to baseSettings.
103102type Option func (* baseSettings )
104103
105- // WithShutdown overrides the default Shutdown function for an exporter.
104+ // WithStart overrides the default Start function for an exporter.
106105// The default shutdown function does nothing and always returns nil.
107- func WithShutdown ( shutdown componenthelper.Shutdown ) Option {
106+ func WithStart ( start componenthelper.Start ) Option {
108107 return func (o * baseSettings ) {
109- o .Shutdown = shutdown
108+ o .componentOptions = append ( o . componentOptions , componenthelper . WithStart ( start ))
110109 }
111110}
112111
113- // WithStart overrides the default Start function for an exporter.
112+ // WithShutdown overrides the default Shutdown function for an exporter.
114113// The default shutdown function does nothing and always returns nil.
115- func WithStart ( start componenthelper.Start ) Option {
114+ func WithShutdown ( shutdown componenthelper.Shutdown ) Option {
116115 return func (o * baseSettings ) {
117- o .Start = start
116+ o .componentOptions = append ( o . componentOptions , componenthelper . WithShutdown ( shutdown ))
118117 }
119118}
120119
@@ -162,7 +161,7 @@ type baseExporter struct {
162161func newBaseExporter (cfg configmodels.Exporter , logger * zap.Logger , options ... Option ) * baseExporter {
163162 bs := fromOptions (options )
164163 be := & baseExporter {
165- Component : componenthelper .NewComponent (bs .ComponentSettings ),
164+ Component : componenthelper .New (bs .componentOptions ... ),
166165 cfg : cfg ,
167166 convertResourceToTelemetry : bs .ResourceToTelemetrySettings .Enabled ,
168167 }
0 commit comments