Migrate kql_telemetry saved object registration to Kibana platform (#64149)
This commit is contained in:
parent
3d78b1bcf9
commit
2d525380fa
5 changed files with 39 additions and 17 deletions
|
@ -128,12 +128,6 @@ export default function(kibana) {
|
|||
},
|
||||
},
|
||||
|
||||
savedObjectSchemas: {
|
||||
'kql-telemetry': {
|
||||
isNamespaceAgnostic: true,
|
||||
},
|
||||
},
|
||||
|
||||
injectDefaultVars(server, options) {
|
||||
const mapConfig = server.config().get('map');
|
||||
const tilemap = mapConfig.tilemap;
|
||||
|
|
|
@ -27,15 +27,5 @@
|
|||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"kql-telemetry": {
|
||||
"properties": {
|
||||
"optInCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"optOutCount": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,14 +22,16 @@ import { CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server';
|
|||
import { registerKqlTelemetryRoute } from './route';
|
||||
import { UsageCollectionSetup } from '../../../usage_collection/server';
|
||||
import { makeKQLUsageCollector } from './usage_collector';
|
||||
import { kqlTelemetry } from '../saved_objects';
|
||||
|
||||
export class KqlTelemetryService implements Plugin<void> {
|
||||
constructor(private initializerContext: PluginInitializerContext) {}
|
||||
|
||||
public setup(
|
||||
{ http, getStartServices }: CoreSetup,
|
||||
{ http, getStartServices, savedObjects }: CoreSetup,
|
||||
{ usageCollection }: { usageCollection?: UsageCollectionSetup }
|
||||
) {
|
||||
savedObjects.registerType(kqlTelemetry);
|
||||
registerKqlTelemetryRoute(
|
||||
http.createRouter(),
|
||||
getStartServices,
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
export { searchSavedObjectType } from './search';
|
||||
export { querySavedObjectType } from './query';
|
||||
export { indexPatternSavedObjectType } from './index_patterns';
|
||||
export { kqlTelemetry } from './kql_telementry';
|
||||
|
|
35
src/plugins/data/server/saved_objects/kql_telementry.ts
Normal file
35
src/plugins/data/server/saved_objects/kql_telementry.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SavedObjectsType } from 'kibana/server';
|
||||
|
||||
export const kqlTelemetry: SavedObjectsType = {
|
||||
name: 'kql-telemetry',
|
||||
namespaceType: 'agnostic',
|
||||
hidden: false,
|
||||
mappings: {
|
||||
properties: {
|
||||
optInCount: {
|
||||
type: 'long',
|
||||
},
|
||||
optOutCount: {
|
||||
type: 'long',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue