Skip to content

Commit

Permalink
[receiver/signalfx] Remove deprecated use of host.ReportFatalError (#…
Browse files Browse the repository at this point in the history
…31099)

**Description:**
Remove deprecated use of `host.ReportFatalError`

**Link to tracking Issue:**
Fixes #30598
  • Loading branch information
atoulme committed Feb 8, 2024
1 parent 1ad99ae commit 2270ae4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .chloggen/signalfxreceiver_ReportFatalError.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: signalfxreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated use of `host.ReportFatalError`

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30598]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion receiver/signalfxreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r *sfxReceiver) Start(_ context.Context, host component.Host) error {
go func() {
defer r.shutdownWG.Done()
if errHTTP := r.server.Serve(ln); !errors.Is(errHTTP, http.ErrServerClosed) && errHTTP != nil {
host.ReportFatalError(errHTTP)
r.settings.TelemetrySettings.ReportStatus(component.NewFatalErrorEvent(errHTTP))
}
}()
return nil
Expand Down
8 changes: 5 additions & 3 deletions receiver/signalfxreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,11 @@ func Test_sfxReceiver_TLS(t *testing.T) {
},
}
sink := new(consumertest.MetricsSink)
r, err := newReceiver(receivertest.NewNopCreateSettings(), *cfg)
cs := receivertest.NewNopCreateSettings()
cs.TelemetrySettings.ReportStatus = func(event *component.StatusEvent) {
require.NoError(t, event.Err())
}
r, err := newReceiver(cs, *cfg)
require.NoError(t, err)
r.RegisterMetricsConsumer(sink)
defer func() {
Expand All @@ -553,8 +557,6 @@ func Test_sfxReceiver_TLS(t *testing.T) {
mh := componenttest.NewNopHost()
require.NoError(t, r.Start(context.Background(), mh), "should not have failed to start metric reception")

// If there are errors reported through host.ReportFatalError() this will retrieve it.
<-time.After(500 * time.Millisecond)
t.Log("Metric Reception Started")

msec := time.Now().Unix() * 1e3
Expand Down

0 comments on commit 2270ae4

Please sign in to comment.