Skip to content

Commit ee91b1a

Browse files
belimawrmergify[bot]
authored andcommitted
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. (cherry picked from commit 72314a0) # Conflicts: # filebeat/input/filestream/internal/input-logfile/harvester.go
1 parent 859a155 commit ee91b1a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,17 @@ func startHarvester(
206206
ctx.Logger.Errorf("Harvester crashed with: %+v", err)
207207
hg.readers.remove(srcID)
208208
}
209+
<<<<<<< HEAD
210+
=======
211+
212+
// Report any harvester error as a degraded state for the input
213+
if err != nil {
214+
ctx.UpdateStatus(
215+
status.Degraded,
216+
fmt.Sprintf("Harvester for Filestream input %q failed: %s", inputID, err),
217+
)
218+
}
219+
>>>>>>> 72314a046 (Remove direct access to v2.Context.StatusReporter in Filestream (#48075))
209220
}()
210221

211222
if restart {

filebeat/input/v2/input.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ type Context struct {
104104
// StatusReporter provides a method to update the status of the underlying unit
105105
// that maps to the config. Note: Under standalone execution of Filebeat this is
106106
// expected to be nil.
107+
// Deprecated: Direct access to StatusReporter is deprecated because it
108+
// can be nil, use the UpdateStatus method instead
107109
StatusReporter status.StatusReporter
108110

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

0 commit comments

Comments
 (0)