Skip to content

Commit c631779

Browse files
committed
Update status in all input lifecycle phases
Now also cover the following phases: - pipeline creation - sanitizers creation - input setup
1 parent 5212494 commit c631779

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (in *eventHubInputV1) Run(
7575
// Create pipelineClient for publishing events.
7676
in.pipelineClient, err = createPipelineClient(pipeline)
7777
if err != nil {
78+
inputContext.UpdateStatus(status.Failed, err.Error())
7879
return fmt.Errorf("failed to create pipeline pipelineClient: %w", err)
7980
}
8081
defer in.pipelineClient.Close()
@@ -86,6 +87,7 @@ func (in *eventHubInputV1) Run(
8687
// Set up new and legacy sanitizers, if any.
8788
sanitizers, err := newSanitizers(in.config.Sanitizers, in.config.LegacySanitizeOptions)
8889
if err != nil {
90+
inputContext.UpdateStatus(status.Failed, err.Error())
8991
return fmt.Errorf("failed to create sanitizers: %w", err)
9092
}
9193

@@ -102,6 +104,8 @@ func (in *eventHubInputV1) Run(
102104
// in preparation for the main run loop.
103105
err = in.setup(ctx)
104106
if err != nil {
107+
in.log.Errorw("error setting up input", "error", err)
108+
inputContext.UpdateStatus(status.Failed, err.Error())
105109
return err
106110
}
107111

@@ -113,7 +117,7 @@ func (in *eventHubInputV1) Run(
113117
return err
114118
}
115119

116-
inputContext.UpdateStatus(status.Stopped, "")
120+
inputContext.UpdateStatus(status.Stopping, "")
117121
return nil
118122
}
119123

0 commit comments

Comments
 (0)