[Maps] Remove extra layer of telemetry nesting under "attributes" (#66137)

* Return attributes when telemetry created instead of whole saved object. Update integration test

* Change 'maps-telemetry' to 'maps'

* No need to create a saved object anymore. This is leftover from task manager telemetry mgmt

* Add test confirming attrs undefined. Change tests to check for 'maps' iso 'maps-telemetry'

* Add two more tests confirming expected telemetry shape

* Review feedback. Use TELEMETRY_TYPE constant and set to APP_ID
This commit is contained in:
Aaron Caldwell 2020-06-23 15:33:43 -06:00 committed by GitHub
parent 200957bb63
commit c87b00dc94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 15 deletions

View file

@ -25,7 +25,7 @@ export const EMS_TILES_VECTOR_TILE_PATH = 'vector/tile';
export const MAP_SAVED_OBJECT_TYPE = 'map';
export const APP_ID = 'maps';
export const APP_ICON = 'gisApp';
export const TELEMETRY_TYPE = 'maps-telemetry';
export const TELEMETRY_TYPE = APP_ID;
export const MAP_APP_PATH = `app/${APP_ID}`;
export const GIS_API_PATH = `api/${APP_ID}`;

View file

@ -11,12 +11,7 @@ import {
SavedObjectAttribute,
} from 'kibana/server';
import { IFieldType, IIndexPattern } from 'src/plugins/data/public';
import {
SOURCE_TYPES,
ES_GEO_FIELD_TYPE,
MAP_SAVED_OBJECT_TYPE,
TELEMETRY_TYPE,
} from '../../common/constants';
import { SOURCE_TYPES, ES_GEO_FIELD_TYPE, MAP_SAVED_OBJECT_TYPE } from '../../common/constants';
import { LayerDescriptor } from '../../common/descriptor_types';
import { MapSavedObject } from '../../common/map_saved_object_type';
// @ts-ignore
@ -186,9 +181,5 @@ export async function getMapsTelemetry(config: MapsConfigType) {
const settings: SavedObjectAttribute = {
showMapVisualizationTypes: config.showMapVisualizationTypes,
};
const mapsTelemetry = buildMapsTelemetry({ mapSavedObjects, indexPatternSavedObjects, settings });
return await savedObjectsClient.create(TELEMETRY_TYPE, mapsTelemetry, {
id: TELEMETRY_TYPE,
overwrite: true,
});
return buildMapsTelemetry({ mapSavedObjects, indexPatternSavedObjects, settings });
}

View file

@ -76,9 +76,10 @@ export default function ({ getService }) {
expect(stats.stack_stats.kibana.plugins.apm.services_per_agent).to.be.an('object');
expect(stats.stack_stats.kibana.plugins.infraops.last_24_hours).to.be.an('object');
expect(stats.stack_stats.kibana.plugins.kql.defaultQueryLanguage).to.be.a('string');
expect(stats.stack_stats.kibana.plugins['maps-telemetry'].attributes.timeCaptured).to.be.a(
'string'
);
expect(stats.stack_stats.kibana.plugins.maps.timeCaptured).to.be.a('string');
expect(stats.stack_stats.kibana.plugins.maps.attributes).to.be(undefined);
expect(stats.stack_stats.kibana.plugins.maps.id).to.be(undefined);
expect(stats.stack_stats.kibana.plugins.maps.type).to.be(undefined);
expect(stats.stack_stats.kibana.plugins.reporting.enabled).to.be(true);
expect(stats.stack_stats.kibana.plugins.rollups.index_patterns).to.be.an('object');