-
Notifications
You must be signed in to change notification settings - Fork 514
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
Add GA event tracking for actions in trace view #191
Changes from 16 commits
0c9ff94
2321117
45e93aa
11d2f03
1f11a8f
d6bb7e2
a99db35
b1a94a7
8a90112
22a7ac0
263c8ae
dfd9abb
0d4e6dd
6132dd4
7b1cd7a
ce467f4
d749767
b3ea6fb
c60b135
bef6aee
c9673fd
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// @flow | ||
|
||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { trackEvent } from '../../utils/tracking'; | ||
|
||
const context = 'jaeger/ux/trace/kbd-modal'; | ||
|
||
export default function trackKbdHelpModal() { | ||
trackEvent({ | ||
category: context, | ||
action: 'open', | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// @flow | ||
|
||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { trackEvent } from '../../utils/tracking'; | ||
|
||
const altViewCtx = 'jaeger/ux/trace/alt-view'; | ||
export const slimHeaderCtx = 'jaeger/ux/trace/slim-header'; | ||
|
||
export function trackAltView() { | ||
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. Suggestion: 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. 👍 |
||
trackEvent({ | ||
category: altViewCtx, | ||
action: 'open', | ||
}); | ||
} | ||
|
||
export function trackSlimHeader(isOpen: boolean) { | ||
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. Suggestion: 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. 👍 |
||
trackEvent({ | ||
category: slimHeaderCtx, | ||
action: isOpen ? 'open' : 'close', | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// @flow | ||
|
||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import type { Store } from 'redux'; | ||
|
||
import { actionTypes as types } from './duck'; | ||
import { trackEvent } from '../../../utils/tracking'; | ||
|
||
const context = 'jaeger/ux/trace/timeline/parent'; | ||
|
||
function trackParent(store: Store, action: any) { | ||
const st = store.getState(); | ||
const { spanID } = action.payload; | ||
const traceID = st.traceTimeline.traceID; | ||
const isHidden = st.traceTimeline.childrenHiddenIDs.has(spanID); | ||
const span = st.trace.traces[traceID].spans.find(sp => sp.spanID === spanID); | ||
if (span) { | ||
trackEvent({ | ||
category: context, | ||
action: isHidden ? 'open' : 'close', | ||
value: span.depth, | ||
}); | ||
} | ||
} | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const middlewareHooks = { | ||
[types.CHILDREN_TOGGLE]: trackParent, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// @flow | ||
|
||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { actionTypes as types } from '../duck'; | ||
import { trackEvent } from '../../../../utils/tracking'; | ||
|
||
const baseContext = 'jaeger/ux/trace/timeline'; | ||
|
||
// export for tests | ||
export const tagsContext = `${baseContext}/tags`; | ||
export const processContext = `${baseContext}/process`; | ||
export const logsContext = `${baseContext}/logs`; | ||
export const logsItemContext = `${baseContext}/logs/item`; | ||
|
||
function getCmd(isOpen: boolean) { | ||
return isOpen ? 'open' : 'close'; | ||
} | ||
|
||
function logs(isOpen: boolean) { | ||
trackEvent({ | ||
category: logsContext, | ||
action: getCmd(isOpen), | ||
}); | ||
} | ||
|
||
function logsItem(isOpen: boolean) { | ||
trackEvent({ | ||
category: logsItemContext, | ||
action: getCmd(isOpen), | ||
}); | ||
} | ||
|
||
function process(isOpen: boolean) { | ||
trackEvent({ | ||
category: processContext, | ||
action: getCmd(isOpen), | ||
}); | ||
} | ||
|
||
function tags(isOpen: boolean) { | ||
trackEvent({ | ||
category: tagsContext, | ||
action: getCmd(isOpen), | ||
}); | ||
} | ||
|
||
const getDetail = (store, action) => store.getState().traceTimeline.detailStates.get(action.payload.spanID); | ||
|
||
export const middlewareHooks = { | ||
[types.DETAIL_TAGS_TOGGLE]: (store, action) => tags(!getDetail(store, action).isTagsOpen), | ||
[types.DETAIL_PROCESS_TOGGLE]: (store, action) => process(!getDetail(store, action).isProcessOpen), | ||
[types.DETAIL_LOGS_TOGGLE]: (store, action) => logs(!getDetail(store, action).logs.isOpen), | ||
[types.DETAIL_LOG_ITEM_TOGGLE]: (store, action) => { | ||
const detail = getDetail(store, action); | ||
const { logItem } = action.payload; | ||
logsItem(!detail.logs.openedItems.has(logItem)); | ||
}, | ||
}; |
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.
Given you're tracking an event maybe be more verbose with the event being tracked. Suggestion:
trackKbdHelpModalOpen
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.
👍