Skip to content

Commit

Permalink
Migrate kql_telemetry saved object registration to Kibana platform
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 22, 2020
1 parent aecd00f commit 1c9d84b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ export default function(kibana) {
'sample-data-telemetry': {
isNamespaceAgnostic: true,
},
'kql-telemetry': {
isNamespaceAgnostic: true,
},
},

injectDefaultVars(server, options) {
Expand Down
10 changes: 0 additions & 10 deletions src/legacy/core_plugins/kibana/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@
}
}
},
"kql-telemetry": {
"properties": {
"optInCount": {
"type": "long"
},
"optOutCount": {
"type": "long"
}
}
},
"sample-data-telemetry": {
"properties": {
"installCount": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
export { searchSavedObjectType } from './search';
export { querySavedObjectType } from './query';
export { indexPatternSavedObjectType } from './index_patterns';
export { kqlTelemetry } from './kql_telementry';
35 changes: 35 additions & 0 deletions src/plugins/data/server/saved_objects/kql_telementry.ts
Original file line number Diff line number Diff line change
@@ -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',
},
},
},
};

0 comments on commit 1c9d84b

Please sign in to comment.