-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Response Ops][Reporting] Scheduled Reports - Task (merging into feature branch) #219770
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][Reporting] Scheduled Reports - Task (merging into feature branch) #219770
Conversation
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
… src/core/server/integration_tests/ci_checks'
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
… src/core/server/integration_tests/ci_checks'
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
⏳ Build in-progress, with failures
Failed CI StepsTest Failures
History
|
|
Took me a bit to figure out, so saving for posterity. curl $KB_URL/internal/reporting/schedule/printablePdfV2 \
-H "kbn-xsrf: foo" \
-H "x-elastic-internal-origin: kibana" \
-H "content-type: application/json" \
-d '
{
"jobParams":"(browserTimezone:America/New_York,layout:(dimensions:(height:2220,width:1335),id:preserve_layout),locatorParams:!((id:DASHBOARD_APP_LOCATOR,params:(dashboardId:edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b,preserveSavedFilters:!t,timeRange:(from:now-7d/d,to:now),useHash:!f,viewMode:edit))),objectType:dashboard,title:LogsWebTraffic)",
"schedule": { "rrule": { "freq": 3, "interval": 1, "byhour": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] } }
}
'
|
|
I tried creating a scheduled report in a non-default space, via my incantation above, but with a I actually referencede a dashboard that WASN'T in this space, which I realized later, so I wouldn't have expected it to actually generate a report. But it looks like it had a problem loading the scheduled report saved object. |
|
Given the error I saw, mentioned in the comment above, I noticed it did NOT get retried. I think this is by design, but probably something we want to figure out, since it sometimes happens that a retry will get the search indices warmed up to get a long-running report to succeed after an initial failure. |
Good catch! Updated to be space aware in 1f46d45 |
Yea, we typically don't perform retries for recurring tasks so there's no built in retry. I think we'd have to update task manager to allow retries for recurring tasks if we want that ability. I can open an issue to discuss |
Ya, let's open an issue. Given Tim's previous note that "subsequent attempts often succeed", I think we'll have to do something. Doesn't seem like a blocker to get the basic function out. Wondering if we'd just want to do an "inline retry" of these, which would complicate the task itself, but not require any new tasks, or changes to TM ... |
Issue: #222079 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, was able to generate PDF reports as usual in default and a test space, as well as schedule a report in both spaces, and have them run successfully.
| } | ||
|
|
||
| // otherwise use internal repository | ||
| return savedObjects.createInternalRepository([SCHEDULED_REPORT_SAVED_OBJECT_TYPE]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this could be confusing in the future, since it returns either a scoped or internal client. And complicates the typing (minor concern). Would it be better to have separate methods? It seems pretty obvious to me in the code, right now ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split into separate functions in ad65b91
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
cc @ymao1 |
Resolves #216313 ## Summary This is a feature branch that contains the following commits. Each individual linked PR contains a summary and verification instructions. * Schedule API - #219771 * Scheduled report task runner - #219770 * List and disable API - #220922 * Audit logging - #221846 * Send scheduled report emails - #220539 * Commit to check license - f5f9d9d * Update to list API response format - #224262 --------- Co-authored-by: Ersin Erdal <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Ersin Erdal <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Alexi Doak <[email protected]>
Resolves elastic#216313 ## Summary This is a feature branch that contains the following commits. Each individual linked PR contains a summary and verification instructions. * Schedule API - elastic#219771 * Scheduled report task runner - elastic#219770 * List and disable API - elastic#220922 * Audit logging - elastic#221846 * Send scheduled report emails - elastic#220539 * Commit to check license - elastic@f5f9d9d * Update to list API response format - elastic#224262 --------- Co-authored-by: Ersin Erdal <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Ersin Erdal <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Alexi Doak <[email protected]> (cherry picked from commit a409627) # Conflicts: # src/platform/packages/private/kbn-reporting/common/routes.ts # x-pack/platform/plugins/private/canvas/server/feature.test.ts # x-pack/platform/plugins/private/reporting/server/core.ts # x-pack/platform/plugins/private/reporting/server/features.ts # x-pack/platform/plugins/shared/features/server/__snapshots__/oss_features.test.ts.snap # x-pack/platform/test/api_integration/apis/features/features/features.ts # x-pack/test_serverless/api_integration/test_suites/chat/platform_security/authorization.ts # x-pack/test_serverless/api_integration/test_suites/observability/platform_security/authorization.ts # x-pack/test_serverless/api_integration/test_suites/search/platform_security/authorization.ts # x-pack/test_serverless/api_integration/test_suites/security/platform_security/authorization.ts
# Backport This will backport the following commits from `main` to `8.19`: - [[Response Ops][Reporting] Scheduled Reports (#221028)](#221028) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Ying Mao","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-06-19T13:20:18Z","message":"[Response Ops][Reporting] Scheduled Reports (#221028)\n\nResolves https://github.com/elastic/kibana/issues/216313\n\n## Summary\n\nThis is a feature branch that contains the following commits. Each\nindividual linked PR contains a summary and verification instructions.\n\n* Schedule API - https://github.com/elastic/kibana/pull/219771\n* Scheduled report task runner -\nhttps://github.com//pull/219770\n* List and disable API - https://github.com/elastic/kibana/pull/220922\n* Audit logging - https://github.com/elastic/kibana/pull/221846\n* Send scheduled report emails -\nhttps://github.com//pull/220539\n* Commit to check license -\nhttps://github.com//pull/221028/commits/f5f9d9daedcd18447b6a02335a53631a44413788\n* Update to list API response format -\nhttps://github.com//pull/224262\n\n---------\n\nCo-authored-by: Ersin Erdal <[email protected]>\nCo-authored-by: kibanamachine <[email protected]>\nCo-authored-by: Ersin Erdal <[email protected]>\nCo-authored-by: Elastic Machine <[email protected]>\nCo-authored-by: Alexi Doak <[email protected]>","sha":"a409627765dfaf3d588c35a0d510b8d1857cd266","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:ResponseOps","release_note:feature","ci:cloud-deploy","ci:cloud-persist-deployment","Feature:Reporting:Framework","backport:version","v9.1.0","v8.19.0"],"title":"[Response Ops][Reporting] Scheduled Reports","number":221028,"url":"https://github.com/elastic/kibana/pull/221028","mergeCommit":{"message":"[Response Ops][Reporting] Scheduled Reports (#221028)\n\nResolves https://github.com/elastic/kibana/issues/216313\n\n## Summary\n\nThis is a feature branch that contains the following commits. Each\nindividual linked PR contains a summary and verification instructions.\n\n* Schedule API - https://github.com/elastic/kibana/pull/219771\n* Scheduled report task runner -\nhttps://github.com//pull/219770\n* List and disable API - https://github.com/elastic/kibana/pull/220922\n* Audit logging - https://github.com/elastic/kibana/pull/221846\n* Send scheduled report emails -\nhttps://github.com//pull/220539\n* Commit to check license -\nhttps://github.com//pull/221028/commits/f5f9d9daedcd18447b6a02335a53631a44413788\n* Update to list API response format -\nhttps://github.com//pull/224262\n\n---------\n\nCo-authored-by: Ersin Erdal <[email protected]>\nCo-authored-by: kibanamachine <[email protected]>\nCo-authored-by: Ersin Erdal <[email protected]>\nCo-authored-by: Elastic Machine <[email protected]>\nCo-authored-by: Alexi Doak <[email protected]>","sha":"a409627765dfaf3d588c35a0d510b8d1857cd266"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/221028","number":221028,"mergeCommit":{"message":"[Response Ops][Reporting] Scheduled Reports (#221028)\n\nResolves https://github.com/elastic/kibana/issues/216313\n\n## Summary\n\nThis is a feature branch that contains the following commits. Each\nindividual linked PR contains a summary and verification instructions.\n\n* Schedule API - https://github.com/elastic/kibana/pull/219771\n* Scheduled report task runner -\nhttps://github.com//pull/219770\n* List and disable API - https://github.com/elastic/kibana/pull/220922\n* Audit logging - https://github.com/elastic/kibana/pull/221846\n* Send scheduled report emails -\nhttps://github.com//pull/220539\n* Commit to check license -\nhttps://github.com//pull/221028/commits/f5f9d9daedcd18447b6a02335a53631a44413788\n* Update to list API response format -\nhttps://github.com//pull/224262\n\n---------\n\nCo-authored-by: Ersin Erdal <[email protected]>\nCo-authored-by: kibanamachine <[email protected]>\nCo-authored-by: Ersin Erdal <[email protected]>\nCo-authored-by: Elastic Machine <[email protected]>\nCo-authored-by: Alexi Doak <[email protected]>","sha":"a409627765dfaf3d588c35a0d510b8d1857cd266"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
Towards #216313
Note
This PR will be merged into a feature branch
Summary
This PR adds the
scheduled_reporttask, which generates reports on a recurring cadence.report:executetask, so only one of either task type can run at a timeReportSourcedocument in the.kibana-reportingindex that stores the final base64 encoded generated output. ThisReportSourcematches the data model of existing reports with the addition of ascheduled_report_idfield which links to the scheduled report saved object ID.Verify
Note, the UI has not been updated to differentiate between scheduled and single run reports. They will look the same from in the report listing, except the scheduled report will have a timestamp appended to the report name.
In the cloud deployment for this PR, we have an example scheduled report that is running every day at 4:45 EDT: https://kibana-pr-219770.kb.us-west2.gcp.elastic-cloud.com/app/management/insightsAndAlerting/reporting