Skip to content

Commit 9412dd2

Browse files
committed
Update input v1 status on start, failure, and stop
When I update the input to the Input API v2, I missed the opportunity to report the input status back to the Elastic Agent.
1 parent bfde79f commit 9412dd2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x-pack/filebeat/input/azureeventhub/v1_input.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
v2 "github.com/elastic/beats/v7/filebeat/input/v2"
2424
"github.com/elastic/beats/v7/libbeat/beat"
2525
"github.com/elastic/beats/v7/libbeat/common/acker"
26+
"github.com/elastic/beats/v7/libbeat/management/status"
2627
"github.com/elastic/elastic-agent-libs/logp"
2728
"github.com/elastic/elastic-agent-libs/mapstr"
2829
)
@@ -68,6 +69,9 @@ func (in *eventHubInputV1) Run(
6869
) error {
6970
var err error
7071

72+
// Update the status to starting
73+
inputContext.UpdateStatus(status.Starting, "")
74+
7175
// Create pipelineClient for publishing events.
7276
in.pipelineClient, err = createPipelineClient(pipeline)
7377
if err != nil {
@@ -105,9 +109,11 @@ func (in *eventHubInputV1) Run(
105109
err = in.run(ctx)
106110
if err != nil {
107111
in.log.Errorw("error running input", "error", err)
112+
inputContext.UpdateStatus(status.Failed, err.Error())
108113
return err
109114
}
110115

116+
inputContext.UpdateStatus(status.Stopped, "")
111117
return nil
112118
}
113119

0 commit comments

Comments
 (0)