-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] Track actions in the UI by time #47919
Changes from 16 commits
a832b1e
8c818e4
5281cbd
bf26faa
5c7fdb7
e8e2b70
1fcce38
8a2dce4
c4c5639
e9590e8
bbe16fa
b75ca97
863f329
7dc94b8
2a60204
6c24d16
f1a1399
fd1f6d6
2a28500
16ebf6c
4da50b3
b5d54a7
5ef055f
1836ed1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_reac | |
import { Document, SavedObjectStore } from '../persistence'; | ||
import { EditorFrameInstance } from '../types'; | ||
import { NativeRenderer } from '../native_renderer'; | ||
import { trackUiEvent } from '../lens_ui_telemetry'; | ||
|
||
interface State { | ||
isLoading: boolean; | ||
|
@@ -84,6 +85,8 @@ export function App({ | |
const subscription = dataShim.filter.filterManager.getUpdates$().subscribe({ | ||
next: () => { | ||
setState(s => ({ ...s, filters: dataShim.filter.filterManager.getFilters() })); | ||
|
||
trackUiEvent('app_filters_updated'); | ||
}, | ||
}); | ||
return () => { | ||
|
@@ -198,6 +201,7 @@ export function App({ | |
} | ||
}) | ||
.catch(() => { | ||
trackUiEvent('save_failed'); | ||
core.notifications.toasts.addDanger( | ||
i18n.translate('xpack.lens.editorFrame.docSavingError', { | ||
defaultMessage: 'Error saving document', | ||
|
@@ -214,6 +218,16 @@ export function App({ | |
screenTitle={'lens'} | ||
onQuerySubmit={payload => { | ||
const { dateRange, query } = payload; | ||
|
||
if ( | ||
dateRange.from !== state.dateRange.fromDate || | ||
dateRange.to !== state.dateRange.toDate | ||
) { | ||
trackUiEvent('app_date_change'); | ||
} else { | ||
trackUiEvent('app_query_change'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this actually interesting? I'm not sure it's worth collecting, as I expect it to be just super noisy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could combine this with filter changes, but I do think it's interesting |
||
} | ||
|
||
setState(s => ({ | ||
...s, | ||
dateRange: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,12 @@ import { | |
} from '../datatable_visualization_plugin'; | ||
import { App } from './app'; | ||
import { EditorFrameInstance } from '../types'; | ||
import { | ||
LensReportManager, | ||
setReportManager, | ||
stopReportManager, | ||
trackUiEvent, | ||
} from '../lens_ui_telemetry'; | ||
|
||
export interface LensPluginStartDependencies { | ||
data: DataPublicPluginStart; | ||
|
@@ -63,7 +69,19 @@ export class AppPlugin { | |
|
||
this.instance = editorFrameStartInterface.createInstance({}); | ||
|
||
// Sets it in memory for future click tracking | ||
// If there was any previous manager set, clear it | ||
stopReportManager(); | ||
setReportManager( | ||
wylieconlon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
new LensReportManager({ | ||
storage: new Storage(localStorage), | ||
basePath: core.http.basePath.get(), | ||
http: core.http, | ||
}) | ||
); | ||
|
||
const renderEditor = (routeProps: RouteComponentProps<{ id?: string }>) => { | ||
trackUiEvent('loaded'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this worth tracking? Maybe. 404 certainly is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't track some kind of |
||
return ( | ||
<App | ||
core={core} | ||
|
@@ -85,6 +103,7 @@ export class AppPlugin { | |
}; | ||
|
||
function NotFound() { | ||
trackUiEvent('loaded_404'); | ||
return <FormattedMessage id="xpack.lens.app404" defaultMessage="404 Not Found" />; | ||
} | ||
|
||
|
@@ -106,6 +125,8 @@ export class AppPlugin { | |
this.instance.unmount(); | ||
} | ||
|
||
stopReportManager(); | ||
|
||
// TODO this will be handled by the plugin platform itself | ||
indexPatternDatasourceStop(); | ||
xyVisualizationStop(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ import { getSuggestions, switchToSuggestion } from './suggestion_helpers'; | |
import { ExpressionRenderer } from '../../../../../../../src/legacy/core_plugins/expressions/public'; | ||
import { prependDatasourceExpression, prependKibanaContext } from './expression_helpers'; | ||
import { debouncedComponent } from '../../debounced_component'; | ||
import { trackUiEvent, trackSuggestionEvent } from '../../lens_ui_telemetry'; | ||
|
||
const MAX_SUGGESTIONS_DISPLAYED = 5; | ||
|
||
|
@@ -227,6 +228,7 @@ export function SuggestionPanel({ | |
|
||
function rollbackToCurrentVisualization() { | ||
if (lastSelectedSuggestion !== -1) { | ||
trackSuggestionEvent('back_to_current'); | ||
setLastSelectedSuggestion(-1); | ||
dispatch({ | ||
type: 'ROLLBACK_SUGGESTION', | ||
|
@@ -261,6 +263,7 @@ export function SuggestionPanel({ | |
data-test-subj="lensSubmitSuggestion" | ||
size="xs" | ||
onClick={() => { | ||
trackUiEvent('suggestion_confirmed'); | ||
dispatch({ | ||
type: 'SUBMIT_SUGGESTION', | ||
}); | ||
|
@@ -307,9 +310,11 @@ export function SuggestionPanel({ | |
ExpressionRenderer={ExpressionRendererComponent} | ||
key={index} | ||
onSelect={() => { | ||
trackUiEvent('suggestion_clicked'); | ||
if (lastSelectedSuggestion === index) { | ||
rollbackToCurrentVisualization(); | ||
} else { | ||
trackSuggestionEvent(`index_${index}_of_${suggestions.length}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why it's a different function call- Raya wanted to track the position of suggestions. I'll rename to |
||
setLastSelectedSuggestion(index); | ||
switchToSuggestion(frame, dispatch, suggestion); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ import { FieldSelect } from './field_select'; | |
import { hasField } from '../utils'; | ||
import { BucketNestingEditor } from './bucket_nesting_editor'; | ||
import { IndexPattern, IndexPatternField } from '../types'; | ||
import { trackUiEvent } from '../../lens_ui_telemetry'; | ||
|
||
const operationPanels = getOperationDisplay(); | ||
|
||
|
@@ -162,10 +163,12 @@ export function PopoverEditor(props: PopoverEditorProps) { | |
} else { | ||
setInvalidOperationType(operationType); | ||
} | ||
trackUiEvent(`indexpattern_dimension_operation_${operationType}`); | ||
return; | ||
} | ||
if (!compatibleWithCurrentField) { | ||
setInvalidOperationType(operationType); | ||
trackUiEvent(`indexpattern_dimension_operation_${operationType}`); | ||
return; | ||
} | ||
if (incompatibleSelectedOperationType) { | ||
|
@@ -182,6 +185,9 @@ export function PopoverEditor(props: PopoverEditorProps) { | |
indexPattern: currentIndexPattern, | ||
field: hasField(selectedColumn) ? fieldMap[selectedColumn.sourceField] : undefined, | ||
}); | ||
trackUiEvent( | ||
`indexpattern_dimension_operation_from_${selectedColumn.operationType}_to_${operationType}` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, but I do wonder if we'd benefit from some systematic naming convention?
Not saying that ^^^ should be it, but maybe we should think of one, so we can filter systematically? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might remove the operation tracking, it's not obvious that we can get value from measuring this |
||
); | ||
setState( | ||
changeColumn({ | ||
state, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unfamiliar with this TypeScript signature. TIL