Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest Management] Report agent status during checkin #23058

Merged
merged 10 commits into from
Dec 15, 2020

Conversation

michalpristas
Copy link
Contributor

What does this PR do?

This PR adds a basic status reporter and controller structures used to compute overall agent health.
This computed status is then used during checkin and reported to fleet.

With each new configuration status is reset to healthy to avoid reporting failures from unrelated configurations.

Discussed with @nchaulet and for now it's ok not to reset long polling request in order to shorten delay in between status changes (some backpressure or rate limiter protection would need to be applied on either of the sides to prevent harms from frequent changes)

Why is it important?

related elastic/elastic-agent#120
related elastic/kibana#71009

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label Team:Ingest Management and removed needs_team Indicates that the issue/PR needs a Team:* label labels Dec 10, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@michalpristas michalpristas changed the title Agent status reporter [Ingest Management] Report agent status during checkin Dec 10, 2020
@michalpristas michalpristas self-assigned this Dec 10, 2020
@michalpristas michalpristas added v7.11.0 needs_backport PR is waiting to be backported to other branches. labels Dec 10, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Dec 10, 2020

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request elastic/beats#23058 updated

  • Start Time: 2020-12-15T08:01:20.986+0000

  • Duration: 98 min 18 sec

Test stats 🧪

Test Results
Failed 0
Passed 17499
Skipped 1379
Total 18878

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 17499
Skipped 1379
Total 18878

@EricDavisX
Copy link
Contributor

/package

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I think more work will need to be done to link it to each input for the configuration. At the moment this works for 7.11 being that we do not have per-input status reporting.

return errors.New(fmt.Sprintf("operator: received unexpected event '%s'", step.ID), errors.TypeConfig)
}

if err := handler(step); err != nil {
o.statusReporter.Update(status.Failed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be easier to do these in a defered.

defer func() {
    if err != nil {
        o.statusReporter.Update(status.Failed)
        return err
    }
}()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed

@michalpristas michalpristas merged commit 992c639 into elastic:master Dec 15, 2020
michalpristas added a commit to michalpristas/beats that referenced this pull request Dec 15, 2020
[Ingest Management] Report agent status during checkin (elastic#23058)
michalpristas added a commit that referenced this pull request Dec 15, 2020
[Ingest Management] Report agent status during checkin (#23058)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_backport PR is waiting to be backported to other branches. v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants