Skip to content

Commit

Permalink
[chore] start and stop otlp exporter once (open-telemetry#32809)
Browse files Browse the repository at this point in the history
The testbed starts and stops the exporter once per signal, but we know
it's the same exporter underneath.

This PR changes the behavior of testbed to start and stop the exporter
just once. This change is needed to support
open-telemetry/opentelemetry-collector#10059

---------

Co-authored-by: Alex Boten <[email protected]>
Co-authored-by: Yang Song <[email protected]>
  • Loading branch information
3 people authored and cparkins committed Jul 11, 2024
1 parent df99eed commit 95749ce
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions testbed/testbed/receivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ func (bor *BaseOTLPDataReceiver) Start(tc consumer.Traces, mc consumer.Metrics,
return err
}

if err = bor.traceReceiver.Start(context.Background(), componenttest.NewNopHost()); err != nil {
return err
}
if err = bor.metricsReceiver.Start(context.Background(), componenttest.NewNopHost()); err != nil {
return err
}
// we reuse the receiver across signals. Starting the log receiver starts the metrics and traces receiver.
return bor.logReceiver.Start(context.Background(), componenttest.NewNopHost())
}

Expand All @@ -104,12 +99,7 @@ func (bor *BaseOTLPDataReceiver) WithQueue(sendingQueue string) *BaseOTLPDataRec
}

func (bor *BaseOTLPDataReceiver) Stop() error {
if err := bor.traceReceiver.Shutdown(context.Background()); err != nil {
return err
}
if err := bor.metricsReceiver.Shutdown(context.Background()); err != nil {
return err
}
// we reuse the receiver across signals. Shutting down the log receiver shuts down the metrics and traces receiver.
return bor.logReceiver.Shutdown(context.Background())
}

Expand Down

0 comments on commit 95749ce

Please sign in to comment.