Skip to content

Commit

Permalink
run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
timannguyen committed May 22, 2024
1 parent 822f427 commit 71e54c9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions exporter/exporterhelper/batch_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterbatcher"
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
"go.opentelemetry.io/otel/attribute"
)

// batchSender is a component that places requests into batches before passing them to the downstream senders.
Expand All @@ -40,8 +39,8 @@ type batchSender struct {
mu sync.Mutex
activeBatch *batch

traceAttribute attribute.KeyValue
logger *zap.Logger
fullName string
logger *zap.Logger

shutdownCh chan struct{}
stopped *atomic.Bool
Expand All @@ -51,8 +50,8 @@ type batchSender struct {
func newBatchSender(cfg exporterbatcher.Config, set exporter.CreateSettings,
mf exporterbatcher.BatchMergeFunc[Request], msf exporterbatcher.BatchMergeSplitFunc[Request]) *batchSender {
bs := &batchSender{
fullName: set.ID.String(),
activeBatch: newEmptyBatch(),
traceAttribute: attribute.String(obsmetrics.ExporterKey, set.ID.String()),
cfg: cfg,
logger: set.Logger,
mergeFunc: mf,
Expand Down Expand Up @@ -95,7 +94,7 @@ func (bs *batchSender) Start(_ context.Context, _ component.Host) error {
}
}()

bs.logger.Debug("Started Batch Sender", zap.String(obsmetrics.ExporterKey, bs.traceAttribute.Value.AsString()))
bs.logger.Debug("Started Batch Sender", zap.String(obsmetrics.ExporterKey, bs.fullName))
return nil
}

Expand Down Expand Up @@ -218,7 +217,7 @@ func (bs *batchSender) updateActiveBatch(ctx context.Context, req Request) {
}

func (bs *batchSender) Shutdown(context.Context) error {
bs.logger.Debug("Shutting down Batch Sender", zap.String(obsmetrics.ExporterKey, bs.traceAttribute.Value.AsString()))
bs.logger.Debug("Shutting down Batch Sender", zap.String(obsmetrics.ExporterKey, bs.fullName))

bs.stopped.Store(true)
close(bs.shutdownCh)
Expand All @@ -227,6 +226,6 @@ func (bs *batchSender) Shutdown(context.Context) error {
time.Sleep(10 * time.Millisecond)
}

bs.logger.Debug("Batch Sender has been shutdown", zap.String(obsmetrics.ExporterKey, bs.traceAttribute.Value.AsString()))
bs.logger.Debug("Batch Sender has been shutdown", zap.String(obsmetrics.ExporterKey, bs.fullName))
return nil
}

0 comments on commit 71e54c9

Please sign in to comment.