From c314725404fe7625d0e093c77d8ca03bb8e5f703 Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Tue, 16 Jan 2024 13:02:29 -0800 Subject: [PATCH] [chore] jaeger receiver ReportFatalError -> ReportStatus (#30609) Remove use of deprecated host.ReportFatalError Linked to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30501 Fixes #30591 Signed-off-by: Alex Boten --- receiver/jaegerreceiver/jaeger_agent_test.go | 2 +- receiver/jaegerreceiver/trace_receiver.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/receiver/jaegerreceiver/jaeger_agent_test.go b/receiver/jaegerreceiver/jaeger_agent_test.go index 2a86d4f45dff..aa1e5673ba41 100644 --- a/receiver/jaegerreceiver/jaeger_agent_test.go +++ b/receiver/jaegerreceiver/jaeger_agent_test.go @@ -85,7 +85,7 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { jr, err := newJaegerReceiver(jaegerAgent, config, nil, set) require.NoError(t, err) - assert.NoError(t, jr.startAgent(componenttest.NewNopHost()), "Start failed") + assert.NoError(t, jr.startAgent(), "Start failed") t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) l, err := net.Listen("udp", addr) diff --git a/receiver/jaegerreceiver/trace_receiver.go b/receiver/jaegerreceiver/trace_receiver.go index 05dde4431ebb..b60d8c435c70 100644 --- a/receiver/jaegerreceiver/trace_receiver.go +++ b/receiver/jaegerreceiver/trace_receiver.go @@ -125,7 +125,7 @@ func newJaegerReceiver( } func (jr *jReceiver) Start(_ context.Context, host component.Host) error { - if err := jr.startAgent(host); err != nil { + if err := jr.startAgent(); err != nil { return err } @@ -222,7 +222,7 @@ func (jr *jReceiver) PostSpans(ctx context.Context, r *api_v2.PostSpansRequest) return &api_v2.PostSpansResponse{}, nil } -func (jr *jReceiver) startAgent(host component.Host) error { +func (jr *jReceiver) startAgent() error { if jr.config == nil { return nil } @@ -283,7 +283,7 @@ func (jr *jReceiver) startAgent(host component.Host) error { go func() { defer jr.goroutines.Done() if err := jr.agentServer.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) && err != nil { - host.ReportFatalError(fmt.Errorf("jaeger agent server error: %w", err)) + jr.settings.ReportStatus(component.NewFatalErrorEvent(fmt.Errorf("jaeger agent server error: %w", err))) } }() } @@ -391,7 +391,7 @@ func (jr *jReceiver) startCollector(host component.Host) error { go func() { defer jr.goroutines.Done() if errHTTP := jr.collectorServer.Serve(cln); !errors.Is(errHTTP, http.ErrServerClosed) && errHTTP != nil { - host.ReportFatalError(errHTTP) + jr.settings.ReportStatus(component.NewFatalErrorEvent(errHTTP)) } }() } @@ -414,7 +414,7 @@ func (jr *jReceiver) startCollector(host component.Host) error { go func() { defer jr.goroutines.Done() if errGrpc := jr.grpc.Serve(ln); !errors.Is(errGrpc, grpc.ErrServerStopped) && errGrpc != nil { - host.ReportFatalError(errGrpc) + jr.settings.ReportStatus(component.NewFatalErrorEvent(errGrpc)) } }() }