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

[7.x] [alerting][actions] add task scheduled date and delay to event log (#102252) #103033

Closed
wants to merge 1 commit into from

Conversation

pmuellr
Copy link
Member

@pmuellr pmuellr commented Jun 23, 2021

Backports the following commits to 7.x:

…lastic#102252)

resolves elastic#98634

This adds a new object property to the event log kibana object named
task, with two properties to track the time the task was scheduled to
run, and the delay between when it was supposed to run and when it
actually started. This task property is only added to the appropriate
events.

	task: schema.maybe(
	  schema.object({
	    scheduled: ecsDate(),
	    schedule_delay: ecsNumber(),
	  })
	),
@pmuellr pmuellr enabled auto-merge (squash) June 23, 2021 00:58
@kibanamachine
Copy link
Contributor

kibanamachine commented Jun 23, 2021

💔 Build Failed

Failed CI Steps


Test Failures

Kibana Pipeline / jest / Jest Tests.x-pack/plugins/actions/server/lib.successfully executes

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `successfully executes 1`

- Snapshot  -  0
+ Received  + 19

@@ -1,9 +1,28 @@
  Array [
    Array [
      Object {
        "event": Object {
+         "action": "execute-start",
+       },
+       "kibana": Object {
+         "saved_objects": Array [
+           Object {
+             "id": "1",
+             "namespace": "some-namespace",
+             "rel": "primary",
+             "type": "action",
+             "type_id": "test",
+           },
+         ],
+       },
+       "message": "action started: test:1: 1",
+     },
+   ],
+   Array [
+     Object {
+       "event": Object {
          "action": "execute",
          "outcome": "success",
        },
        "kibana": Object {
          "saved_objects": Array [
    at Object.<anonymous> (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/x-pack/plugins/actions/server/lib/action_executor.test.ts:112:43)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at _callCircusTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-circus/build/run.js:212:5)
    at _runTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-circus/build/run.js:149:3)
    at _runTestsForDescribeBlock (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-circus/build/run.js:63:9)
    at run (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:176:21)
    at jestAdapter (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:109:19)
    at runTestInternal (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-runner/build/runTest.js:380:16)
    at runTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-runner/build/runTest.js:472:34)
    at Object.worker (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-runner/build/testWorker.js:133:12)

Kibana Pipeline / general / X-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute·ts.alerting api integration spaces only Actions execute should handle execute request appropriately

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 1 times on tracked branches: https://dryrun

[00:00:00]       │
[00:00:00]         └-: alerting api integration spaces only
[00:00:00]           └-> "before all" hook in "alerting api integration spaces only"
[00:00:00]           └-: Actions
[00:00:00]             └-> "before all" hook in "Actions"
[00:00:00]             └-> "before all" hook in "Actions"
[00:00:00]               │ debg creating space
[00:00:00]               │ debg created space
[00:00:00]               │ debg creating space
[00:00:01]               │ debg created space
[00:00:41]             └-: execute
[00:00:41]               └-> "before all" hook for "should handle execute request appropriately"
[00:00:41]               └-> "before all" hook for "should handle execute request appropriately"
[00:00:41]                 │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1624409939961589439] [.kibana-alerting-test-data] creating index, cause [api], templates [], shards [1]/[1]
[00:00:42]                 │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1624409939961589439] [.kibana-test-authorization] creating index, cause [api], templates [], shards [1]/[1]
[00:00:42]               └-> should handle execute request appropriately
[00:00:42]                 └-> "before each" hook: global before each for "should handle execute request appropriately"
[00:00:42]                 │ proc [kibana]   log   [01:40:26.050] [info][eventLog][plugins] event logged: {"@timestamp":"2021-06-23T01:40:26.048Z","event":{"provider":"actions","action":"execute-start","start":"2021-06-23T01:40:26.048Z"},"kibana":{"saved_objects":[{"rel":"primary","type":"action","id":"fb33c6d0-d3c3-11eb-bb9f-b97a082983c4","type_id":"test.index-record","namespace":"space1"}],"server_uuid":"5b2de169-2785-441b-ae8c-186a1936b17d"},"message":"action started: test.index-record:fb33c6d0-d3c3-11eb-bb9f-b97a082983c4: My action","ecs":{"version":"1.8.0"}}
[00:00:42]                 │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1624409939961589439] [.kibana-alerting-test-data/9AvCgsv4T16EBgecTw5_WQ] update_mapping [_doc]
[00:00:44]                 │ proc [kibana]   log   [01:40:27.063] [info][eventLog][plugins] event logged: {"@timestamp":"2021-06-23T01:40:27.062Z","event":{"provider":"actions","action":"execute","start":"2021-06-23T01:40:26.048Z","end":"2021-06-23T01:40:27.062Z","duration":1014000000,"outcome":"success"},"kibana":{"saved_objects":[{"rel":"primary","type":"action","id":"fb33c6d0-d3c3-11eb-bb9f-b97a082983c4","type_id":"test.index-record","namespace":"space1"}],"server_uuid":"5b2de169-2785-441b-ae8c-186a1936b17d"},"message":"action executed: test.index-record:fb33c6d0-d3c3-11eb-bb9f-b97a082983c4: My action","ecs":{"version":"1.8.0"}}
[00:00:44]                 │ debg --- retry.try error: no events found yet
[00:00:44]                 │ debg --- retry.try error: insufficient events found with action "execute" (0 must be equal to 1)
[00:00:45]                 └- ✖ fail: alerting api integration spaces only Actions execute should handle execute request appropriately
[00:00:45]                 │      ReferenceError: event is not defined
[00:00:45]                 │       at validateEventLog (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:409:12)
[00:00:45]                 │       at Context.<anonymous> (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:97:7)
[00:00:45]                 │       at Object.apply (/dev/shm/workspace/parallel/20/kibana/node_modules/@kbn/test/src/functional_test_runner/lib/mocha/wrap_function.js:73:16)
[00:00:45]                 │ 
[00:00:45]                 │ 

