Skip to content

Commit

Permalink
[Discover] Add kql-telemetry and search-telementry SO schemas (#154261)
Browse files Browse the repository at this point in the history
## Summary

A follow up for #153131
This PR adds schemas for kql-telemetry and search-telemetry SO types.
  • Loading branch information
jughosta authored Apr 6, 2023
1 parent 9fecb32 commit ec7110d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"ingest-package-policies": "6dc1c9b80a8dc95fbc9c6d9b73dfc56a098eb440",
"ingest_manager_settings": "fb75bff08a8de3435b23664b1191f9244a255701",
"inventory-view": "6d47ef0b38166ecbd1c2fc7394599a4500db1ae4",
"kql-telemetry": "23ed96ff02cd69cbfaa22f313cae3a54c434db51",
"kql-telemetry": "92d6357aa3ce28727492f86a54783f802dc38893",
"legacy-url-alias": "9b8cca3fbb2da46fd12823d3cd38fdf1c9f24bc8",
"lens": "2f6a8231591e3d62a83506b19e165774d74588ea",
"lens-ui-telemetry": "d6c4e330d170eefc6214dbf77a53de913fa3eebc",
Expand All @@ -127,7 +127,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"sample-data-telemetry": "c38daf1a49ed24f2a4fb091e6e1e833fccf19935",
"search": "01bc42d635e9ea0588741c4c7a2bbd3feb3ac5dc",
"search-session": "58a44d14ec991739166b2ec28d718001ab0f4b28",
"search-telemetry": "ab67ef721f294f28d5e10febbd20653347720188",
"search-telemetry": "1bbaf2db531b97fa04399440fa52d46e86d54dd8",
"security-rule": "1ff82dfb2298c3caf6888fc3ef15c6bf7a628877",
"security-solution-signals-migration": "c2db409c1857d330beb3d6fd188fa186f920302c",
"siem-detection-engine-rule-actions": "123c130dc38120a470d8db9fed9a4cebd2046445",
Expand Down
14 changes: 6 additions & 8 deletions src/plugins/data/server/saved_objects/kql_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
*/

import { SavedObjectsType } from '@kbn/core/server';
import { SCHEMA_KQL_TELEMETRY_V8_8_0 } from './schemas/kql_telemetry';

export const kqlTelemetry: SavedObjectsType = {
name: 'kql-telemetry',
namespaceType: 'agnostic',
hidden: false,
mappings: {
properties: {
optInCount: {
type: 'long',
},
optOutCount: {
type: 'long',
},
},
dynamic: false,
properties: {},
},
schemas: {
'8.8.0': SCHEMA_KQL_TELEMETRY_V8_8_0,
},
};
14 changes: 14 additions & 0 deletions src/plugins/data/server/saved_objects/schemas/kql_telemetry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { schema } from '@kbn/config-schema';

export const SCHEMA_KQL_TELEMETRY_V8_8_0 = schema.object({
optInCount: schema.maybe(schema.number()),
optOutCount: schema.maybe(schema.number()),
});
16 changes: 16 additions & 0 deletions src/plugins/data/server/saved_objects/schemas/search_telemetry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { schema } from '@kbn/config-schema';

// As per `CollectedUsage`
export const SCHEMA_SEARCH_TELEMETRY_V8_8_0 = schema.object({
successCount: schema.maybe(schema.number()),
errorCount: schema.maybe(schema.number()),
totalDuration: schema.maybe(schema.number()),
});
4 changes: 4 additions & 0 deletions src/plugins/data/server/saved_objects/search_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { SavedObjectsType } from '@kbn/core/server';
import { migrate712 } from './migrations/to_v7_12_0';
import { SCHEMA_SEARCH_TELEMETRY_V8_8_0 } from './schemas/search_telemetry';

export const searchTelemetry: SavedObjectsType = {
name: 'search-telemetry',
Expand All @@ -20,4 +21,7 @@ export const searchTelemetry: SavedObjectsType = {
migrations: {
'7.12.0': migrate712,
},
schemas: {
'8.8.0': SCHEMA_SEARCH_TELEMETRY_V8_8_0,
},
};

0 comments on commit ec7110d

Please sign in to comment.