Skip to content

Commit

Permalink
Address various telemetry issues
Browse files Browse the repository at this point in the history
- index: fixed per elastic#43673
- add schema and generate json per elastic#64942
  • Loading branch information
cee-chen committed Jul 2, 2020
1 parent 49aa734 commit 64bcf9b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {
} from 'src/core/server';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';

import { AS_TELEMETRY_NAME, ITelemetrySavedObject } from '../../saved_objects/app_search/telemetry';
import {
AS_TELEMETRY_NAME,
ITelemetrySavedObject,
appSearchTelemetrySchema,
} from '../../saved_objects/app_search/telemetry';

/**
* Register the telemetry collector
Expand All @@ -22,10 +26,11 @@ export const registerTelemetryUsageCollector = (
usageCollection: UsageCollectionSetup,
savedObjects: SavedObjectsServiceStart
) => {
const telemetryUsageCollector = usageCollection.makeUsageCollector({
const telemetryUsageCollector = usageCollection.makeUsageCollector<ITelemetrySavedObject>({
type: 'app_search',
fetch: async () => fetchTelemetryMetrics(savedObjects),
isReady: () => true,
schema: appSearchTelemetrySchema,
});
usageCollection.registerCollector(telemetryUsageCollector);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ export interface ITelemetrySavedObject {
};
}

export const appSearchTelemetrySchema = {
ui_viewed: {
setup_guide: { type: 'long' },
engines_overview: { type: 'long' },
},
ui_error: {
cannot_connect: { type: 'long' },
no_as_account: { type: 'long' },
},
ui_clicked: {
create_first_engine_button: { type: 'long' },
header_launch_button: { type: 'long' },
engine_table_link: { type: 'long' },
},
};

export const appSearchTelemetryType: SavedObjectsType = {
name: AS_TELEMETRY_NAME,
hidden: false,
Expand All @@ -35,10 +51,12 @@ export const appSearchTelemetryType: SavedObjectsType = {
setup_guide: {
type: 'long',
null_value: 0,
index: false,
},
engines_overview: {
type: 'long',
null_value: 0,
index: false,
},
},
},
Expand All @@ -47,10 +65,12 @@ export const appSearchTelemetryType: SavedObjectsType = {
cannot_connect: {
type: 'long',
null_value: 0,
index: false,
},
no_as_account: {
type: 'long',
null_value: 0,
index: false,
},
},
},
Expand All @@ -59,14 +79,17 @@ export const appSearchTelemetryType: SavedObjectsType = {
create_first_engine_button: {
type: 'long',
null_value: 0,
index: false,
},
header_launch_button: {
type: 'long',
null_value: 0,
index: false,
},
engine_table_link: {
type: 'long',
null_value: 0,
index: false,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,43 @@
}
}
},
"app_search": {
"properties": {
"ui_viewed": {
"properties": {
"setup_guide": {
"type": "long"
},
"engines_overview": {
"type": "long"
}
}
},
"ui_error": {
"properties": {
"cannot_connect": {
"type": "long"
},
"no_as_account": {
"type": "long"
}
}
},
"ui_clicked": {
"properties": {
"create_first_engine_button": {
"type": "long"
},
"header_launch_button": {
"type": "long"
},
"engine_table_link": {
"type": "long"
}
}
}
}
},
"fileUploadTelemetry": {
"properties": {
"filesUploadedTotalCount": {
Expand Down

0 comments on commit 64bcf9b

Please sign in to comment.