Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Oct 2, 2020
1 parent dbee8f9 commit 4de37e2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/core/server/core_usage_data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ export interface CoreUsageDataStart {
* Internal API for collecting Core usage data
* @internal
* */
getCoreUsageData(): CoreUsageData | null;
getCoreUsageData(): CoreUsageData;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
} from '../../../../../core/server/core_usage_data/types';
// telemetry_check is unable to check types which are re-exported, it only
// works when pointed to the typescript file where the type was defined.
import { KIBANA_STATS_TYPE } from '../../../common/constants';

export function getCoreUsageCollector(
usageCollection: UsageCollectionSetup,
Expand Down Expand Up @@ -118,20 +117,6 @@ export function getCoreUsageCollector(
fetch() {
return getCoreUsageDataService().getCoreUsageData();
},

/*
* Format the response data into a model for internal upload
* 1. Make this data part of the "kibana_stats" type
* 2. Organize the payload in the usage namespace of the data payload (usage.index, etc)
*/
formatForBulkUpload: (result) => {
return {
type: KIBANA_STATS_TYPE,
payload: {
core: result,
},
};
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,4 @@ describe('telemetry_core', () => {
test('fetch', async () => {
expect(await collector.fetch(callCluster)).toEqual(getCoreUsageDataReturnValue);
});

test('formatForBulkUpload', async () => {
expect(collector.formatForBulkUpload!(getCoreUsageDataReturnValue)).toStrictEqual({
type: 'kibana_stats',
payload: {
core: getCoreUsageDataReturnValue,
},
});
});
});
4 changes: 2 additions & 2 deletions src/plugins/kibana_usage_collection/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class KibanaUsageCollectionPlugin implements Plugin {
) {
const getSavedObjectsClient = () => this.savedObjectsClient;
const getUiSettingsClient = () => this.uiSettingsClient;
const getcoreUsageData = () => this.coreUsageData!;
const getCoreUsageDataService = () => this.coreUsageData!;

registerOpsStatsCollector(usageCollection, metric$);
registerKibanaUsageCollector(usageCollection, this.legacyConfig$);
Expand All @@ -103,6 +103,6 @@ export class KibanaUsageCollectionPlugin implements Plugin {
getSavedObjectsClient
);
registerCspCollector(usageCollection, coreSetup.http);
registerCoreUsageCollector(usageCollection, getcoreUsageData);
registerCoreUsageCollector(usageCollection, getCoreUsageDataService);
}
}

0 comments on commit 4de37e2

Please sign in to comment.