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
3 changes: 2 additions & 1 deletion packages/kbn-telemetry-tools/src/cli/run_telemetry_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export function runTelemetryCheck() {
},
{
title: 'Checking Matching collector.schema against stored json files',
task: (context) => new Listr(checkMatchingSchemasTask(context), { exitOnError: true }),
task: (context) =>
new Listr(checkMatchingSchemasTask(context, !fix), { exitOnError: true }),
},
{
enabled: (_) => fix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { TaskContext } from './task_context';
import { checkMatchingMapping } from '../check_collector_integrity';
import { readFileAsync } from '../utils';

export function checkMatchingSchemasTask({ roots }: TaskContext) {
export function checkMatchingSchemasTask({ roots }: TaskContext, throwOnDiff: boolean) {
return roots.map((root) => ({
task: async () => {
const fullPath = path.resolve(process.cwd(), root.config.output);
Expand All @@ -31,8 +31,16 @@ export function checkMatchingSchemasTask({ roots }: TaskContext) {

if (root.parsedCollections) {
const differences = checkMatchingMapping(root.parsedCollections, esMapping);

root.esMappingDiffs = Object.keys(differences);
if (root.esMappingDiffs.length && throwOnDiff) {
throw Error(
`The following changes must be persisted in ${fullPath} file. Use '--fix' to update.\n${JSON.stringify(
differences,
null,
2
)}`
);
}
Comment on lines +35 to +43
Copy link
Member

Choose a reason for hiding this comment

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

I've got the same question as in #75747 (comment): Are devs in charge of running these changes themselves (maintaining the merged-schemas JSON files) and we simply accept them? Or are we supposed to run the extract after FF to see all the changes at once?

Copy link
Member Author

Choose a reason for hiding this comment

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

Devs run the --fix to update the json files, and we approve them since we are the owners of that file. After FF we run the extract to grab json file to see all the additions between releases similiar to what we do with i18n.

Copy link
Member

Choose a reason for hiding this comment

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

Does extract generate another JSON file? I thought it was the same one. But it that's the intended process. LGTM 👍

}
},
title: `Checking in ${root.config.root}`,
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@
}
}
},
"csp": {
"properties": {
"strict": {
"type": "boolean"
},
"warnLegacyBrowsers": {
"type": "boolean"
},
"rulesChangedFromDefault": {
"type": "boolean"
}
}
},
"telemetry": {
"properties": {
"opt_in_status": {
Expand Down