forked from jaegertracing/jaeger-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GA event tracking for actions in trace view (jaegertracing#191)
* Track errors in GA w raven-js; TODO: tests, readme Signed-off-by: Joe Farro <joef@uber.com> * Include CSS selector with last error breadcrumb Signed-off-by: Joe Farro <joef@uber.com> * README for GA error tracking Signed-off-by: Joe Farro <joef@uber.com> * Misc cleanup Signed-off-by: Joe Farro <joef@uber.com> * README info on GA Application Tracking Signed-off-by: Joe Farro <joef@uber.com> * Misc fix to tracking README Signed-off-by: Joe Farro <joef@uber.com> * Misc cleanup to raven message conversion to GA Signed-off-by: Joe Farro <joef@uber.com> * Tests for tracking Signed-off-by: Joe Farro <joef@uber.com> * Apply prettier to markdown files Signed-off-by: Joe Farro <joef@uber.com> * Error tracking fn name fallback, CSS import order Signed-off-by: Joe Farro <joef@uber.com> * GA event tracking in trace view, tests are TODO Signed-off-by: Joe Farro <joef@uber.com> * Fix broken tests Signed-off-by: Joe Farro <joef@uber.com> * Tests for TracePage tracking Signed-off-by: Joe Farro <joef@uber.com> * Additional tests for trace GA event tracking Signed-off-by: Joe Farro <joef@uber.com> * Better names for tracking functions Signed-off-by: Joe Farro <joef@uber.com> * Make GA event tracking more concise (PR feedback) Signed-off-by: Joe Farro <joef@uber.com> * Revert the "more concise" changes Signed-off-by: Joe Farro <joef@uber.com> * Update changelog Signed-off-by: Joe Farro <joef@uber.com> Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
- Loading branch information
Showing
31 changed files
with
641 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// @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 { OPEN } from '../../utils/tracking/common'; | ||
import { trackEvent } from '../../utils/tracking'; | ||
|
||
const CATEGORY = 'jaeger/ux/trace/kbd-modal'; | ||
|
||
export default trackEvent.bind(null, CATEGORY, OPEN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @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 { getToggleValue, OPEN } from '../../utils/tracking/common'; | ||
import { trackEvent } from '../../utils/tracking'; | ||
|
||
const CATEGORY_ALT_VIEW = 'jaeger/ux/trace/alt-view'; | ||
const CATEGORY_SLIM_HEADER = 'jaeger/ux/trace/slim-header'; | ||
|
||
// use a closure instead of bind to prevent forwarding any arguments to trackEvent() | ||
export const trackAltViewOpen = () => trackEvent(CATEGORY_ALT_VIEW, OPEN); | ||
|
||
export const trackSlimHeaderToggle = (isOpen: boolean) => | ||
trackEvent(CATEGORY_SLIM_HEADER, getToggleValue(isOpen)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/components/TracePage/TraceTimelineViewer/SpanDetail/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/components/TracePage/TraceTimelineViewer/duck.track.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// @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'; | ||
import { getToggleValue } from '../../../utils/tracking/common'; | ||
|
||
const ACTION_RESIZE = 'resize'; | ||
|
||
const CATEGORY_BASE = 'jaeger/ux/trace/timeline'; | ||
// export for tests | ||
export const CATEGORY_TAGS = `${CATEGORY_BASE}/tags`; | ||
export const CATEGORY_PROCESS = `${CATEGORY_BASE}/process`; | ||
export const CATEGORY_LOGS = `${CATEGORY_BASE}/logs`; | ||
export const CATEGORY_LOGS_ITEM = `${CATEGORY_BASE}/logs/item`; | ||
export const CATEGORY_COLUMN = `${CATEGORY_BASE}/column`; | ||
export const CATEGORY_PARENT = `${CATEGORY_BASE}/parent`; | ||
export const CATEGORY_ROW = `${CATEGORY_BASE}/row`; | ||
|
||
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_PARENT, getToggleValue(!isHidden), span.depth); | ||
} | ||
} | ||
|
||
const logs = (isOpen: boolean) => trackEvent(CATEGORY_LOGS, getToggleValue(isOpen)); | ||
const logsItem = (isOpen: boolean) => trackEvent(CATEGORY_LOGS_ITEM, getToggleValue(isOpen)); | ||
const process = (isOpen: boolean) => trackEvent(CATEGORY_PROCESS, getToggleValue(isOpen)); | ||
const tags = (isOpen: boolean) => trackEvent(CATEGORY_TAGS, getToggleValue(isOpen)); | ||
const detailRow = (isOpen: boolean) => trackEvent(CATEGORY_ROW, getToggleValue(isOpen)); | ||
const columnWidth = (_, action) => | ||
trackEvent(CATEGORY_COLUMN, ACTION_RESIZE, Math.round(action.payload.width * 1000)); | ||
|
||
const getDetail = (store, action) => store.getState().traceTimeline.detailStates.get(action.payload.spanID); | ||
|
||
export const middlewareHooks = { | ||
[types.CHILDREN_TOGGLE]: trackParent, | ||
[types.DETAIL_TOGGLE]: (store, action) => detailRow(Boolean(getDetail(store, action))), | ||
[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)); | ||
}, | ||
[types.SET_SPAN_NAME_COLUMN_WIDTH]: columnWidth, | ||
}; |
Oops, something went wrong.