[Maps] [Telemetry] Track geo_point and geo_shape index patterns separately (#65195)

This commit is contained in:
Thomas Neirynck 2020-05-05 09:23:42 -04:00 committed by GitHub
parent 602d10272a
commit d3ea775619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 5 deletions

View file

@ -36,6 +36,12 @@
"indexPatternsWithGeoFieldCount": {
"type": "long"
},
"indexPatternsWithGeoPointFieldCount": {
"type": "long"
},
"indexPatternsWithGeoShapeFieldCount": {
"type": "long"
},
"mapsTotalCount": {
"type": "long"
},

View file

@ -20,6 +20,8 @@ describe('buildMapsTelemetry', () => {
expect(result).toMatchObject({
indexPatternsWithGeoFieldCount: 0,
indexPatternsWithGeoPointFieldCount: 0,
indexPatternsWithGeoShapeFieldCount: 0,
attributesPerMap: {
dataSourcesCount: {
avg: 0,
@ -45,7 +47,9 @@ describe('buildMapsTelemetry', () => {
const result = buildMapsTelemetry({ mapSavedObjects, indexPatternSavedObjects, settings });
expect(result).toMatchObject({
indexPatternsWithGeoFieldCount: 2,
indexPatternsWithGeoFieldCount: 3,
indexPatternsWithGeoPointFieldCount: 2,
indexPatternsWithGeoShapeFieldCount: 1,
attributesPerMap: {
dataSourcesCount: {
avg: 2.6666666666666665,

View file

@ -61,13 +61,27 @@ function getIndexPatternsWithGeoFieldCount(indexPatterns: IIndexPattern[]) {
? JSON.parse(indexPattern.attributes.fields)
: []
);
const fieldListsWithGeoFields = fieldLists.filter(fields =>
fields.some(
(field: IFieldType) =>
field.type === ES_GEO_FIELD_TYPE.GEO_POINT || field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE
)
);
return fieldListsWithGeoFields.length;
const fieldListsWithGeoPointFields = fieldLists.filter(fields =>
fields.some((field: IFieldType) => field.type === ES_GEO_FIELD_TYPE.GEO_POINT)
);
const fieldListsWithGeoShapeFields = fieldLists.filter(fields =>
fields.some((field: IFieldType) => field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE)
);
return {
indexPatternsWithGeoFieldCount: fieldListsWithGeoFields.length,
indexPatternsWithGeoPointFieldCount: fieldListsWithGeoPointFields.length,
indexPatternsWithGeoShapeFieldCount: fieldListsWithGeoShapeFields.length,
};
}
export function buildMapsTelemetry({
@ -110,12 +124,16 @@ export function buildMapsTelemetry({
const dataSourcesCountSum = _.sum(dataSourcesCount);
const layersCountSum = _.sum(layersCount);
const indexPatternsWithGeoFieldCount = getIndexPatternsWithGeoFieldCount(
indexPatternSavedObjects
);
const {
indexPatternsWithGeoFieldCount,
indexPatternsWithGeoPointFieldCount,
indexPatternsWithGeoShapeFieldCount,
} = getIndexPatternsWithGeoFieldCount(indexPatternSavedObjects);
return {
settings,
indexPatternsWithGeoFieldCount,
indexPatternsWithGeoPointFieldCount,
indexPatternsWithGeoShapeFieldCount,
// Total count of maps
mapsTotalCount: mapsCount,
// Time of capture

View file

@ -28,6 +28,20 @@
"updated_at": "2019-11-19T20:05:37.607Z",
"version": "WzExMSwxXQ=="
},
{
"attributes": {
"fields": "[{\"name\":\"geometry\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
"title": "indexpattern-with-geopoint2"
},
"id": "55d572f0-0b07-11ea-9dd2-95afd7ad44d4",
"migrationVersion": {
"index-pattern": "7.6.0"
},
"references": [],
"type": "index-pattern",
"updated_at": "2019-11-19T20:05:37.607Z",
"version": "WzExMSwxXQ=="
},
{
"attributes": {
"fields": "[{\"name\":\"assessment_date\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"date_exterior_condition\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"recording_date\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"sale_date\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",