-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Migrate kql telemetry and scripts api #52651
Changes from all commits
a2b96f2
63737e1
3937a1d
a76d9e8
1e86e4d
69522fd
a619203
c82de3c
4f8a55f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import moment from 'moment-timezone'; | ||
import numeralLanguages from '@elastic/numeral/languages'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { DEFAULT_QUERY_LANGUAGE } from '../../../plugins/data/common'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should import from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is used on the server, so importing from |
||
|
||
export function getUiSettingDefaults() { | ||
const weekdays = moment.weekdays().slice(); | ||
|
@@ -121,7 +122,7 @@ export function getUiSettingDefaults() { | |
}, | ||
'search:queryLanguage': { | ||
name: queryLanguageSettingName, | ||
value: 'kuery', | ||
value: DEFAULT_QUERY_LANGUAGE, | ||
description: i18n.translate('kbn.advancedSettings.searchQueryLanguageText', { | ||
defaultMessage: | ||
'Query language used by the query bar. KQL is a new language built specifically for Kibana.', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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 { first } from 'rxjs/operators'; | ||
import { CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server'; | ||
import { registerKqlTelemetryRoute } from './route'; | ||
import { UsageCollectionSetup } from '../../../usage_collection/server'; | ||
import { makeKQLUsageCollector } from './usage_collector'; | ||
|
||
export class KqlTelemetryService implements Plugin<void> { | ||
constructor(private initializerContext: PluginInitializerContext) {} | ||
|
||
public setup( | ||
{ http, savedObjects }: CoreSetup, | ||
{ usageCollection }: { usageCollection?: UsageCollectionSetup } | ||
) { | ||
registerKqlTelemetryRoute( | ||
http.createRouter(), | ||
savedObjects, | ||
this.initializerContext.logger.get('data', 'kql-telemetry') | ||
); | ||
|
||
if (usageCollection) { | ||
this.initializerContext.config.legacy.globalConfig$ | ||
.pipe(first()) | ||
.toPromise() | ||
.then(config => makeKQLUsageCollector(usageCollection, config.kibana.index)) | ||
.catch(e => { | ||
this.initializerContext.logger | ||
.get('kql-telemetry') | ||
.warn(`Registering KQL telemetry collector failed: ${e}`); | ||
}); | ||
} | ||
} | ||
|
||
public start() {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshdover These are the strange core API changes this PR introduces.