Skip to content

Commit

Permalink
[Enterprise Search] Add missing Enterprise Search Overview telemetry …
Browse files Browse the repository at this point in the history
…collectors/schema (#81858)

* Add Enterprise Search cannot connect telemetry event

* Add missing server-side telemetry collectors & schema
  • Loading branch information
Constance authored Oct 28, 2020
1 parent ac70e1e commit eb30e95
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import React from 'react';
import { EuiPage, EuiPageContent } from '@elastic/eui';

import { SendEnterpriseSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';
import { ErrorStatePrompt } from '../../../shared/error_state';

export const ErrorConnecting: React.FC = () => (
<EuiPage restrictWidth>
<SendTelemetry action="error" metric="cannot_connect" />
<EuiPageContent>
<ErrorStatePrompt />
</EuiPageContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ describe('Enterprise Search Telemetry Usage Collector', () => {
get: () => ({
attributes: {
'ui_viewed.overview': 10,
'ui_viewed.setup_guide': 5,
'ui_error.cannot_connect': 1,
'ui_clicked.app_search': 2,
'ui_clicked.workplace_search': 3,
},
Expand Down Expand Up @@ -53,6 +55,10 @@ describe('Enterprise Search Telemetry Usage Collector', () => {
expect(savedObjectsCounts).toEqual({
ui_viewed: {
overview: 10,
setup_guide: 5,
},
ui_error: {
cannot_connect: 1,
},
ui_clicked: {
app_search: 2,
Expand All @@ -74,6 +80,10 @@ describe('Enterprise Search Telemetry Usage Collector', () => {
expect(savedObjectsCounts).toEqual({
ui_viewed: {
overview: 0,
setup_guide: 0,
},
ui_error: {
cannot_connect: 0,
},
ui_clicked: {
app_search: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { getSavedObjectAttributesFromRepo } from '../lib/telemetry';
interface ITelemetry {
ui_viewed: {
overview: number;
setup_guide: number;
};
ui_error: {
cannot_connect: number;
};
ui_clicked: {
app_search: number;
Expand All @@ -38,6 +42,10 @@ export const registerTelemetryUsageCollector = (
schema: {
ui_viewed: {
overview: { type: 'long' },
setup_guide: { type: 'long' },
},
ui_error: {
cannot_connect: { type: 'long' },
},
ui_clicked: {
app_search: { type: 'long' },
Expand All @@ -63,6 +71,10 @@ const fetchTelemetryMetrics = async (savedObjects: SavedObjectsServiceStart, log
const defaultTelemetrySavedObject: ITelemetry = {
ui_viewed: {
overview: 0,
setup_guide: 0,
},
ui_error: {
cannot_connect: 0,
},
ui_clicked: {
app_search: 0,
Expand All @@ -78,6 +90,10 @@ const fetchTelemetryMetrics = async (savedObjects: SavedObjectsServiceStart, log
return {
ui_viewed: {
overview: get(savedObjectAttributes, 'ui_viewed.overview', 0),
setup_guide: get(savedObjectAttributes, 'ui_viewed.setup_guide', 0),
},
ui_error: {
cannot_connect: get(savedObjectAttributes, 'ui_error.cannot_connect', 0),
},
ui_clicked: {
app_search: get(savedObjectAttributes, 'ui_clicked.app_search', 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,16 @@
"properties": {
"overview": {
"type": "long"
},
"setup_guide": {
"type": "long"
}
}
},
"ui_error": {
"properties": {
"cannot_connect": {
"type": "long"
}
}
},
Expand Down

0 comments on commit eb30e95

Please sign in to comment.