Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-osman3 committed Jul 9, 2024
1 parent 5bfa79b commit 42dfdfc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion exporter/exporterhelper/batch_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type batchSender struct {
mergeFunc exporterbatcher.BatchMergeFunc[Request]
mergeSplitFunc exporterbatcher.BatchMergeSplitFunc[Request]

activeRequests atomic.Int64
activeRequests atomic.Int64

mu sync.Mutex
activeBatch *batch
Expand Down
12 changes: 6 additions & 6 deletions exporter/exporterhelper/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ func newBaseExporter(set exporter.Settings, signal component.DataType, osf obsre
be := &baseExporter{
signal: signal,

concurrencySender: &baseRequestSender{},
batchSender: &baseRequestSender{},
queueSender: &baseRequestSender{},
obsrepSender: osf(obsReport),
retrySender: &baseRequestSender{},
timeoutSender: &timeoutSender{cfg: NewDefaultTimeoutSettings()},
concurrencySender: &baseRequestSender{},
batchSender: &baseRequestSender{},
queueSender: &baseRequestSender{},
obsrepSender: osf(obsReport),
retrySender: &baseRequestSender{},
timeoutSender: &timeoutSender{cfg: NewDefaultTimeoutSettings()},

set: set,
obsrep: obsReport,
Expand Down
39 changes: 19 additions & 20 deletions exporter/exporterhelper/concurrency_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ func TestConcurrencySender(t *testing.T) {
}

tests := []struct {
name string
batcherOption Option
name string
batcherOption Option
concurrencyOption Option
numRequests int
numItems int
hasError bool
errString string
numRequests int
numItems int
hasError bool
errString string
}{
{
name: "success",
batcherOption: WithBatcher(batcherCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc)),
name: "success",
batcherOption: WithBatcher(batcherCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc)),
concurrencyOption: WithConcurrency(cfg),
numRequests: cfg.Concurrency + 1,
numItems: 100,
numRequests: cfg.Concurrency + 1,
numItems: 100,
},
{
name: "canceled_context",
batcherOption: WithBatcher(batcherCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc)),
name: "canceled_context",
batcherOption: WithBatcher(batcherCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc)),
concurrencyOption: WithConcurrency(cfg),
numRequests: cfg.Concurrency + 1,
numItems: 100,
hasError: true,
errString: "context canceled",
numRequests: cfg.Concurrency + 1,
numItems: 100,
hasError: true,
errString: "context canceled",
},
}
for _, tt := range tests {
Expand Down Expand Up @@ -162,15 +162,14 @@ func TestConcurrencySender_RequestError(t *testing.T) {
assert.ErrorContains(t, errs, errStr)
}


type blockingSender struct {
baseRequestSender
blockCh chan struct{}
blockCh chan struct{}
}

func newBlockingSender(*ObsReport) requestSender {
return &blockingSender{
blockCh: make(chan struct{}),
blockCh: make(chan struct{}),
}
}

Expand All @@ -183,4 +182,4 @@ func (bs *blockingSender) send(ctx context.Context, req ...Request) error {

func (bs *blockingSender) unblock() {
close(bs.blockCh)
}
}

0 comments on commit 42dfdfc

Please sign in to comment.