Skip to content

Commit

Permalink
[chore] more CreateSettings renames (#10416)
Browse files Browse the repository at this point in the history
This only impacts internal code, no external impact.

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Jun 17, 2024
1 parent 654cb24 commit f88ce7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions service/telemetry/internal/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"go.opentelemetry.io/collector/component"
)

// CreateSettings holds configuration for building Telemetry.
type CreateSettings struct {
// Settings holds configuration for building Telemetry.
type Settings struct {
BuildInfo component.BuildInfo
AsyncErrorChannel chan error
ZapOptions []zap.Option
Expand All @@ -29,10 +29,10 @@ type Factory interface {
CreateDefaultConfig() component.Config

// CreateLogger creates a logger.
CreateLogger(ctx context.Context, set CreateSettings, cfg component.Config) (*zap.Logger, error)
CreateLogger(ctx context.Context, set Settings, cfg component.Config) (*zap.Logger, error)

// CreateTracerProvider creates a TracerProvider.
CreateTracerProvider(ctx context.Context, set CreateSettings, cfg component.Config) (trace.TracerProvider, error)
CreateTracerProvider(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error)

// TODO: Add CreateMeterProvider.

Expand Down Expand Up @@ -69,7 +69,7 @@ func (f *factory) CreateDefaultConfig() component.Config {
}

// CreateLoggerFunc is the equivalent of Factory.CreateLogger.
type CreateLoggerFunc func(context.Context, CreateSettings, component.Config) (*zap.Logger, error)
type CreateLoggerFunc func(context.Context, Settings, component.Config) (*zap.Logger, error)

// WithLogger overrides the default no-op logger.
func WithLogger(createLogger CreateLoggerFunc) FactoryOption {
Expand All @@ -78,15 +78,15 @@ func WithLogger(createLogger CreateLoggerFunc) FactoryOption {
})
}

func (f *factory) CreateLogger(ctx context.Context, set CreateSettings, cfg component.Config) (*zap.Logger, error) {
func (f *factory) CreateLogger(ctx context.Context, set Settings, cfg component.Config) (*zap.Logger, error) {
if f.CreateLoggerFunc == nil {
return zap.NewNop(), nil
}
return f.CreateLoggerFunc(ctx, set, cfg)
}

// CreateTracerProviderFunc is the equivalent of Factory.CreateTracerProvider.
type CreateTracerProviderFunc func(context.Context, CreateSettings, component.Config) (trace.TracerProvider, error)
type CreateTracerProviderFunc func(context.Context, Settings, component.Config) (trace.TracerProvider, error)

// WithTracerProvider overrides the default no-op tracer provider.
func WithTracerProvider(createTracerProvider CreateTracerProviderFunc) FactoryOption {
Expand All @@ -95,7 +95,7 @@ func WithTracerProvider(createTracerProvider CreateTracerProviderFunc) FactoryOp
})
}

func (f *factory) CreateTracerProvider(ctx context.Context, set CreateSettings, cfg component.Config) (trace.TracerProvider, error) {
func (f *factory) CreateTracerProvider(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) {
if f.CreateTracerProviderFunc == nil {
return tracenoop.NewTracerProvider(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion service/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ import (
)

// Settings holds configuration for building Telemetry.
type Settings = internal.CreateSettings
type Settings = internal.Settings

0 comments on commit f88ce7a

Please sign in to comment.