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

[Alerting] Add event log entry when an action starts executing #102370

Merged

Conversation

chrisronline
Copy link
Contributor

Resolves #102358

This PR adds an additional event to the event log that indicates when an action starts executing. Currently, we only log to the event log when the action finishes execution which helps us understand what actions finished execution (technically, just scheduled as we do not wait for action execution to completely finish) and when, but it does not tell us which actions started executing but never finished. This PR aims to address this which will help diagnose issues with actions not executing as expected.

@chrisronline chrisronline marked this pull request as ready for review June 18, 2021 01:23
@chrisronline chrisronline requested a review from a team as a code owner June 18, 2021 01:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@chrisronline chrisronline changed the title [Alerting] Add event log entry when a action starts executing [Alerting] Add event log entry when an action starts executing Jun 18, 2021
@ymao1
Copy link
Contributor

ymao1 commented Jun 21, 2021

Do you think this belongs in the actions plugin instead of the alerting plugin?

There is already an execute-action in the alerting plugin and this execute-action-start looks pretty much identical to that document.

In the actions plugin, there is an execute event that is logged at the end of an action execution that includes start/duration/end. I think the execute-start should be added there to log the start time of the action in case the action fails and the execute event isn't logged.

@ymao1
Copy link
Contributor

ymao1 commented Jun 21, 2021

For reference, this is the new execute-action-start event that I am seeing with this PR. It is provided by alerting and there is no start time logged.

{
	"@timestamp": "2021-06-21T11:42:01.088Z",
	"event": {
		"provider": "alerting",
		"action": "execute-action-start",
		"kind": "alert",
		"category": [
			"AlertingExample"
		]
	},
	"kibana": {
		"alerting": {
			"instance_id": "625c54fb-e987-4a6b-9924-5200d8f03362",
			"action_group_id": "small"
		},
		"saved_objects": [{
				"rel": "primary",
				"type": "alert",
				"id": "aea36800-d285-11eb-b53f-9728526aae03",
				"type_id": "example.always-firing"
			},
			{
				"type": "action",
				"id": "a96fc590-d285-11eb-b53f-9728526aae03",
				"type_id": ".server-log"
			}
		],
		"server_uuid": "5b2de169-2785-441b-ae8c-186a1936b17d"
	},
	"rule": {
		"id": "aea36800-d285-11eb-b53f-9728526aae03",
		"license": "basic",
		"category": "example.always-firing",
		"ruleset": "AlertingExample",
		"name": "test"
	},
	"message": "alert: example.always-firing:aea36800-d285-11eb-b53f-9728526aae03: 'test' instanceId: '625c54fb-e987-4a6b-9924-5200d8f03362' start schedule actionGroup: 'small' action: .server-log:a96fc590-d285-11eb-b53f-9728526aae03",
	"ecs": {
		"version": "1.8.0"
	}
}

@chrisronline
Copy link
Contributor Author

chrisronline commented Jun 21, 2021

@ymao1 You're absolutely right - I'll move it, thanks!

I also should update the tests here to include this new event log type: https://github.com/elastic/kibana/blob/master/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM! Verified there was an execute-start event provided by the actions plugin with a start time for every action execution

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@chrisronline chrisronline merged commit dec77cf into elastic:master Jun 22, 2021
@chrisronline chrisronline deleted the alerting/action_execution_starts branch June 22, 2021 20:01
chrisronline added a commit to chrisronline/kibana that referenced this pull request Jun 22, 2021
…ic#102370)

* First steps for adding action execution to event log

* Fix tests

* Move the event to the actions plugin

* Update functional tests

* Fix tests

* Fix types
chrisronline added a commit that referenced this pull request Jun 22, 2021
…) (#103001)

* First steps for adding action execution to event log

* Fix tests

* Move the event to the actions plugin

* Update functional tests

* Fix tests

* Fix types
@chrisronline chrisronline restored the alerting/action_execution_starts branch June 23, 2021 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alerting] [o11y] Improve event log data to include when the action execution starts
5 participants