[Maps] Add grid-resolution telemetry (#99808) (#100342)

Co-authored-by: Thomas Neirynck <thomas@elastic.co>
This commit is contained in:
Kibana Machine 2021-05-19 13:34:01 -04:00 committed by GitHub
parent c6639e2cba
commit 714bd3b7b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 250 additions and 1 deletions

View file

@ -275,6 +275,88 @@ export function registerMapsUsageCollector(
},
},
},
resolutions: {
coarse: {
min: {
type: 'long',
_meta: { description: 'min number of grid-agg layers with coarse resolution' },
},
max: {
type: 'long',
_meta: { description: 'max number of grid-agg layers with coarse resolution' },
},
avg: {
type: 'float',
_meta: { description: 'avg number of grid-agg layers with coarse resolution' },
},
total: {
type: 'long',
_meta: {
description: 'total number of grid-agg layers with coarse resolution',
},
},
},
fine: {
min: {
type: 'long',
_meta: { description: 'min number of grid-agg layers with fine resolution' },
},
max: {
type: 'long',
_meta: { description: 'max number of grid-agg layers with fine resolution' },
},
avg: {
type: 'float',
_meta: { description: 'avg number of grid-agg layers with fine resolution' },
},
total: {
type: 'long',
_meta: {
description: 'total number of grid-agg layers with fine resolution',
},
},
},
most_fine: {
min: {
type: 'long',
_meta: { description: 'min number of grid-agg layers with most_fine resolution' },
},
max: {
type: 'long',
_meta: { description: 'max number of grid-agg layers with most_fine resolution' },
},
avg: {
type: 'float',
_meta: { description: 'avg number of grid-agg layers with most_fine resolution' },
},
total: {
type: 'long',
_meta: {
description: 'total number of grid-agg layers with most_fine resolution',
},
},
},
super_fine: {
min: {
type: 'long',
_meta: { description: 'min number of grid-agg layers with super_fine resolution' },
},
max: {
type: 'long',
_meta: { description: 'max number of grid-agg layers with super_fine resolution' },
},
avg: {
type: 'float',
_meta: { description: 'avg number of grid-agg layers with super_fine resolution' },
},
total: {
type: 'long',
_meta: {
description: 'total number of grid-agg layers with super_fine resolution',
},
},
},
},
joins: {
term: {
min: {

View file

@ -27,10 +27,12 @@ import { MapsConfigType } from '../../config';
import { injectReferences } from '././../../common/migrations/references';
import {
getBaseMapsPerCluster,
getGridResolutionsPerCluster,
getScalingOptionsPerCluster,
getTelemetryLayerTypesPerCluster,
getTermJoinsPerCluster,
TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER,
TELEMETRY_GRID_RESOLUTION_COUNTS_PER_CLUSTER,
TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER,
TELEMETRY_SCALING_OPTION_COUNTS_PER_CLUSTER,
TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER,
@ -66,6 +68,7 @@ export interface LayersStatsUsage {
scalingOptions: TELEMETRY_SCALING_OPTION_COUNTS_PER_CLUSTER;
joins: TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER;
basemaps: TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER;
resolutions: TELEMETRY_GRID_RESOLUTION_COUNTS_PER_CLUSTER;
attributesPerMap: {
dataSourcesCount: {
min: number;
@ -264,6 +267,7 @@ export function buildMapsSavedObjectsTelemetry(layerLists: LayerDescriptor[][]):
const scalingOptions = getScalingOptionsPerCluster(layerLists);
const joins = getTermJoinsPerCluster(layerLists);
const basemaps = getBaseMapsPerCluster(layerLists);
const resolutions = getGridResolutionsPerCluster(layerLists);
return {
// Total count of maps
@ -274,6 +278,7 @@ export function buildMapsSavedObjectsTelemetry(layerLists: LayerDescriptor[][]):
scalingOptions,
joins,
basemaps,
resolutions,
attributesPerMap: {
// Count of data sources per map
dataSourcesCount: {

View file

@ -11,7 +11,7 @@ import {
ESSearchSourceDescriptor,
LayerDescriptor,
} from '../../common/descriptor_types';
import { LAYER_TYPE, RENDER_AS, SCALING_TYPES, SOURCE_TYPES } from '../../common';
import { GRID_RESOLUTION, LAYER_TYPE, RENDER_AS, SCALING_TYPES, SOURCE_TYPES } from '../../common';
import {
DEFAULT_EMS_DARKMAP_ID,
DEFAULT_EMS_ROADMAP_DESATURATED_ID,
@ -73,6 +73,16 @@ export interface TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER {
[TELEMETRY_TERM_JOIN]?: ClusterCountStats;
}
export enum TELEMETRY_GRID_RESOLUTION {
COARSE = 'coarse',
FINE = 'fine',
MOST_FINE = 'most_fine',
SUPER_FINE = 'super_fine',
}
export type TELEMETRY_GRID_RESOLUTION_COUNTS_PER_CLUSTER = {
[key in TELEMETRY_GRID_RESOLUTION]?: ClusterCountStats;
};
// These capture a particular "combo" of source and layer-settings.
// They are mutually exclusive (ie. a layerDescriptor can only be a single telemetry_layer_type)
// They are more useful from a telemetry-perspective than:
@ -261,6 +271,42 @@ export function getTermJoinsPerCluster(
});
}
function getGridResolution(layerDescriptor: LayerDescriptor): TELEMETRY_GRID_RESOLUTION | null {
if (
!layerDescriptor.sourceDescriptor ||
layerDescriptor.sourceDescriptor.type !== SOURCE_TYPES.ES_GEO_GRID ||
!(layerDescriptor.sourceDescriptor as ESGeoGridSourceDescriptor).resolution
) {
return null;
}
const descriptor = layerDescriptor.sourceDescriptor as ESGeoGridSourceDescriptor;
if (descriptor.resolution === GRID_RESOLUTION.COARSE) {
return TELEMETRY_GRID_RESOLUTION.COARSE;
}
if (descriptor.resolution === GRID_RESOLUTION.FINE) {
return TELEMETRY_GRID_RESOLUTION.FINE;
}
if (descriptor.resolution === GRID_RESOLUTION.MOST_FINE) {
return TELEMETRY_GRID_RESOLUTION.MOST_FINE;
}
if (descriptor.resolution === GRID_RESOLUTION.SUPER_FINE) {
return TELEMETRY_GRID_RESOLUTION.SUPER_FINE;
}
return null;
}
export function getGridResolutionsPerCluster(
layerLists: LayerDescriptor[][]
): TELEMETRY_GRID_RESOLUTION_COUNTS_PER_CLUSTER {
return getCountsByCluster(layerLists, getGridResolution);
}
export function getBaseMapsPerCluster(
layerLists: LayerDescriptor[][]
): TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER {

View file

@ -3216,6 +3216,122 @@
}
}
},
"resolutions": {
"properties": {
"coarse": {
"properties": {
"min": {
"type": "long",
"_meta": {
"description": "min number of grid-agg layers with coarse resolution"
}
},
"max": {
"type": "long",
"_meta": {
"description": "max number of grid-agg layers with coarse resolution"
}
},
"avg": {
"type": "float",
"_meta": {
"description": "avg number of grid-agg layers with coarse resolution"
}
},
"total": {
"type": "long",
"_meta": {
"description": "total number of grid-agg layers with coarse resolution"
}
}
}
},
"fine": {
"properties": {
"min": {
"type": "long",
"_meta": {
"description": "min number of grid-agg layers with fine resolution"
}
},
"max": {
"type": "long",
"_meta": {
"description": "max number of grid-agg layers with fine resolution"
}
},
"avg": {
"type": "float",
"_meta": {
"description": "avg number of grid-agg layers with fine resolution"
}
},
"total": {
"type": "long",
"_meta": {
"description": "total number of grid-agg layers with fine resolution"
}
}
}
},
"most_fine": {
"properties": {
"min": {
"type": "long",
"_meta": {
"description": "min number of grid-agg layers with most_fine resolution"
}
},
"max": {
"type": "long",
"_meta": {
"description": "max number of grid-agg layers with most_fine resolution"
}
},
"avg": {
"type": "float",
"_meta": {
"description": "avg number of grid-agg layers with most_fine resolution"
}
},
"total": {
"type": "long",
"_meta": {
"description": "total number of grid-agg layers with most_fine resolution"
}
}
}
},
"super_fine": {
"properties": {
"min": {
"type": "long",
"_meta": {
"description": "min number of grid-agg layers with super_fine resolution"
}
},
"max": {
"type": "long",
"_meta": {
"description": "max number of grid-agg layers with super_fine resolution"
}
},
"avg": {
"type": "float",
"_meta": {
"description": "avg number of grid-agg layers with super_fine resolution"
}
},
"total": {
"type": "long",
"_meta": {
"description": "total number of grid-agg layers with super_fine resolution"
}
}
}
}
}
},
"joins": {
"properties": {
"term": {