[filebeat][filestream] Enable status reporter for filestream input#40121
[filebeat][filestream] Enable status reporter for filestream input#40121VihasMakwana merged 6 commits intoelastic:mainfrom
Conversation
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
|
||
| return inp.readFromSource(ctx, log, r, fs.newPath, state, publisher, metrics) | ||
| if err := inp.readFromSource(ctx, log, r, fs.newPath, state, publisher, metrics); err != nil { | ||
| ctx.UpdateStatus(status.Degraded, fmt.Sprintf("error while reading from source: %v", err)) |
There was a problem hiding this comment.
Sorry for the late comment, if this exits with a transient error, what is setting the input state back to healthy?
In general the thing I am watching out for in the status reporting PRs situations where we permanently mark inputs as degraded or failed after the error condition has cleared.
There was a problem hiding this comment.
@cmacknz I understand your concern.
I did some digging and turns out that readFromSource only throws an error when it calls Publish()
beats/filebeat/input/filestream/input.go
Lines 394 to 397 in d87d15b
The above error is returned when the context is cancelled.
beats/filebeat/input/filestream/internal/input-logfile/publish.go
Lines 91 to 97 in d87d15b
For other cases (EOF, reader was closed etc.), we just log the error and return nil. So, we will not mark the input as degraded, as they are transient in nature.
There was a problem hiding this comment.
@cmacknz maybe we don't need this particular ctx.UpdateStatus? I don't think we need to mark input as degraded when the context is cancelled (which should ideally happen during beat shutdown).
I overlooked this particular ctx.UpdateStatus.
Proposed commit message
Enable
StatusReporterforfilestreaminput which was introduced in #39209Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Related issues
Use cases
This PR allows the filestream to report its status to elastic-agent. This would keep the status of the unit up-to-date and would help with diagnostics.
Screenshots
Logs