forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps][Telemetry] Migrate Maps telemetry to NP (elastic#55055)
* Move maps telemetry to NP. Some clean-up, some ts conversion * Update naming & org to be more in-line with guidelines * Get TELEMETRY_TYPE from constants * Ignore ts error importing from js file * Set original array type passed into the function to array of ILayerTypeCount. Set return type on reduce function * Remove unneeded 'any' types where used. Add in interfaces for map & index pattern saved objects * Review feedback. Add layer, source, map saved object types and use * Review feedback. Updates based on type check Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
7759c74
commit 6b96036
Showing
8 changed files
with
154 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IFieldType } from '../../../../../src/plugins/data/common/index_patterns/fields'; | ||
|
||
export interface ISourceDescriptor { | ||
id: string; | ||
type: string; | ||
} | ||
|
||
export interface ILayerDescriptor { | ||
sourceDescriptor: ISourceDescriptor; | ||
id: string; | ||
} |
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
30 changes: 30 additions & 0 deletions
30
x-pack/legacy/plugins/maps/server/maps_telemetry/collectors/register.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,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; | ||
// @ts-ignore | ||
import { SavedObjectsClientContract } from 'src/core/server'; | ||
import { getMapsTelemetry } from '../maps_telemetry'; | ||
// @ts-ignore | ||
import { TELEMETRY_TYPE } from '../../../common/constants'; | ||
|
||
export function registerMapsUsageCollector( | ||
usageCollection: UsageCollectionSetup, | ||
savedObjectsClient: SavedObjectsClientContract, | ||
config: Function | ||
): void { | ||
if (!usageCollection) { | ||
return; | ||
} | ||
|
||
const mapsUsageCollector = usageCollection.makeUsageCollector({ | ||
type: TELEMETRY_TYPE, | ||
isReady: () => true, | ||
fetch: async () => await getMapsTelemetry(savedObjectsClient, config), | ||
}); | ||
|
||
usageCollection.registerCollector(mapsUsageCollector); | ||
} |
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 was deleted.
Oops, something went wrong.
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
22 changes: 0 additions & 22 deletions
22
x-pack/legacy/plugins/maps/server/maps_telemetry/maps_usage_collector.js
This file was deleted.
Oops, something went wrong.
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