Skip to content

Commit

Permalink
[Maps] Remove extra layer of telemetry nesting under "attributes" (#6…
Browse files Browse the repository at this point in the history
…6137)

* 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
  • Loading branch information
Aaron Caldwell authored Jun 23, 2020
1 parent 200957b commit c87b00d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down
13 changes: 2 additions & 11 deletions x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 });
}
7 changes: 4 additions & 3 deletions x-pack/test/api_integration/apis/telemetry/telemetry_local.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit c87b00d

Please sign in to comment.