Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sapmreceiver: allow multiple Start() calls #11518

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### 🧰 Bug fixes 🧰

- `sapmreceiver`: Fix issue where component instance use in multiple pipelines leads to start failures (#11518)

## v0.54.0

## 🛑 Breaking changes 🛑
Expand Down
4 changes: 4 additions & 0 deletions receiver/sapmreceiver/trace_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func (sr *sapmReceiver) HTTPHandlerFunc(rw http.ResponseWriter, req *http.Reques

// Start starts the sapmReceiver's server.
func (sr *sapmReceiver) Start(_ context.Context, host component.Host) error {
// server.Handler will be nil on initial call, otherwise noop.
if sr.server != nil && sr.server.Handler != nil {
return nil
}
// set up the listener
ln, err := sr.config.HTTPServerSettings.ToListener()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions receiver/sapmreceiver/trace_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func setupReceiver(t *testing.T, config *Config, sink *consumertest.TracesSink)

mh := newAssertNoErrorHost(t)
require.NoError(t, sr.Start(context.Background(), mh), "should not have failed to start trace reception")
require.NoError(t, sr.Start(context.Background(), mh), "should not fail to start log on second Start call")

// If there are errors reported through host.ReportFatalError() this will retrieve it.
<-time.After(500 * time.Millisecond)
Expand Down