-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Report telemetry about autocomplete * error cound * position of selected suggestion * length of query used to generate the suggestions Also added a couple if handly telemetry events: * query language switch * filter bar bulk actions * Fix ts * Report the value suggestions funnel * docs * docs * fix jest * test * code review Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
a54063b
commit a374f14
Showing
22 changed files
with
244 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...public/kibana-plugin-plugins-data-public.idatapluginservices.usagecollection.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [usageCollection](./kibana-plugin-plugins-data-public.idatapluginservices.usagecollection.md) | ||
|
||
## IDataPluginServices.usageCollection property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
usageCollection?: UsageCollectionStart; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/plugins/data/public/autocomplete/collectors/create_usage_collector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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 { first } from 'rxjs/operators'; | ||
import { StartServicesAccessor } from '../../../../../core/public'; | ||
import { METRIC_TYPE, UsageCollectionSetup } from '../../../../usage_collection/public'; | ||
import { AUTOCOMPLETE_EVENT_TYPE, AutocompleteUsageCollector } from './types'; | ||
|
||
export const createUsageCollector = ( | ||
getStartServices: StartServicesAccessor, | ||
usageCollection?: UsageCollectionSetup | ||
): AutocompleteUsageCollector => { | ||
const getCurrentApp = async () => { | ||
const [{ application }] = await getStartServices(); | ||
return application.currentAppId$.pipe(first()).toPromise(); | ||
}; | ||
|
||
return { | ||
trackCall: async () => { | ||
const currentApp = await getCurrentApp(); | ||
return usageCollection?.reportUiCounter( | ||
currentApp!, | ||
METRIC_TYPE.LOADED, | ||
AUTOCOMPLETE_EVENT_TYPE.CALL | ||
); | ||
}, | ||
trackRequest: async () => { | ||
const currentApp = await getCurrentApp(); | ||
return usageCollection?.reportUiCounter( | ||
currentApp!, | ||
METRIC_TYPE.LOADED, | ||
AUTOCOMPLETE_EVENT_TYPE.REQUEST | ||
); | ||
}, | ||
trackResult: async () => { | ||
const currentApp = await getCurrentApp(); | ||
return usageCollection?.reportUiCounter( | ||
currentApp!, | ||
METRIC_TYPE.LOADED, | ||
AUTOCOMPLETE_EVENT_TYPE.RESULT | ||
); | ||
}, | ||
trackError: async () => { | ||
const currentApp = await getCurrentApp(); | ||
return usageCollection?.reportUiCounter( | ||
currentApp!, | ||
METRIC_TYPE.LOADED, | ||
AUTOCOMPLETE_EVENT_TYPE.ERROR | ||
); | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { createUsageCollector } from './create_usage_collector'; | ||
export { AUTOCOMPLETE_EVENT_TYPE, AutocompleteUsageCollector } from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export enum AUTOCOMPLETE_EVENT_TYPE { | ||
CALL = 'autocomplete:call', | ||
REQUEST = 'autocomplete:req', | ||
RESULT = 'autocomplete:res', | ||
ERROR = 'autocomplete:err', | ||
} | ||
|
||
export interface AutocompleteUsageCollector { | ||
trackCall: () => Promise<void>; | ||
trackRequest: () => Promise<void>; | ||
trackResult: () => Promise<void>; | ||
trackError: () => Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.