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

[Response Ops] API to retrieve execution log entries from event log. #127339

Merged
merged 68 commits into from
Mar 18, 2022

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Mar 9, 2022

Resolves #126837

Summary

Adds new HTTP API to retrieve execution log information.

To Verify

  • Create a rule and let it run.
  • Navigate to https://localhost:5601/internal/alerting/rule/<rule_id>/_execution_log?date_start=<ISO date string> and see entries for the execution log. Only date_start query parameter is required, all others have default values. Defaults to sorting by descending timestamp order with 10 results per page.
  • Try passing in other query params like sort, page, and per page.
  • Response should look like this:
{
      total: 374,
      data: [
        {
          id: '6705da7d-2635-499d-a6a8-1aee1ae1eac9',
          timestamp: '2022-03-07T15:38:32.617Z',
          duration_ms: 1056,
          status: 'success',
          message:
            "rule executed: example.always-firing:a348a740-9e2c-11ec-bd64-774ed95c43ef: 'test rule'",
          num_active_alerts: 5,
          num_new_alerts: 5,
          num_recovered_alerts: 0,
          num_triggered_actions: 5,
          num_succeeded_actions: 5,
          num_errored_actions: 0,
          total_search_duration_ms: 0,
          es_search_duration_ms: 0,
          timed_out: false,
          schedule_delay_ms: 3393,
        },
        {
          id: '41b2755e-765a-4044-9745-b03875d5e79a',
          timestamp: '2022-03-07T15:39:05.604Z',
          duration_ms: 1165,
          status: 'success',
          message:
            "rule executed: example.always-firing:a348a740-9e2c-11ec-bd64-774ed95c43ef: 'test rule'",
          num_active_alerts: 5,
          num_new_alerts: 5,
          num_recovered_alerts: 5,
          num_triggered_actions: 5,
          num_succeeded_actions: 5,
          num_errored_actions: 0,
          total_search_duration_ms: 0,
          es_search_duration_ms: 0,
          timed_out: false,
          schedule_delay_ms: 3456,
        },
      ],
    }

Checklist

ymao1 and others added 30 commits March 4, 2022 13:26
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Pulled down locally and saw the API return logs for a given rule 👍

@ymao1
Copy link
Contributor Author

ymao1 commented Mar 17, 2022

@elasticmachine merge upstream

Copy link
Member

@spong spong left a comment

Choose a reason for hiding this comment

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

Fantastic @ymao1! 🙌 Thanks for all the collab here and helping nail down the queries -- really appreciate it! And of course thank you for getting the initial agg work into the event-log client as well too! LGTM! 🙂 🚀

@ymao1
Copy link
Contributor Author

ymao1 commented Mar 18, 2022

@elasticmachine merge upstream

@ymao1 ymao1 enabled auto-merge (squash) March 18, 2022 13:38
@ymao1
Copy link
Contributor Author

ymao1 commented Mar 18, 2022

@elasticmachine merge upstream

@ymao1 ymao1 disabled auto-merge March 18, 2022 18:24
@ymao1
Copy link
Contributor Author

ymao1 commented Mar 18, 2022

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
alerting 18 20 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @ymao1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Response Ops] API for Execution History Summary
10 participants