Skip to content

Commit

Permalink
chore(autoexport): get rid hasFallback flag which became extra after …
Browse files Browse the repository at this point in the history
…fallbackFactory change
  • Loading branch information
hcelaloner committed Feb 6, 2024
1 parent ff11c5a commit 697a5ca
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions exporters/autoexport/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (s signal[T]) create(ctx context.Context, opts ...option[T]) (T, error) {

expType := os.Getenv(s.envKey)
if expType == "" {
if cfg.hasFallback {
if cfg.fallbackFactory != nil {
return cfg.fallbackFactory(ctx)
}
expType = "otlp"
Expand All @@ -51,7 +51,6 @@ func (s signal[T]) create(ctx context.Context, opts ...option[T]) (T, error) {
}

type config[T any] struct {
hasFallback bool
fallbackFactory func(ctx context.Context) (T, error)
}

Expand All @@ -68,7 +67,6 @@ func (fn optionFunc[T]) apply(cfg *config[T]) {

func withFallbackFactory[T any](fallbackFactory func(ctx context.Context) (T, error)) option[T] {
return optionFunc[T](func(cfg *config[T]) {
cfg.hasFallback = true
cfg.fallbackFactory = fallbackFactory
})
}

0 comments on commit 697a5ca

Please sign in to comment.