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] [Reporting] Abstract reports storage (#106821) #107688

Merged
merged 1 commit into from
Aug 4, 2021
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
14 changes: 5 additions & 9 deletions x-pack/plugins/reporting/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface ReportDocumentHead {
_primary_term: number;
}

export interface TaskRunResult {
export interface ReportOutput {
content_type: string | null;
content: string | null;
size: number;
Expand All @@ -53,6 +53,8 @@ export interface TaskRunResult {
warnings?: string[];
}

export type TaskRunResult = Omit<ReportOutput, 'content'>;

export interface ReportSource {
/*
* Required fields: populated in enqueue_job when the request comes in to
Expand All @@ -73,7 +75,7 @@ export interface ReportSource {
/*
* `output` is only populated if the report job is completed or failed.
*/
output: TaskRunResult | null;
output: ReportOutput | null;

/*
* Optional fields: populated when the job is claimed to execute, and after
Expand Down Expand Up @@ -122,20 +124,14 @@ export type JobStatus =
| 'processing' // Report job has been claimed and is executing
| 'failed'; // Report was not successful, and all retries are done. Nothing to download.

// payload for retrieving the error message of a failed job
export interface JobContent {
content: TaskRunResult['content'];
content_type: false;
}

/*
* Info API response: to avoid unnecessary large payloads on a network, the
* report query results do not include `payload.headers` or `output.content`,
* which can be long strings of meaningless text
*/
interface ReportSimple extends Omit<ReportSource, 'payload' | 'output'> {
payload: Omit<ReportSource['payload'], 'headers'>;
output?: Omit<TaskRunResult, 'content'>; // is undefined for report jobs that are not completed
output?: Omit<ReportOutput, 'content'>; // is undefined for report jobs that are not completed
}

/*
Expand Down
Loading