Stack Trace

ReferenceError: event is not defined
    at validateEventLog (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:409:12)
    at Context.<anonymous> (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:97:7)
    at Object.apply (/dev/shm/workspace/parallel/20/kibana/node_modules/@kbn/test/src/functional_test_runner/lib/mocha/wrap_function.js:73:16)

Kibana Pipeline / general / X-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute·ts.alerting api integration spaces only Actions execute should handle execute request appropriately

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]       │
[00:00:00]         └-: alerting api integration spaces only
[00:00:00]           └-> "before all" hook in "alerting api integration spaces only"
[00:00:00]           └-: Actions
[00:00:00]             └-> "before all" hook in "Actions"
[00:00:00]             └-> "before all" hook in "Actions"
[00:00:00]               │ debg creating space
[00:00:00]               │ debg created space
[00:00:00]               │ debg creating space
[00:00:01]               │ debg created space
[00:00:42]             └-: execute
[00:00:42]               └-> "before all" hook for "should handle execute request appropriately"
[00:00:42]               └-> "before all" hook for "should handle execute request appropriately"
[00:00:42]                 │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1624409939961589439] [.kibana-alerting-test-data] creating index, cause [api], templates [], shards [1]/[1]
[00:00:42]                 │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1624409939961589439] [.kibana-test-authorization] creating index, cause [api], templates [], shards [1]/[1]
[00:00:42]               └-> should handle execute request appropriately
[00:00:42]                 └-> "before each" hook: global before each for "should handle execute request appropriately"
[00:00:43]                 │ proc [kibana]   log   [01:32:44.843] [info][eventLog][plugins] event logged: {"@timestamp":"2021-06-23T01:32:44.840Z","event":{"provider":"actions","action":"execute-start","start":"2021-06-23T01:32:44.840Z"},"kibana":{"saved_objects":[{"rel":"primary","type":"action","id":"e84f4f40-d3c2-11eb-b996-196c3a46048f","type_id":"test.index-record","namespace":"space1"}],"server_uuid":"5b2de169-2785-441b-ae8c-186a1936b17d"},"message":"action started: test.index-record:e84f4f40-d3c2-11eb-b996-196c3a46048f: My action","ecs":{"version":"1.8.0"}}
[00:00:43]                 │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1624409939961589439] [.kibana-alerting-test-data/gMyVKtFnS2qe6Xm7_JsqQg] update_mapping [_doc]
[00:00:44]                 │ proc [kibana]   log   [01:32:45.852] [info][eventLog][plugins] event logged: {"@timestamp":"2021-06-23T01:32:45.851Z","event":{"provider":"actions","action":"execute","start":"2021-06-23T01:32:44.840Z","end":"2021-06-23T01:32:45.851Z","duration":1011000000,"outcome":"success"},"kibana":{"saved_objects":[{"rel":"primary","type":"action","id":"e84f4f40-d3c2-11eb-b996-196c3a46048f","type_id":"test.index-record","namespace":"space1"}],"server_uuid":"5b2de169-2785-441b-ae8c-186a1936b17d"},"message":"action executed: test.index-record:e84f4f40-d3c2-11eb-b996-196c3a46048f: My action","ecs":{"version":"1.8.0"}}
[00:00:45]                 └- ✖ fail: alerting api integration spaces only Actions execute should handle execute request appropriately
[00:00:45]                 │      ReferenceError: event is not defined
[00:00:45]                 │       at validateEventLog (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:409:12)
[00:00:45]                 │       at Context.<anonymous> (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:97:7)
[00:00:45]                 │       at Object.apply (/dev/shm/workspace/parallel/20/kibana/node_modules/@kbn/test/src/functional_test_runner/lib/mocha/wrap_function.js:73:16)
[00:00:45]                 │ 
[00:00:45]                 │ 

Stack Trace

ReferenceError: event is not defined
    at validateEventLog (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:409:12)
    at Context.<anonymous> (test/alerting_api_integration/spaces_only/tests/actions/execute.ts:97:7)
    at Object.apply (/dev/shm/workspace/parallel/20/kibana/node_modules/@kbn/test/src/functional_test_runner/lib/mocha/wrap_function.js:73:16)

Metrics [docs]

✅ unchanged

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

@jbudz
Copy link
Member

jbudz commented Jun 23, 2021

#102252 (comment)

The merge into master was reverted.

@pmuellr
Copy link
Member Author

pmuellr commented Jun 23, 2021

closing since commit to master was bad

@pmuellr pmuellr closed this Jun 23, 2021
auto-merge was automatically disabled June 23, 2021 04:08

Pull request was closed

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.

3 participants