Skip to content

Commit 72314a0

Browse files
authored
Remove direct access to v2.Context.StatusReporter in Filestream (#48075)
v2.Context.StatusReporter can be nil when Filebeat runs standalone. The direct access to this field is replaced in Filestream by the UpdateStatus method. A deprecation notice is added is added to the StatusReporter field.
1 parent 1d6b8eb commit 72314a0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

filebeat/input/filestream/internal/input-logfile/harvester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func startHarvester(
210210

211211
// Report any harvester error as a degraded state for the input
212212
if err != nil {
213-
ctx.StatusReporter.UpdateStatus(
213+
ctx.UpdateStatus(
214214
status.Degraded,
215215
fmt.Sprintf("Harvester for Filestream input %q failed: %s", inputID, err),
216216
)

filebeat/input/v2/input.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ type Context struct {
109109
// StatusReporter provides a method to update the status of the underlying unit
110110
// that maps to the config. Note: Under standalone execution of Filebeat this is
111111
// expected to be nil.
112+
// Deprecated: Direct access to StatusReporter is deprecated because it
113+
// can be nil, use the UpdateStatus method instead
112114
StatusReporter status.StatusReporter
113115

114116
// MetricsRegistry is the registry collecting metrics for the input using

0 commit comments

Comments
 (0)