-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Reporting] Track retryAt and startedAt times on the task instance #174409
[Reporting] Track retryAt and startedAt times on the task instance #174409
Conversation
22c1bfc
to
742e20f
Compare
/ci |
ab82ea1
to
ce7307f
Compare
ce7307f
to
5773365
Compare
5773365
to
9c5ec58
Compare
@@ -122,9 +119,12 @@ export class PngExportType extends ExportType<JobParamsPNGV2, TaskPayloadPNGV2> | |||
return this.startDeps | |||
.screenshotting!.getScreenshots({ | |||
format: 'png', | |||
browserTimezone: payload.browserTimezone, |
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.
Oops! browserTimezone
was not being passed before. That could have caused PNG reports showing date values formatted in the timezone of the Kibana server rather than the end user client. It doesn't seem to be a previosly known issue.
…tsullivan/kibana into reporting-taskinstance-retryat-tracking
@@ -38,6 +43,7 @@ export type CreateJobFn<JobParamsType = BaseParams, JobPayloadType = BasePayload | |||
export type RunTaskFn<TaskPayloadType = BasePayload> = ( | |||
jobId: string, | |||
payload: TaskPayloadType, | |||
taskInstanceFields: TaskInstanceFields, |
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.
To make the task lifecycle timing information available to the run task functions, I just added this new parameter to for all Run Task functions.
@@ -108,9 +108,11 @@ export class CsvSearchSourceImmediateExportType extends ExportType< | |||
}; | |||
const cancellationToken = new CancellationToken(); | |||
const csvConfig = this.config.csv; | |||
const taskInstanceFields = { startedAt: null, retryAt: null }; |
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.
Here is another example of why the "immediate" CSV export type doesn't fit well into the reporting framework: getting the export available to download immediately doesn't go through Task Manager.
Related: #164104
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, I left couple of questions that's mostly nits
@@ -430,7 +431,7 @@ export class ExecuteReportTask implements ReportingTask { | |||
eventLog.logExecutionStart(); | |||
|
|||
const output = await Promise.race<TaskRunResult>([ | |||
this._performJob(task, cancellationToken, stream), | |||
this._performJob(task, taskInstance, cancellationToken, stream), |
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.
should we pass just the properties we defined for the TaskInstanceFields
type instead of the whole taskInstanceField object received from the task manager?
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.
Thanks! a4b5189
/** | ||
* Timestamp metrics about a running screenshot task | ||
* which determine the maximum timeouts possible | ||
*/ | ||
export interface TaskInstanceFields { | ||
/** | ||
* The date and time that this task started execution. This is used to determine | ||
* the "real" runAt that ended up running the task. This value is only set | ||
* when status is set to "running". | ||
*/ | ||
startedAt: Date | null; | ||
|
||
/** | ||
* The date and time that this task should re-execute if stuck in "running" / timeout | ||
* status. This value is only set when status is set to "running". | ||
*/ | ||
retryAt: Date | null; | ||
} |
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.
nit: I think we can create the same type definition we have here https://github.com/elastic/kibana/pull/174409/files#diff-f4342d4c59ca76e69910849e6c0b35157d2c4cb0da0d7bc91fd632720ab2c0e0 that selects from ConcreteTaskInstance
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.
…tsullivan/kibana into reporting-taskinstance-retryat-tracking
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
Unknown metric groupsAPI count
History
To update your PR or re-run it, just comment with: |
## Summary Initial part of elastic#131852 This PR moves towards auto-calculating the maximum timeouts calculated based on the timing context provided by the running task instance. ### Other changes * Added an optional logger parameter to the `getScreenshots` function. When a logger is provided, the logs created by the screenshot plugin will have the contextual tags added by the calling code. * Before <img width="1198" alt="image" src="https://github.com/elastic/kibana/assets/908371/f68a102e-6af2-4863-aedb-52f1e4a099d8"> * After <img width="1200" alt="image" src="https://github.com/elastic/kibana/assets/908371/2dd4c947-ffa6-4cb3-b8a2-22893f49ddb7"> * Fixed an unreported bug where browser timezone was not utilized in PNG reports. ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
Summary
Initial part of #131852
This PR moves towards auto-calculating the maximum timeouts calculated based on the timing context provided by the running task instance.
Other changes
Added an optional logger parameter to the
getScreenshots
function. When a logger is provided, the logs created by the screenshot plugin will have the contextual tags added by the calling code.Fixed an unreported bug where browser timezone was not utilized in PNG reports.
Checklist
Delete any items that are not applicable to this PR.