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

[Reporting] Add warning logs about CSV export type being deprecated #104025

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions x-pack/plugins/reporting/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface ReportSource {
objectType: string;
title: string;
layout?: LayoutParams;
isDeprecated?: boolean;
};
meta: { objectType: string; layout?: string };
browser_type: string;
Expand Down Expand Up @@ -128,6 +129,7 @@ export interface ReportApiJSON {
layout?: LayoutParams;
title: string;
browserTimezone?: string;
isDeprecated?: boolean;
};
meta: {
layout?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const createJobFnFactory: CreateJobFnFactory<
const crypto = cryptoFactory(config.get('encryptionKey'));

return async function createJob(jobParams, context, request) {
logger.warn(
`The "/generate/csv" endpoint is deprecated and will be removed in Kibana 8.0. Please recreate the POST URL used to automate this CSV export.`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: perhaps we could rephrase this as:

This CSV export is deprecated and will be removed in Kibana 8.0. Please recreate the POST URL to continue generating this CSV export. See <docs link with screenshots>.

My concern with the current version is that mentioning an endpoint /generate/csv is a bit too implementation-level detail. WDYT?

Additionally, I think we should wrap this in i18n.translate.

If we can link them to somewhere in the docs that would be A+, but this can definitely be addressed in a follow up PR if you agree!

);
const serializedEncryptedHeaders = await crypto.encrypt(request.headers);

const savedObjectsClient = context.core.savedObjects.client;
Expand All @@ -29,6 +32,7 @@ export const createJobFnFactory: CreateJobFnFactory<
)) as unknown) as IndexPatternSavedObjectDeprecatedCSV;

return {
isDeprecated: true,
headers: serializedEncryptedHeaders,
spaceId: reporting.getSpaceId(request, logger),
indexPatternSavedObject,
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/reporting/server/routes/lib/jobs_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import { UnwrapPromise } from '@kbn/utility-types';
import { i18n } from '@kbn/i18n';
import { ResponseError } from '@elastic/elasticsearch/lib/errors';
import { i18n } from '@kbn/i18n';
import { UnwrapPromise } from '@kbn/utility-types';
import { ElasticsearchClient } from 'src/core/server';
import { ReportingCore } from '../../';
import { ReportDocument } from '../../lib/store';
Expand Down Expand Up @@ -87,6 +87,7 @@ export function jobsQueryFactory(reportingCore: ReportingCore) {
elasticsearchClient.search({ body, index: getIndex() })
);

// FIXME: return the info in ReportApiJSON format;
Copy link
Member Author

@tsullivan tsullivan Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing became clear from updating the API functional tests, the data formats of the Reporting endpoints are inconsistent.

  • "generate" API: returns ReportApiJSON
  • "list" API: returns ReportDocument[]
  • "info" API: returns ReportSource

To make it consistent, all the APIs should return ReportApiJSON format.

The comments are added to this file, which is responsible for handling API requests that query jobs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the FIXMEs are being handled in the next PR: #102833

return response?.body.hits?.hits ?? [];
},

Expand Down Expand Up @@ -139,6 +140,7 @@ export function jobsQueryFactory(reportingCore: ReportingCore) {
return;
}

// FIXME: return the info in ReportApiJSON format;
return response.body.hits.hits[0] as ReportDocument;
},

Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/reporting/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export { BaseParams };
export interface BasePayload extends BaseParams {
headers: string;
spaceId?: string;
isDeprecated?: boolean;
}

// default fn type for CreateJobFnFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('Reporting API Integration Tests with Security disabled', function () {
this.tags('ciGroup13');
loadTestFile(require.resolve('./job_apis'));
loadTestFile(require.resolve('./job_apis_csv'));
loadTestFile(require.resolve('./job_apis_csv_deprecated'));
});
}

This file was deleted.

Loading