Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test('ScheduledReport should return correctly formatted outputs', () => {
kibanaId: 'instance-uuid',
kibanaName: 'kibana',
queueTimeout: 120000,
spaceId: 'a-space',
scheduledReport: {
id: 'report-so-id-111',
attributes: {
Expand Down Expand Up @@ -81,6 +82,7 @@ test('ScheduledReport should return correctly formatted outputs', () => {
version: '8.0.0',
},
scheduled_report_id: 'report-so-id-111',
space_id: 'a-space',
status: 'processing',
started_at: expect.any(String),
process_expiration: expect.any(String),
Expand All @@ -103,6 +105,7 @@ test('ScheduledReport should return correctly formatted outputs', () => {
status: 'processing',
attempts: 1,
started_at: expect.any(String),
space_id: 'a-space',
migration_version: '7.14.0',
output: {},
queue_time_ms: expect.any(Number),
Expand Down Expand Up @@ -140,6 +143,7 @@ test('ScheduledReport should throw an error if report payload is malformed', ()
references: [],
type: 'scheduled-report',
},
spaceId: 'another-space',
});
};
expect(createInstance).toThrowErrorMatchingInlineSnapshot(
Expand All @@ -154,6 +158,7 @@ test('ScheduledReport should throw an error if scheduled_report saved object is
kibanaId: 'instance-uuid',
kibanaName: 'kibana',
queueTimeout: 120000,
spaceId: 'another-space',
// @ts-expect-error - missing id
scheduledReport: {
attributes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface ConstructorOpts {
kibanaId: string;
kibanaName: string;
queueTimeout: number;
spaceId: string;
scheduledReport: SavedObject<ScheduledReportType>;
}

Expand All @@ -26,7 +27,7 @@ export class ScheduledReport extends Report {
* Create a report from a scheduled_report saved object
*/
constructor(opts: ConstructorOpts) {
const { kibanaId, kibanaName, runAt, scheduledReport, queueTimeout } = opts;
const { kibanaId, kibanaName, runAt, scheduledReport, spaceId, queueTimeout } = opts;
const now = moment.utc();
const startTime = now.toISOString();
const expirationTime = now.add(queueTimeout).toISOString();
Expand Down Expand Up @@ -62,6 +63,7 @@ export class ScheduledReport extends Report {
started_at: startTime,
timeout: queueTimeout,
scheduled_report_id: scheduledReport.id,
space_id: spaceId,
},
{ queue_time_ms: [now.diff(moment.utc(runAt), 'milliseconds')] }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ describe('Run Scheduled Report Task', () => {
kibana_name: 'kibana',
kibana_id: 'instance-uuid',
started_at: expect.any(String),
space_id: 'default',
timeout: 120000,
max_attempts: 1,
process_expiration: expect.any(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class RunScheduledReportTask extends RunReportTask<ScheduledReportTaskPar
kibanaName: this.kibanaName!,
queueTimeout: this.queueTimeout,
scheduledReport,
spaceId: reportSpaceId,
})
);

Expand Down