diff --git a/src/components/Assets/AssetsFilter/index.tsx b/src/components/Assets/AssetsFilter/index.tsx index fa0fe7e33..5bff8e7d7 100644 --- a/src/components/Assets/AssetsFilter/index.tsx +++ b/src/components/Assets/AssetsFilter/index.tsx @@ -6,8 +6,8 @@ import { isEnvironment } from "../../../typeGuards/isEnvironment"; import { isNull } from "../../../typeGuards/isNull"; import { isUndefined } from "../../../typeGuards/isUndefined"; import { InsightType } from "../../../types"; +import { sendTrackingEvent } from "../../../utils/actions/sendTrackingEvent"; import { getInsightTypeInfo } from "../../../utils/getInsightTypeInfo"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../common/App/ConfigContext"; import { FilterButton } from "../../common/FilterButton"; import { NewButton } from "../../common/NewButton"; diff --git a/src/components/Assets/NoDataMessage/index.tsx b/src/components/Assets/NoDataMessage/index.tsx index 67e7be68c..c286e8c4d 100644 --- a/src/components/Assets/NoDataMessage/index.tsx +++ b/src/components/Assets/NoDataMessage/index.tsx @@ -1,6 +1,6 @@ import { actions as globalActions } from "../../../actions"; import { trackingEvents as globalTrackingEvents } from "../../../trackingEvents"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { EmptyState } from "../../common/EmptyState"; import { NewCircleLoader } from "../../common/NewCircleLoader"; import { CardsIcon } from "../../common/icons/CardsIcon"; @@ -9,9 +9,12 @@ import { NoDataMessageProps } from "./types"; export const NoDataMessage = (props: NoDataMessageProps) => { const handleTroubleshootingLinkClick = () => { - sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, { - origin: "assets" - }); + sendUserActionTrackingEvent( + globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, + { + origin: "assets" + } + ); window.sendMessageToDigma({ action: globalActions.OPEN_TROUBLESHOOTING_GUIDE diff --git a/src/components/Assets/index.tsx b/src/components/Assets/index.tsx index 1bcd3da42..b2929db6f 100644 --- a/src/components/Assets/index.tsx +++ b/src/components/Assets/index.tsx @@ -7,7 +7,7 @@ import { import { useDebounce } from "../../hooks/useDebounce"; import { usePrevious } from "../../hooks/usePrevious"; import { FeatureFlag } from "../../types"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { ConfigContext } from "../common/App/ConfigContext"; import { EmptyState } from "../common/EmptyState"; import { SearchInput } from "../common/SearchInput"; @@ -103,7 +103,7 @@ export const Assets = () => { }; const handleRefresh = () => { - sendTrackingEvent(trackingEvents.REFRESH_BUTTON_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.REFRESH_BUTTON_CLICKED, { view: !selectedAssetTypeId ? "asset categories" : "assets" }); diff --git a/src/components/Dashboard/index.tsx b/src/components/Dashboard/index.tsx index b5f2f66e5..87813d28a 100644 --- a/src/components/Dashboard/index.tsx +++ b/src/components/Dashboard/index.tsx @@ -7,8 +7,9 @@ import { getFeatureFlagValue } from "../../featureFlags"; import { platform } from "../../platform"; import { isString } from "../../typeGuards/isString"; import { FeatureFlag } from "../../types"; +import { openURLInDefaultBrowser } from "../../utils/actions/openURLInDefaultBrowser"; +import { sendTrackingEvent } from "../../utils/actions/sendTrackingEvent"; import { formatEnvironmentName } from "../../utils/formatEnvironmentName"; -import { openURLInDefaultBrowser } from "../../utils/openURLInDefaultBrowser"; import { ConfigContext } from "../common/App/ConfigContext"; import { getThemeKind } from "../common/App/styles"; import { DeploymentType } from "../common/App/types"; @@ -17,6 +18,7 @@ import { DigmaLogoIcon } from "../common/icons/DigmaLogoIcon"; import { OpenLinkIcon } from "../common/icons/OpenLinkIcon"; import { actions } from "./actions"; import * as s from "./styles"; +import { trackingEvents } from "./tracking"; import { EnvironmentInfoData } from "./types"; import { ClientSpansPerformanceImpact } from "./widgets/ClientSpansPerformanceImpact"; import { SlowQueries } from "./widgets/SlowQueries"; @@ -86,6 +88,10 @@ export const Dashboard = () => { }; }, []); + useEffect(() => { + sendTrackingEvent(trackingEvents.PAGE_LOADED); + }, []); + useEffect(() => { if (config.backendInfo) { setIsInitialLoading(false); diff --git a/src/components/Dashboard/tracking.ts b/src/components/Dashboard/tracking.ts new file mode 100644 index 000000000..832eb2643 --- /dev/null +++ b/src/components/Dashboard/tracking.ts @@ -0,0 +1,11 @@ +import { addPrefix } from "../../utils/addPrefix"; + +const TRACKING_PREFIX = "dashboard"; + +export const trackingEvents = addPrefix( + TRACKING_PREFIX, + { + PAGE_LOADED: "page loaded" + }, + " " +); diff --git a/src/components/Documentation/index.tsx b/src/components/Documentation/index.tsx index 8775c6eac..65c029e21 100644 --- a/src/components/Documentation/index.tsx +++ b/src/components/Documentation/index.tsx @@ -1,11 +1,13 @@ import { useEffect } from "react"; import { isString } from "../../typeGuards/isString"; +import { sendTrackingEvent } from "../../utils/actions/sendTrackingEvent"; import { addPrefix } from "../../utils/addPrefix"; import { EnvironmentTypes } from "./pages/EnvironmentTypes"; import { Page } from "./pages/RunDigma/Page"; import { runDigmaWithCommandLine } from "./pages/RunDigma/runDigmaWithCommandLine"; import { runDigmaWithDocker } from "./pages/RunDigma/runDigmaWithDocker"; import { runDigmaWithGradleTasks } from "./pages/RunDigma/runDigmaWithGradleTasks"; +import { trackingEvents } from "./tracking"; import { DocumentationProps } from "./types"; const ACTION_PREFIX = "DOCUMENTATION"; @@ -33,6 +35,8 @@ export const Documentation = (props: DocumentationProps) => { window.sendMessageToDigma({ action: actions.INITIALIZE }); + + sendTrackingEvent(trackingEvents.PAGE_LOADED, { page }); }, []); return <>{pageContent}; diff --git a/src/components/Documentation/tracking.ts b/src/components/Documentation/tracking.ts new file mode 100644 index 000000000..e32bba6dc --- /dev/null +++ b/src/components/Documentation/tracking.ts @@ -0,0 +1,11 @@ +import { addPrefix } from "../../utils/addPrefix"; + +const TRACKING_PREFIX = "documentation"; + +export const trackingEvents = addPrefix( + TRACKING_PREFIX, + { + PAGE_LOADED: "page loaded" + }, + " " +); diff --git a/src/components/Highlights/TopIssues/common/AssetLink/index.tsx b/src/components/Highlights/TopIssues/common/AssetLink/index.tsx index 0b88df3c2..a1a9f35b1 100644 --- a/src/components/Highlights/TopIssues/common/AssetLink/index.tsx +++ b/src/components/Highlights/TopIssues/common/AssetLink/index.tsx @@ -1,7 +1,6 @@ import { actions as globalActions } from "../../../../../actions"; -import { trackingEvents as globalTrackingEvents } from "../../../../../trackingEvents"; import { ChangeScopePayload } from "../../../../../types"; -import { sendTrackingEvent } from "../../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../../utils/actions/sendUserActionTrackingEvent"; import { Tooltip } from "../../../../common/v3/Tooltip"; import { trackingEvents } from "../../../tracking"; import * as s from "./styles"; @@ -9,9 +8,9 @@ import { AssetLinkProps } from "./types"; export const AssetLink = ({ asset }: AssetLinkProps) => { const handleAssetLinkClick = () => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - actions: trackingEvents.TOP_ISSUE_CARD_ASSET_LINK_CLICKED - }); + sendUserActionTrackingEvent( + trackingEvents.TOP_ISSUE_CARD_ASSET_LINK_CLICKED + ); window.sendMessageToDigma({ action: globalActions.CHANGE_SCOPE, diff --git a/src/components/Highlights/TopIssues/common/AssetLink/styles.ts b/src/components/Highlights/TopIssues/common/AssetLink/styles.ts index 6913e6128..b634933bc 100644 --- a/src/components/Highlights/TopIssues/common/AssetLink/styles.ts +++ b/src/components/Highlights/TopIssues/common/AssetLink/styles.ts @@ -3,4 +3,5 @@ import { Link as CommonLink } from "../../../../common/v3/Link"; export const Link = styled(CommonLink)` padding: 6px 0; + max-width: 100%; `; diff --git a/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/index.tsx b/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/index.tsx index 042c329aa..7b3700c0d 100644 --- a/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/index.tsx +++ b/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/index.tsx @@ -1,8 +1,5 @@ import { createColumnHelper } from "@tanstack/react-table"; -import { Duration } from "../../../../../globals"; -import { getDurationString } from "../../../../../utils/getDurationString"; import { Table } from "../../../common/Table"; -import { TableTag } from "../../../common/TableTag"; import { TableText } from "../../../common/TableText"; import { AssetLink } from "../../common/AssetLink"; import { HighlightCard } from "../../common/HighlightCard"; @@ -36,29 +33,13 @@ export const EndpointHighNumberOfQueriesHighlightCard = ({ (x) => x.metrics.find((x) => x.id === "TypicalQueriesCount"), { header: "Typical", - meta: { - width: "20%", - minWidth: 60 - }, cell: (info) => { const metric = info.getValue(); const value = metric ? String(metric.value) : ""; return metric ? {value} : null; } } - ), - columnHelper.accessor((x) => x.metrics.find((x) => x.id === "Duration"), { - header: "Duration", - meta: { - width: "20%", - minWidth: 60 - }, - cell: (info) => { - const metric = info.getValue(); - const value = metric ? getDurationString(metric.value as Duration) : ""; - return metric ? : null; - } - }) + ) ]; const columns = addEnvironmentColumns(columnHelper, metricsColumns); diff --git a/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/mockData.ts b/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/mockData.ts index 296edaa46..5318dd0e9 100644 --- a/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/mockData.ts +++ b/src/components/Highlights/TopIssues/highlightCards/EndpointHighNumberOfQueriesHighlightCard/mockData.ts @@ -10,14 +10,6 @@ export const mockedEndpointHighNumberOfQueriesMetrics: EndpointHighNumberOfQueri { id: "TypicalQueriesCount", value: 10 - }, - { - id: "Duration", - value: { - value: 22.71, - unit: "ms", - raw: 22705900.0 - } } ]; diff --git a/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/index.tsx b/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/index.tsx index 70f1a2497..d9646e25d 100644 --- a/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/index.tsx +++ b/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/index.tsx @@ -1,9 +1,7 @@ import { createColumnHelper } from "@tanstack/react-table"; -import { Duration } from "../../../../../globals"; import { getDurationString } from "../../../../../utils/getDurationString"; import { Table } from "../../../common/Table"; import { TableTag } from "../../../common/TableTag"; -import { TableText } from "../../../common/TableText"; import { AssetLink } from "../../common/AssetLink"; import { HighlightCard } from "../../common/HighlightCard"; import { EndpointSlowdownSourceMetrics, EnvironmentData } from "../../types"; @@ -24,23 +22,10 @@ export const EndpointSlowdownSourceHighlightCard = ({ header: "Slower by", cell: (info) => { const metric = info.getValue(); - const value = metric - ? getDurationString(metric.value as Duration) - : ""; + const value = metric ? getDurationString(metric.value) : ""; return metric ? : null; } } - ), - columnHelper.accessor( - (x) => x.metrics.find((x) => x.id === "DifferencePercentage"), - { - header: "% Slower", - cell: (info) => { - const metric = info.getValue(); - const value = metric ? `${String(metric.value)}%` : ""; - return metric ? {value} : null; - } - } ) ]; diff --git a/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/mockData.ts b/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/mockData.ts index ec333b396..e2bca6ada 100644 --- a/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/mockData.ts +++ b/src/components/Highlights/TopIssues/highlightCards/EndpointSlowdownSourceHighlightCard/mockData.ts @@ -10,10 +10,6 @@ export const mockedEndpointSlowdownSourceHighlight: EndpointSlowdownSourceMetric unit: "ms", raw: 22705900.0 } - }, - { - id: "DifferencePercentage", - value: 50 } ]; diff --git a/src/components/Highlights/TopIssues/highlightCards/EndpointSpanNPlusOneHighlightCard/index.tsx b/src/components/Highlights/TopIssues/highlightCards/EndpointSpanNPlusOneHighlightCard/index.tsx index 54e07f749..b53584130 100644 --- a/src/components/Highlights/TopIssues/highlightCards/EndpointSpanNPlusOneHighlightCard/index.tsx +++ b/src/components/Highlights/TopIssues/highlightCards/EndpointSpanNPlusOneHighlightCard/index.tsx @@ -30,10 +30,6 @@ export const EndpointSpanNPlusOneHighlightCard = ({ (x) => x.metrics.find((x) => x.id === "RequestPercentage"), { header: "Requests", - meta: { - width: "20%", - minWidth: 60 - }, cell: (info) => { const metric = info.getValue(); const value = metric ? `${String(metric.value)}%` : ""; @@ -43,10 +39,6 @@ export const EndpointSpanNPlusOneHighlightCard = ({ ), columnHelper.accessor((x) => x.metrics.find((x) => x.id === "Duration"), { header: "Duration", - meta: { - width: "20%", - minWidth: 60 - }, cell: (info) => { const metric = info.getValue(); const value = metric ? getDurationString(metric.value as Duration) : ""; diff --git a/src/components/Highlights/TopIssues/highlightCards/SpanScalingHighlightCard/index.tsx b/src/components/Highlights/TopIssues/highlightCards/SpanScalingHighlightCard/index.tsx index bfae4e3ea..ee87c40fc 100644 --- a/src/components/Highlights/TopIssues/highlightCards/SpanScalingHighlightCard/index.tsx +++ b/src/components/Highlights/TopIssues/highlightCards/SpanScalingHighlightCard/index.tsx @@ -16,11 +16,7 @@ export const SpanScalingHighlightCard = ({ columnHelper.accessor( (x) => x.metrics.find((x) => x.id === "IncreasePercentage"), { - header: "Duration", - meta: { - width: "20%", - minWidth: 60 - }, + header: "Increased by", cell: (info) => { const metric = info.getValue(); const value = metric ? `${String(metric.value)}%` : ""; diff --git a/src/components/Highlights/TopIssues/index.tsx b/src/components/Highlights/TopIssues/index.tsx index 975ca545f..d4af69baf 100644 --- a/src/components/Highlights/TopIssues/index.tsx +++ b/src/components/Highlights/TopIssues/index.tsx @@ -1,9 +1,8 @@ import { Fragment, useEffect, useState } from "react"; import { actions as globalActions } from "../../../actions"; import { usePrevious } from "../../../hooks/usePrevious"; -import { trackingEvents as globalTrackingEvents } from "../../../trackingEvents"; import { ChangeViewPayload } from "../../../types"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { Link } from "../../common/v3/Link"; import { EmptyStateCard } from "../EmptyStateCard"; import { SectionHeader } from "../styles"; @@ -94,9 +93,7 @@ export const TopIssues = () => { const previousData = usePrevious(data); const handleViewAllLinkClick = () => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - actions: trackingEvents.VIEW_ALL_LINK_CLICKED - }); + sendUserActionTrackingEvent(trackingEvents.VIEW_ALL_LINK_CLICKED); window.sendMessageToDigma({ action: globalActions.CHANGE_VIEW, diff --git a/src/components/Highlights/TopIssues/types.ts b/src/components/Highlights/TopIssues/types.ts index 7ad84c3d6..7a2f6675a 100644 --- a/src/components/Highlights/TopIssues/types.ts +++ b/src/components/Highlights/TopIssues/types.ts @@ -54,10 +54,6 @@ export type EndpointHighNumberOfQueriesMetrics = [ { id: "TypicalQueriesCount"; value: number; - }, - { - id: "Duration"; - value: Duration; } ]; @@ -93,10 +89,6 @@ export type EndpointSlowdownSourceMetrics = [ { id: "DifferenceDelta"; value: Duration; - }, - { - id: "DifferencePercentage"; - value: number; } ]; diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx index ea42cd0dd..3dd1039b4 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx @@ -10,7 +10,7 @@ import { ChangeViewPayload, InsightType } from "../../../../types"; -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; import { ConfigContext } from "../../../common/App/ConfigContext"; import { EmptyState } from "../../../common/EmptyState"; import { CardsIcon } from "../../../common/icons/CardsIcon"; @@ -104,15 +104,12 @@ const renderInsightCard = ( ): JSX.Element | undefined => { const isMarkAsReadButtonEnabled = viewMode === ViewMode.OnlyUnread; // const handleErrorSelect = (errorId: string, insightType: InsightType) => { - // sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - // action: `Follow ${insightType} link` - // }); - // window.sendMessageToDigma({ - // action: actions.GO_TO_ERROR, - // payload: { - // errorId + // sendUserActionTrackingEvent( + // trackingEvents.INSIGHT_CARD_ASSET_LINK_CLICKED, + // { + // insightType // } - // }); + // ); // }; // const handleErrorsExpandButtonClick = () => { @@ -179,9 +176,13 @@ const renderInsightCard = ( spanCodeObjectId: string, insightType: InsightType ) => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - action: `Follow ${insightType} link` - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_ASSET_LINK_CLICKED, + { + insightType + } + ); + window.sendMessageToDigma({ action: actions.GO_TO_ASSET, payload: { @@ -573,15 +574,20 @@ export const InsightsPage = (props: InsightsPageProps) => { ) => { props.onJiraTicketCreate(insight, spanCodeObjectId); if (!isInsightJiraTicketHintShown?.value) { - sendTrackingEvent(trackingEvents.JIRA_TICKET_HINT_CLOSED, { event }); + sendUserActionTrackingEvent(trackingEvents.JIRA_TICKET_HINT_CLOSED, { + event + }); } setIsInsightJiraTicketHintShown({ value: true }); }; const handleTroubleshootingLinkClick = () => { - sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, { - origin: "insights" - }); + sendUserActionTrackingEvent( + globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, + { + origin: "insights" + } + ); window.sendMessageToDigma({ action: globalActions.OPEN_TROUBLESHOOTING_GUIDE diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/insightCards/common/InsightCard/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/insightCards/common/InsightCard/index.tsx index 834e9a32a..ccfbeafdb 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/insightCards/common/InsightCard/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/insightCards/common/InsightCard/index.tsx @@ -2,13 +2,12 @@ import React, { useContext, useEffect, useState } from "react"; import { actions as globalActions } from "../../../../../../../actions"; import { getFeatureFlagValue } from "../../../../../../../featureFlags"; import { usePrevious } from "../../../../../../../hooks/usePrevious"; -import { trackingEvents as globalTrackingEvents } from "../../../../../../../trackingEvents"; import { isString } from "../../../../../../../typeGuards/isString"; import { FeatureFlag, GetInsightStatsPayload } from "../../../../../../../types"; -import { sendTrackingEvent } from "../../../../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../../../../utils/actions/sendUserActionTrackingEvent"; import { Spinner } from "../../../../../../Navigation/CodeButtonMenu/Spinner"; import { ConfigContext } from "../../../../../../common/App/ConfigContext"; import { CheckmarkCircleIcon } from "../../../../../../common/icons/12px/CheckmarkCircleIcon"; @@ -141,25 +140,33 @@ export const InsightCard = (props: InsightCardProps) => { }; const handleDismissClick = () => { - sendTrackingEvent(trackingEvents.INSIGHT_CARD_DISMISS_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_DISMISS_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); dismiss(); setDismissConfirmationOpened(false); }; const handleShowClick = () => { - sendTrackingEvent(trackingEvents.INSIGHT_CARD_SHOW_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_SHOW_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); show(); }; const handleMarkAsReadButtonClick = () => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - action: trackingEvents.INSIGHT_CARD_MARK_AS_READ_BUTTON_CLICKED, - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_MARK_AS_READ_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); markAsRead(); }; @@ -173,9 +180,12 @@ export const InsightCard = (props: InsightCardProps) => { }; const handleCreateTicketLinkClick = () => { - sendTrackingEvent(trackingEvents.INSIGHT_CARD_CREATE_TICKET_LINK_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_CREATE_TICKET_LINK_CLICKED, + { + insightType: props.insight.type + } + ); openTicketInfo( props.jiraTicketInfo?.spanCodeObjectId, "create ticket link clicked" diff --git a/src/components/Insights/InsightsCatalog/index.tsx b/src/components/Insights/InsightsCatalog/index.tsx index a3f520747..b255daee3 100644 --- a/src/components/Insights/InsightsCatalog/index.tsx +++ b/src/components/Insights/InsightsCatalog/index.tsx @@ -8,8 +8,8 @@ import { isNumber } from "../../../typeGuards/isNumber"; import { isString } from "../../../typeGuards/isString"; import { isUndefined } from "../../../typeGuards/isUndefined"; import { GetInsightStatsPayload } from "../../../types"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { formatUnit } from "../../../utils/formatUnit"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Pagination } from "../../common/Pagination"; import { SearchInput } from "../../common/SearchInput"; @@ -88,7 +88,7 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => { ); const handleRefreshButtonClick = () => { - sendTrackingEvent(trackingEvents.REFRESH_BUTTON_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.REFRESH_BUTTON_CLICKED, { viewMode: mode }); diff --git a/src/components/Insights/deprecated/InsightList/index.tsx b/src/components/Insights/deprecated/InsightList/index.tsx index 772db5726..ca2ce31ba 100644 --- a/src/components/Insights/deprecated/InsightList/index.tsx +++ b/src/components/Insights/deprecated/InsightList/index.tsx @@ -2,12 +2,11 @@ import { useEffect, useState } from "react"; import { DefaultTheme, useTheme } from "styled-components"; import { actions as globalActions } from "../../../../actions"; import { usePersistence } from "../../../../hooks/usePersistence"; -import { trackingEvents as globalTrackingEvents } from "../../../../trackingEvents"; import { isUndefined } from "../../../../typeGuards/isUndefined"; import { ChangeScopePayload, InsightType } from "../../../../types"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; import { getInsightTypeInfo } from "../../../../utils/getInsightTypeInfo"; import { getInsightTypeOrderPriority } from "../../../../utils/getInsightTypeOrderPriority"; -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; import { Card } from "../../../common/Card"; import { Tooltip } from "../../../common/Tooltip"; import { EndpointIcon } from "../../../common/icons/EndpointIcon"; @@ -239,9 +238,13 @@ const renderInsightCard = ( const isMarkAsReadButtonEnabled = viewMode === ViewMode.OnlyUnread; const handleErrorSelect = (errorId: string, insightType: InsightType) => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - action: `Follow ${insightType} link` - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_ASSET_LINK_CLICKED, + { + insightType + } + ); + window.sendMessageToDigma({ action: actions.GO_TO_ERROR, payload: { @@ -314,9 +317,12 @@ const renderInsightCard = ( spanCodeObjectId: string, insightType: InsightType ) => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - action: `Follow ${insightType} link` - }); + sendUserActionTrackingEvent( + trackingEvents.INSIGHT_CARD_ASSET_LINK_CLICKED, + { + insightType + } + ); window.sendMessageToDigma({ action: actions.GO_TO_ASSET, payload: { @@ -745,7 +751,9 @@ export const InsightList = (props: InsightListProps) => { ) => { props.onJiraTicketCreate(insight, spanCodeObjectId); if (!isInsightJiraTicketHintShown?.value) { - sendTrackingEvent(trackingEvents.JIRA_TICKET_HINT_CLOSED, { event }); + sendUserActionTrackingEvent(trackingEvents.JIRA_TICKET_HINT_CLOSED, { + event + }); } setIsInsightJiraTicketHintShown({ value: true }); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/BottleneckInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/BottleneckInsight/index.tsx index 59cdc7fb9..ce8ec0ef0 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/BottleneckInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/BottleneckInsight/index.tsx @@ -1,6 +1,6 @@ +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getDurationString } from "../../../../../../utils/getDurationString"; import { roundTo } from "../../../../../../utils/roundTo"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { trimEndpointScheme } from "../../../../../../utils/trimEndpointScheme"; import { Tooltip } from "../../../../../common/Tooltip"; import { Link } from "../../../../styles"; @@ -17,9 +17,12 @@ export const BottleneckInsight = (props: BottleneckInsightProps) => { }; const handleCreateJiraTicketButtonClick = (event: string) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(props.insight, undefined, event); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/EndpointNPlusOneInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/EndpointNPlusOneInsight/index.tsx index 9b10e4e68..e94b98c3b 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/EndpointNPlusOneInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/EndpointNPlusOneInsight/index.tsx @@ -1,9 +1,9 @@ import { useContext } from "react"; import { usePagination } from "../../../../../../hooks/usePagination"; import { InsightType } from "../../../../../../types"; +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getDurationString } from "../../../../../../utils/getDurationString"; import { roundTo } from "../../../../../../utils/roundTo"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../../../../common/App/ConfigContext"; import { Button } from "../../../../../common/Button"; import { Pagination } from "../../../../../common/Pagination"; @@ -43,9 +43,12 @@ export const EndpointNPlusOneInsight = ( spanCodeObjectId: string, event: string ) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(props.insight, spanCodeObjectId, event); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/EndpointQueryOptimizationInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/EndpointQueryOptimizationInsight/index.tsx index 040a87a9c..c124ca22c 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/EndpointQueryOptimizationInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/EndpointQueryOptimizationInsight/index.tsx @@ -1,8 +1,8 @@ import { useContext } from "react"; import { usePagination } from "../../../../../../hooks/usePagination"; import { InsightType } from "../../../../../../types"; +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getDurationString } from "../../../../../../utils/getDurationString"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../../../../common/App/ConfigContext"; import { Button } from "../../../../../common/Button"; import { Pagination } from "../../../../../common/Pagination"; @@ -41,9 +41,12 @@ export const EndpointQueryOptimizationInsight = ( spanCodeObjectId: string, event: string ) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(props.insight, spanCodeObjectId, event); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/HighNumberOfQueriesInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/HighNumberOfQueriesInsight/index.tsx index a3947fe68..d5c203285 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/HighNumberOfQueriesInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/HighNumberOfQueriesInsight/index.tsx @@ -1,5 +1,5 @@ import { InsightType } from "../../../../../../types"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { Button } from "../../../../../common/Button"; import { Tag } from "../../../../../common/Tag"; import { Tooltip } from "../../../../../common/Tooltip"; @@ -32,9 +32,12 @@ export const HighNumberOfQueriesInsight = ( }; const handleCreateJiraTicketButtonClick = (event: string) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(insight, undefined, event); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/NPlusOneInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/NPlusOneInsight/index.tsx index 0438a04f1..4bba20805 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/NPlusOneInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/NPlusOneInsight/index.tsx @@ -1,8 +1,8 @@ import { useContext } from "react"; import { InsightType } from "../../../../../../types"; +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getCriticalityLabel } from "../../../../../../utils/getCriticalityLabel"; import { getDurationString } from "../../../../../../utils/getDurationString"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { trimEndpointScheme } from "../../../../../../utils/trimEndpointScheme"; import { ConfigContext } from "../../../../../common/App/ConfigContext"; import { ScoreIndicator } from "../../../../../common/ScoreIndicator"; @@ -36,9 +36,12 @@ export const NPlusOneInsight = (props: NPlusOneInsightProps) => { }; const handleCreateJiraTicketButtonClick = (event: string) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(props.insight, undefined, event); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/QueryOptimizationInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/QueryOptimizationInsight/index.tsx index 448fd5300..14732e378 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/QueryOptimizationInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/QueryOptimizationInsight/index.tsx @@ -1,7 +1,7 @@ import { useContext } from "react"; import { InsightType } from "../../../../../../types"; +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getDurationString } from "../../../../../../utils/getDurationString"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { trimEndpointScheme } from "../../../../../../utils/trimEndpointScheme"; import { ConfigContext } from "../../../../../common/App/ConfigContext"; import { Tooltip } from "../../../../../common/Tooltip"; @@ -36,9 +36,12 @@ export const QueryOptimizationInsight = ( }; const handleCreateJiraTicketButtonClick = (event: string) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate( diff --git a/src/components/Insights/deprecated/InsightList/insightCards/ScalingIssueInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/ScalingIssueInsight/index.tsx index bcf5b4aea..904c4afdd 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/ScalingIssueInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/ScalingIssueInsight/index.tsx @@ -1,7 +1,7 @@ import { useContext } from "react"; import { InsightType } from "../../../../../../types"; +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getDurationString } from "../../../../../../utils/getDurationString"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { trimEndpointScheme } from "../../../../../../utils/trimEndpointScheme"; import { ConfigContext } from "../../../../../common/App/ConfigContext"; import { Button } from "../../../../../common/Button"; @@ -49,9 +49,12 @@ export const ScalingIssueInsight = (props: ScalingIssueInsightProps) => { spanCodeObjectId: string, event: string ) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(props.insight, spanCodeObjectId, event); diff --git a/src/components/Insights/deprecated/InsightList/insightCards/SpanBottleneckInsight/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/SpanBottleneckInsight/index.tsx index 42023d1b3..819094ff5 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/SpanBottleneckInsight/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/SpanBottleneckInsight/index.tsx @@ -1,6 +1,6 @@ +import { sendUserActionTrackingEvent } from "../../../../../../utils/actions/sendUserActionTrackingEvent"; import { getDurationString } from "../../../../../../utils/getDurationString"; import { roundTo } from "../../../../../../utils/roundTo"; -import { sendTrackingEvent } from "../../../../../../utils/sendTrackingEvent"; import { Tooltip } from "../../../../../common/Tooltip"; import { Description, Link } from "../../../../styles"; import { trackingEvents } from "../../../../tracking"; @@ -22,9 +22,12 @@ export const SpanBottleneckInsight = (props: SpanBottleneckInsightProps) => { spanCodeObjectId: string, event: string ) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType: props.insight.type - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType: props.insight.type + } + ); props.onJiraTicketCreate && props.onJiraTicketCreate(props.insight, spanCodeObjectId, event); }; diff --git a/src/components/Insights/deprecated/InsightList/insightCards/common/JiraButton/index.tsx b/src/components/Insights/deprecated/InsightList/insightCards/common/JiraButton/index.tsx index 2f6189330..cf07f06c9 100644 --- a/src/components/Insights/deprecated/InsightList/insightCards/common/JiraButton/index.tsx +++ b/src/components/Insights/deprecated/InsightList/insightCards/common/JiraButton/index.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import { useTheme } from "styled-components"; -import { openURLInDefaultBrowser } from "../../../../../../../utils/openURLInDefaultBrowser"; +import { openURLInDefaultBrowser } from "../../../../../../../utils/actions/openURLInDefaultBrowser"; import { Button } from "../../../../../../common/Button"; import { Menu } from "../../../../../../common/Menu"; import { NewPopover } from "../../../../../../common/NewPopover"; diff --git a/src/components/Insights/index.tsx b/src/components/Insights/index.tsx index 80661a1bb..8674f3c70 100644 --- a/src/components/Insights/index.tsx +++ b/src/components/Insights/index.tsx @@ -12,8 +12,8 @@ import { usePrevious } from "../../hooks/usePrevious"; import { trackingEvents as globalTrackingEvents } from "../../trackingEvents"; import { isNumber } from "../../typeGuards/isNumber"; import { FeatureFlag } from "../../types"; -import { openURLInDefaultBrowser } from "../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; +import { openURLInDefaultBrowser } from "../../utils/actions/openURLInDefaultBrowser"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { ConfigContext } from "../common/App/ConfigContext"; import { CircleLoader } from "../common/CircleLoader"; import { EmptyState } from "../common/EmptyState"; @@ -173,9 +173,12 @@ const renderInsightTicket = ( const NoDataYet = () => { const handleTroubleshootingLinkClick = () => { - sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, { - origin: "insights" - }); + sendUserActionTrackingEvent( + globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, + { + origin: "insights" + } + ); sendMessage(globalActions.OPEN_TROUBLESHOOTING_GUIDE); }; @@ -294,9 +297,12 @@ export const Insights = (props: InsightsProps) => { // }; const handleTroubleshootingLinkClick = () => { - sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, { - origin: "insights" - }); + sendUserActionTrackingEvent( + globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, + { + origin: "insights" + } + ); sendMessage(globalActions.OPEN_TROUBLESHOOTING_GUIDE); }; diff --git a/src/components/Insights/insightTickets/common/CommitInfos/index.tsx b/src/components/Insights/insightTickets/common/CommitInfos/index.tsx index 73330271c..c59180e0a 100644 --- a/src/components/Insights/insightTickets/common/CommitInfos/index.tsx +++ b/src/components/Insights/insightTickets/common/CommitInfos/index.tsx @@ -1,7 +1,7 @@ import { format } from "date-fns"; import { MouseEvent } from "react"; +import { openURLInDefaultBrowser } from "../../../../../utils/actions/openURLInDefaultBrowser"; import { intersperse } from "../../../../../utils/intersperse"; -import { openURLInDefaultBrowser } from "../../../../../utils/openURLInDefaultBrowser"; import { Link } from "../../../../common/Link"; import { CommitInfosData } from "../../types"; import * as s from "./styles"; diff --git a/src/components/Insights/insightTickets/common/useEndpointDataSource.ts b/src/components/Insights/insightTickets/common/useEndpointDataSource.ts index fb21b61d4..1e5f4925b 100644 --- a/src/components/Insights/insightTickets/common/useEndpointDataSource.ts +++ b/src/components/Insights/insightTickets/common/useEndpointDataSource.ts @@ -54,7 +54,7 @@ export const useEndpointDataSource = < action: actions.GET_SPAN_INSIGHT, payload: { spanCodeObjectId, - insightType: insightType + insightType } }); }, [insightType, spanInfo]); @@ -69,7 +69,7 @@ export const useEndpointDataSource = < action: actions.GET_SPAN_INSIGHT, payload: { spanCodeObjectId: spanInfo?.spanCodeObjectId, - insightType: insightType + insightType } }); }; diff --git a/src/components/Insights/tracking.ts b/src/components/Insights/tracking.ts index 8f499adb2..b0944271a 100644 --- a/src/components/Insights/tracking.ts +++ b/src/components/Insights/tracking.ts @@ -13,7 +13,8 @@ export const trackingEvents = addPrefix( "insight card create ticket link clicked", INSIGHT_CARD_MARK_AS_READ_BUTTON_CLICKED: "insight card mark as read button clicked", - REFRESH_BUTTON_CLICKED: "refresh button clicked" + REFRESH_BUTTON_CLICKED: "refresh button clicked", + INSIGHT_CARD_ASSET_LINK_CLICKED: "insight card asset link clicked" }, " " ); diff --git a/src/components/InstallationWizard/FinishStep/index.tsx b/src/components/InstallationWizard/FinishStep/index.tsx index 5d7096745..36d8b409d 100644 --- a/src/components/InstallationWizard/FinishStep/index.tsx +++ b/src/components/InstallationWizard/FinishStep/index.tsx @@ -1,7 +1,7 @@ import { DefaultTheme, useTheme } from "styled-components"; import { GETTING_STARTED_VIDEO_URL } from "../../../constants"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { getThemeKind } from "../../common/App/styles"; import { CircleLoader } from "../../common/CircleLoader"; import { Link } from "../../common/Link"; @@ -44,7 +44,9 @@ export const FinishStep = (props: FinishStepProps) => { const themeKind = getThemeKind(theme); const handleGettingStartedVideoLinkClick = () => { - sendTrackingEvent(trackingEvents.GETTING_STARTED_VIDEO_LINK_CLICKED); + sendUserActionTrackingEvent( + trackingEvents.GETTING_STARTED_VIDEO_LINK_CLICKED + ); openURLInDefaultBrowser(GETTING_STARTED_VIDEO_URL); }; diff --git a/src/components/InstallationWizard/InstallStep/EngineManager/index.tsx b/src/components/InstallationWizard/InstallStep/EngineManager/index.tsx index 340675218..05826128a 100644 --- a/src/components/InstallationWizard/InstallStep/EngineManager/index.tsx +++ b/src/components/InstallationWizard/InstallStep/EngineManager/index.tsx @@ -1,7 +1,7 @@ import { useContext } from "react"; import { useTheme } from "styled-components"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; import { isDigmaEngineRunning } from "../../../../utils/isDigmaEngineRunning"; -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../../common/App/ConfigContext"; import { getThemeKind } from "../../../common/App/styles"; import { Loader } from "../../../common/Loader"; @@ -72,7 +72,7 @@ export const EngineManager = (props: EngineManagerProps) => { }; const sendActionButtonTrackingEvent = (buttonName: string) => { - sendTrackingEvent(trackingEvents.ENGINE_ACTION_BUTTON_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.ENGINE_ACTION_BUTTON_CLICKED, { buttonName }); }; diff --git a/src/components/InstallationWizard/InstallStep/index.tsx b/src/components/InstallationWizard/InstallStep/index.tsx index 70b574e68..d635a230b 100644 --- a/src/components/InstallationWizard/InstallStep/index.tsx +++ b/src/components/InstallationWizard/InstallStep/index.tsx @@ -1,9 +1,10 @@ import { useContext, useEffect, useState } from "react"; import { DefaultTheme, useTheme } from "styled-components"; import { usePrevious } from "../../../hooks/usePrevious"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; +import { sendTrackingEvent } from "../../../utils/actions/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { isDigmaEngineRunning } from "../../../utils/isDigmaEngineRunning"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../common/App/ConfigContext"; import { ConfigContextData } from "../../common/App/types"; import { CircleLoader } from "../../common/CircleLoader"; @@ -206,7 +207,7 @@ export const InstallStep = (props: InstallStepProps) => { }; const handleSlackLinkClick = () => { - sendTrackingEvent(trackingEvents.NO_DOCKER_SLACK_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.NO_DOCKER_SLACK_LINK_CLICKED); props.onSlackLinkClick(); }; diff --git a/src/components/InstallationWizard/InstallStep/useEngine.ts b/src/components/InstallationWizard/InstallStep/useEngine.ts index 5194a5612..1bd624bb0 100644 --- a/src/components/InstallationWizard/InstallStep/useEngine.ts +++ b/src/components/InstallationWizard/InstallStep/useEngine.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect, useState } from "react"; import { dispatcher } from "../../../dispatcher"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendTrackingEvent } from "../../../utils/actions/sendTrackingEvent"; import { actions } from "../actions"; import { trackingEvents } from "../tracking"; import { AsyncActionResultData } from "../types"; diff --git a/src/components/InstallationWizard/index.tsx b/src/components/InstallationWizard/index.tsx index 4ffa3aafd..12f2aae87 100644 --- a/src/components/InstallationWizard/index.tsx +++ b/src/components/InstallationWizard/index.tsx @@ -4,9 +4,10 @@ import { SLACK_WORKSPACE_URL } from "../../constants"; import { IDE } from "../../globals"; import { useDebounce } from "../../hooks/useDebounce"; import { ide } from "../../platform"; +import { openURLInDefaultBrowser } from "../../utils/actions/openURLInDefaultBrowser"; +import { sendTrackingEvent } from "../../utils/actions/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { isValidEmailFormat } from "../../utils/isValidEmailFormat"; -import { openURLInDefaultBrowser } from "../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; import { ConfigContext } from "../common/App/ConfigContext"; import { CrossIcon } from "../common/icons/CrossIcon"; import { DesktopIcon } from "../common/icons/DesktopIcon"; @@ -95,6 +96,8 @@ export const InstallationWizard = () => { action: actions.INITIALIZE }); + sendTrackingEvent(trackingEvents.PAGE_LOADED); + if (firstStep === 1) { sendTrackingEvent(trackingEvents.INSTALL_STEP_AUTOMATICALLY_PASSED); } @@ -161,12 +164,14 @@ export const InstallationWizard = () => { // }; const handleGetDigmaDockerDesktopButtonClick = () => { - sendTrackingEvent(trackingEvents.GET_DIGMA_DOCKER_EXTENSION_BUTTON_CLICKED); + sendUserActionTrackingEvent( + trackingEvents.GET_DIGMA_DOCKER_EXTENSION_BUTTON_CLICKED + ); openURLInDefaultBrowser(DIGMA_DOCKER_EXTENSION_URL); }; const handleInstallTabSelect = (tabName: string) => { - sendTrackingEvent(trackingEvents.TAB_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.TAB_CLICKED, { tabName }); }; @@ -176,7 +181,7 @@ export const InstallationWizard = () => { // }; // const handleObservabilityChange = (value: boolean) => { - // sendTrackingEvent(trackingEvents.OBSERVABILITY_BUTTON_CLICKED); + // sendUserActionTrackingEvent(trackingEvents.OBSERVABILITY_BUTTON_CLICKED); // setIsObservabilityEnabled(value); // window.sendMessageToDigma({ // action: actions.SET_OBSERVABILITY, @@ -197,7 +202,7 @@ export const InstallationWizard = () => { } if (!isAutomatic) { - sendTrackingEvent(trackingEvents.INSTALL_STEP_PASSED); + sendUserActionTrackingEvent(trackingEvents.INSTALL_STEP_PASSED); } } }; @@ -211,7 +216,7 @@ export const InstallationWizard = () => { // const handleInstallationTypeButtonClick = ( // installationType: InstallationType // ) => { - // sendTrackingEvent(trackingEvents.INSTALLATION_TYPE_BUTTON_CLICKED, { + // sendUserActionTrackingEvent(trackingEvents.INSTALLATION_TYPE_BUTTON_CLICKED, { // installationType // }); // setInstallationType(installationType); @@ -257,7 +262,7 @@ export const InstallationWizard = () => { // const handleEmailAddButton = () => { // if (userEmail.length > 0) { // setIsUserEmailCaptured(true); - // sendTrackingEvent( + // sendUserActionTrackingEvent( // trackingEvents.DIGMA_CLOUD_AVAILABILITY_NOTIFICATION_EMAIL_ADDRESS_CAPTURED, // { // email: userEmail diff --git a/src/components/InstallationWizard/tracking.ts b/src/components/InstallationWizard/tracking.ts index 1d6aafab7..b84fe107d 100644 --- a/src/components/InstallationWizard/tracking.ts +++ b/src/components/InstallationWizard/tracking.ts @@ -5,6 +5,7 @@ const TRACKING_PREFIX = "installation wizard"; export const trackingEvents = addPrefix( TRACKING_PREFIX, { + PAGE_LOADED: "page loaded", INSTALL_STEP_PASSED: "install step passed", INSTALL_STEP_AUTOMATICALLY_PASSED: "install step automatically passed", GET_DIGMA_DOCKER_EXTENSION_BUTTON_CLICKED: diff --git a/src/components/Navigation/CodeButtonMenu/index.tsx b/src/components/Navigation/CodeButtonMenu/index.tsx index 5b6378618..215962b1b 100644 --- a/src/components/Navigation/CodeButtonMenu/index.tsx +++ b/src/components/Navigation/CodeButtonMenu/index.tsx @@ -1,7 +1,7 @@ import { MouseEvent } from "react"; import { actions } from "../../../actions"; import { isString } from "../../../typeGuards/isString"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { NewButton } from "../../common/NewButton"; import { CodeIcon } from "../../common/icons/16px/CodeIcon"; import { Tooltip } from "../../common/v3/Tooltip"; @@ -15,7 +15,9 @@ import { CodeButtonMenuProps } from "./types"; export const CodeButtonMenu = (props: CodeButtonMenuProps) => { const handleAddObservabilityClick = () => { if (isString(props.codeContext.methodId)) { - sendTrackingEvent(trackingEvents.ADD_OBSERVABILITY_BUTTON_CLICKED); + sendUserActionTrackingEvent( + trackingEvents.ADD_OBSERVABILITY_BUTTON_CLICKED + ); props.onObservabilityAdd(props.codeContext.methodId); } }; @@ -23,13 +25,13 @@ export const CodeButtonMenu = (props: CodeButtonMenuProps) => { const handleAutoFixLinkClick = (e: MouseEvent) => { e.preventDefault(); if (isString(props.codeContext.methodId)) { - sendTrackingEvent(trackingEvents.AUTO_FIX_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.AUTO_FIX_BUTTON_CLICKED); props.onAutoFix(props.codeContext.methodId); } }; const handleTroubleshootingLinkClick = (e: MouseEvent) => { - sendTrackingEvent(trackingEvents.TROUBLESHOOTING_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.TROUBLESHOOTING_LINK_CLICKED); e.preventDefault(); window.sendMessageToDigma({ action: actions.OPEN_TROUBLESHOOTING_GUIDE @@ -84,7 +86,7 @@ export const CodeButtonMenu = (props: CodeButtonMenuProps) => { const renderSpans = () => { const handleMenuItemClick = (spanCodeObjectId: string) => { - sendTrackingEvent(trackingEvents.ASSET_SELECTED); + sendUserActionTrackingEvent(trackingEvents.ASSET_SELECTED); props.onScopeChange(spanCodeObjectId); }; diff --git a/src/components/Navigation/EnvironmentBar/index.tsx b/src/components/Navigation/EnvironmentBar/index.tsx index d9684a534..af7d9c222 100644 --- a/src/components/Navigation/EnvironmentBar/index.tsx +++ b/src/components/Navigation/EnvironmentBar/index.tsx @@ -1,4 +1,4 @@ -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { EnvironmentIcon } from "../../common/EnvironmentIcon"; import { ChevronIcon } from "../../common/icons/16px/ChevronIcon"; import { GlobeIcon } from "../../common/icons/16px/GlobeIcon"; @@ -11,7 +11,7 @@ import { EnvironmentBarProps } from "./types"; export const EnvironmentBar = (props: EnvironmentBarProps) => { const handleEnvironmentBarClick = () => { if (!props.isDisabled) { - sendTrackingEvent(trackingEvents.ENVIRONMENT_BAR_CLICKED); + sendUserActionTrackingEvent(trackingEvents.ENVIRONMENT_BAR_CLICKED); props.onClick(); } }; diff --git a/src/components/Navigation/KebabMenu/index.tsx b/src/components/Navigation/KebabMenu/index.tsx index a3d00ed51..d1dd1ae28 100644 --- a/src/components/Navigation/KebabMenu/index.tsx +++ b/src/components/Navigation/KebabMenu/index.tsx @@ -1,8 +1,8 @@ import { useContext } from "react"; import { actions as globalActions } from "../../../actions"; import { OpenInstallationWizardPayload } from "../../../types"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { isDigmaEngineRunning } from "../../../utils/isDigmaEngineRunning"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { ConfigContext } from "../../common/App/ConfigContext"; import { DigmaLogoFlatIcon } from "../../common/icons/16px/DigmaLogoFlatIcon"; import { FourPointedStarIcon } from "../../common/icons/16px/FourPointedStarIcon"; @@ -17,7 +17,7 @@ export const KebabMenu = (props: KebabMenuProps) => { const config = useContext(ConfigContext); const handleOnboardingClick = () => { - sendTrackingEvent(trackingEvents.ONBOARDING_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.ONBOARDING_LINK_CLICKED); window.sendMessageToDigma({ action: globalActions.OPEN_INSTALLATION_WIZARD, payload: { @@ -28,7 +28,7 @@ export const KebabMenu = (props: KebabMenuProps) => { }; const handleLocalEngineClick = () => { - sendTrackingEvent(trackingEvents.LOCAL_ENGINE_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.LOCAL_ENGINE_LINK_CLICKED); window.sendMessageToDigma({ action: globalActions.OPEN_INSTALLATION_WIZARD, payload: { diff --git a/src/components/Navigation/ScopeBar/TargetButtonMenu/index.tsx b/src/components/Navigation/ScopeBar/TargetButtonMenu/index.tsx index 656d95b91..afb8cb1c8 100644 --- a/src/components/Navigation/ScopeBar/TargetButtonMenu/index.tsx +++ b/src/components/Navigation/ScopeBar/TargetButtonMenu/index.tsx @@ -1,4 +1,4 @@ -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; import { CodeDetails } from "../../../common/App/types"; import { MenuList } from "../../common/MenuList"; import { trackingEvents } from "../../tracking"; @@ -7,7 +7,7 @@ import { TargetButtonMenuProps } from "./types"; export const TargetButtonMenu = (props: TargetButtonMenuProps) => { const handleMenuItemClick = (codeDetails: CodeDetails) => { - sendTrackingEvent(trackingEvents.CODE_LOCATION_SELECTED); + sendUserActionTrackingEvent(trackingEvents.CODE_LOCATION_SELECTED); props.onGoToCodeLocation(codeDetails); }; diff --git a/src/components/Navigation/ScopeBar/index.tsx b/src/components/Navigation/ScopeBar/index.tsx index ab0befd55..c7a93b3a1 100644 --- a/src/components/Navigation/ScopeBar/index.tsx +++ b/src/components/Navigation/ScopeBar/index.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { actions as globalActions } from "../../../actions"; import { ChangeScopePayload } from "../../../types"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { CodeDetails, Scope } from "../../common/App/types"; import { NewPopover } from "../../common/NewPopover"; import { CrosshairIcon } from "../../common/icons/16px/CrosshairIcon"; @@ -86,7 +86,7 @@ export const ScopeBar = (props: ScopeBarProps) => { }, [props.scope]); const handleHomeButtonClick = () => { - sendTrackingEvent(trackingEvents.HOME_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.HOME_BUTTON_CLICKED); window.sendMessageToDigma({ action: globalActions.CHANGE_SCOPE, payload: { @@ -106,7 +106,7 @@ export const ScopeBar = (props: ScopeBarProps) => { }; const handleTargetButtonClick = () => { - sendTrackingEvent(trackingEvents.TARGET_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.TARGET_BUTTON_CLICKED); if (props.scope && props.scope.code.codeDetailsList.length === 1) { handleGoToCodeLocation(props.scope.code.codeDetailsList[0]); } diff --git a/src/utils/HistoryManager.ts b/src/components/Navigation/ScopeNavigation/HistoryManager.ts similarity index 97% rename from src/utils/HistoryManager.ts rename to src/components/Navigation/ScopeNavigation/HistoryManager.ts index 2d7bcf784..4cf02c70c 100644 --- a/src/utils/HistoryManager.ts +++ b/src/components/Navigation/ScopeNavigation/HistoryManager.ts @@ -1,4 +1,4 @@ -import { Environment, Scope } from "../components/common/App/types"; +import { Environment, Scope } from "../../common/App/types"; const MAX_STEPS = 15; diff --git a/src/components/Navigation/ScopeNavigation/HistoryNavigationPanel/index.tsx b/src/components/Navigation/ScopeNavigation/HistoryNavigationPanel/index.tsx index 53d8109c4..ed59536b8 100644 --- a/src/components/Navigation/ScopeNavigation/HistoryNavigationPanel/index.tsx +++ b/src/components/Navigation/ScopeNavigation/HistoryNavigationPanel/index.tsx @@ -1,4 +1,4 @@ -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; import { ChevronIcon } from "../../../common/icons/20px/ChevronIcon"; import { Direction } from "../../../common/icons/types"; import { trackingEvents } from "../../tracking"; @@ -7,12 +7,12 @@ import { HistoryNavigationPanelProps } from "./types"; export const HistoryNavigationPanel = (props: HistoryNavigationPanelProps) => { const handleBackButtonClick = () => { - sendTrackingEvent(trackingEvents.BACK_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.BACK_BUTTON_CLICKED); props.onGoBack(); }; const handleForwardButtonClick = () => { - sendTrackingEvent(trackingEvents.FORWARD_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.FORWARD_BUTTON_CLICKED); props.onGoForward(); }; diff --git a/src/components/Navigation/ScopeNavigation/index.tsx b/src/components/Navigation/ScopeNavigation/index.tsx index 1c7375f4a..34c07c312 100644 --- a/src/components/Navigation/ScopeNavigation/index.tsx +++ b/src/components/Navigation/ScopeNavigation/index.tsx @@ -7,9 +7,9 @@ import { ChangeScopePayload, ChangeViewPayload } from "../../../types"; -import { HistoryManager } from "../../../utils/HistoryManager"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Scope } from "../../common/App/types"; +import { HistoryManager } from "./HistoryManager"; import { HistoryNavigationPanel } from "./HistoryNavigationPanel"; import { ScopeNavigationProps } from "./types"; diff --git a/src/components/Navigation/Tabs/index.tsx b/src/components/Navigation/Tabs/index.tsx index c4dc5fec5..5f73a6ad2 100644 --- a/src/components/Navigation/Tabs/index.tsx +++ b/src/components/Navigation/Tabs/index.tsx @@ -2,7 +2,7 @@ import { useContext } from "react"; import { getFeatureFlagValue } from "../../../featureFlags"; import { isNumber } from "../../../typeGuards/isNumber"; import { FeatureFlag } from "../../../types"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { ConfigContext } from "../../common/App/ConfigContext"; import { ConfigContextData, Scope } from "../../common/App/types"; import { MagicWandIcon } from "../../common/icons/16px/MagicWandIcon"; @@ -66,7 +66,7 @@ export const Tabs = (props: TabsProps) => { const handleTabClick = (tab: TabData) => { if (!getIsTabDisabled(tab, config.scope)) { - sendTrackingEvent(trackingEvents.TAB_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.TAB_CLICKED, { tabName: tab.id }); props.onSelect(tab.id); diff --git a/src/components/Navigation/index.tsx b/src/components/Navigation/index.tsx index ddbaffca2..c3e578647 100644 --- a/src/components/Navigation/index.tsx +++ b/src/components/Navigation/index.tsx @@ -8,7 +8,7 @@ import { ChangeScopePayload, ChangeViewPayload } from "../../types"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { AsyncActionResultData } from "../InstallationWizard/types"; import { ConfigContext } from "../common/App/ConfigContext"; import { Environment, Scope } from "../common/App/types"; @@ -209,7 +209,7 @@ export const Navigation = () => { }, [codeContext, previousCodeContext]); const handleDashboardButtonClick = () => { - sendTrackingEvent(trackingEvents.DASHBOARD_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.DASHBOARD_BUTTON_CLICKED); window.sendMessageToDigma({ action: globalActions.OPEN_DASHBOARD, payload: { @@ -220,24 +220,24 @@ export const Navigation = () => { const handleKebabMenuOpenChange = (isOpen: boolean) => { if (isOpen) { - sendTrackingEvent(trackingEvents.KEBAB_MENU_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.KEBAB_MENU_BUTTON_CLICKED); } setIsKebabButtonMenuOpen(isOpen); }; const handleKebabButtonClick = () => { - sendTrackingEvent(trackingEvents.KEBAB_MENU_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.KEBAB_MENU_BUTTON_CLICKED); }; const handleCodeMenuButtonOpenChange = (isOpen: boolean) => { if (isOpen) { - sendTrackingEvent(trackingEvents.CODE_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.CODE_BUTTON_CLICKED); } setIsCodeButtonMenuOpen(isOpen); }; const handleCodeButtonClick = () => { - sendTrackingEvent(trackingEvents.CODE_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.CODE_BUTTON_CLICKED); if (codeContext && codeContext.spans.assets.length === 1) { const { spanCodeObjectId } = codeContext.spans.assets[0]; changeScope(spanCodeObjectId); @@ -262,7 +262,7 @@ export const Navigation = () => { }; const handleEnvironmentChange = (environment: Environment) => { - sendTrackingEvent(trackingEvents.ENVIRONMENT_SELECTED); + sendUserActionTrackingEvent(trackingEvents.ENVIRONMENT_SELECTED); setIsEnvironmentMenuOpen(false); const environmentToChange = environments.find( diff --git a/src/components/Notifications/ErrorEmptyState/index.tsx b/src/components/Notifications/ErrorEmptyState/index.tsx index 6a201e2ba..a8dc2283c 100644 --- a/src/components/Notifications/ErrorEmptyState/index.tsx +++ b/src/components/Notifications/ErrorEmptyState/index.tsx @@ -1,5 +1,5 @@ import { SLACK_WORKSPACE_URL } from "../../../constants"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; import { SlackLogoIcon } from "../../common/icons/SlackLogoIcon"; import { EmptyState } from "../EmptyState"; import * as s from "./styles"; diff --git a/src/components/Notifications/index.tsx b/src/components/Notifications/index.tsx index d6b01d3a1..0eda44ba9 100644 --- a/src/components/Notifications/index.tsx +++ b/src/components/Notifications/index.tsx @@ -3,8 +3,9 @@ import { dispatcher } from "../../dispatcher"; import { usePrevious } from "../../hooks/usePrevious"; import { isBoolean } from "../../typeGuards/isBoolean"; import { isNumber } from "../../typeGuards/isNumber"; +import { sendTrackingEvent } from "../../utils/actions/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { addPrefix } from "../../utils/addPrefix"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; import { FullView } from "./FullView"; import { RecentView } from "./RecentView"; import * as s from "./styles"; @@ -36,6 +37,7 @@ const TRACKING_PREFIX = "notifications"; export const trackingEvents = addPrefix( TRACKING_PREFIX, { + PAGE_LOADED: "page loaded", LINK_CLICKED: "link clicked", VIEW_ALL_LINK_CLICKED: "view all link clicked" }, @@ -65,6 +67,8 @@ export const Notifications = (props: NotificationsProps) => { action: actions.INITIALIZE }); + sendTrackingEvent(trackingEvents.PAGE_LOADED); + window.sendMessageToDigma({ action: actions.GET_DATA, payload: { @@ -165,7 +169,7 @@ export const Notifications = (props: NotificationsProps) => { }; const handleGoToNotifications = () => { - sendTrackingEvent(trackingEvents.VIEW_ALL_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.VIEW_ALL_LINK_CLICKED); window.sendMessageToDigma({ action: actions.GO_TO_NOTIFICATIONS }); @@ -176,7 +180,7 @@ export const Notifications = (props: NotificationsProps) => { }; const handleLinkClick = (codeObjectData: GoToInsightsPayload) => { - sendTrackingEvent(trackingEvents.LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.LINK_CLICKED); window.sendMessageToDigma({ action: actions.GO_TO_INSIGHTS, payload: { ...codeObjectData } diff --git a/src/components/RecentActivity/AddEnvironmentDialog/index.tsx b/src/components/RecentActivity/AddEnvironmentDialog/index.tsx index e2286dbe7..3e039a946 100644 --- a/src/components/RecentActivity/AddEnvironmentDialog/index.tsx +++ b/src/components/RecentActivity/AddEnvironmentDialog/index.tsx @@ -7,7 +7,7 @@ import { useState } from "react"; import { DefaultTheme, useTheme } from "styled-components"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { Button } from "../../common/Button"; import { TextField } from "../../common/TextField"; import { CrossIcon } from "../../common/icons/CrossIcon"; @@ -91,7 +91,7 @@ export const AddEnvironmentDialog = (props: AddEnvironmentDialogProps) => { }; const handleNextButtonClick = () => { - sendTrackingEvent( + sendUserActionTrackingEvent( trackingEvents.NAVIGATED_TO_THE_NEWLY_CREATED_PENDING_ENVIRONMENT ); props.onEnvironmentAdd(textFieldValue); diff --git a/src/components/RecentActivity/EnvironmentInstructionsPanel/index.tsx b/src/components/RecentActivity/EnvironmentInstructionsPanel/index.tsx index 844571abc..239ef817f 100644 --- a/src/components/RecentActivity/EnvironmentInstructionsPanel/index.tsx +++ b/src/components/RecentActivity/EnvironmentInstructionsPanel/index.tsx @@ -2,8 +2,8 @@ import { useContext, useState } from "react"; import { useTheme } from "styled-components"; import { actions as globalActions } from "../../../actions"; import { CENTRAL_ON_PREM_INSTALLATION_GUIDE_URL } from "../../../constants"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; import { getHostnameFromURL } from "../../../utils/getHostNameFromURL"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; import { ConfigContext } from "../../common/App/ConfigContext"; import { getThemeKind } from "../../common/App/styles"; import { EnvironmentType } from "../../common/App/types"; diff --git a/src/components/RecentActivity/EnvironmentPanel/index.tsx b/src/components/RecentActivity/EnvironmentPanel/index.tsx index ba1fbff6c..71ee6aa96 100644 --- a/src/components/RecentActivity/EnvironmentPanel/index.tsx +++ b/src/components/RecentActivity/EnvironmentPanel/index.tsx @@ -4,8 +4,8 @@ import { RECENT_ACTIVITY_CONTAINER_ID } from ".."; import { actions as globalActions } from "../../../actions"; import { SLACK_WORKSPACE_URL } from "../../../constants"; import { SetObservabilityPayload } from "../../../types"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { MenuList } from "../../Navigation/common/MenuList"; import { ListItemIconContainer } from "../../Navigation/common/MenuList/styles"; import { Popup } from "../../Navigation/common/Popup"; @@ -154,9 +154,12 @@ export const EnvironmentPanel = (props: EnvironmentPanelProps) => { document.getElementById(RECENT_ACTIVITY_CONTAINER_ID) || undefined; const handleObservabilityChange = (value: boolean) => { - sendTrackingEvent(trackingEvents.OBSERVABILITY_TOGGLE_SWITCHED, { - value - }); + sendUserActionTrackingEvent( + trackingEvents.OBSERVABILITY_TOGGLE_SWITCHED, + { + value + } + ); window.sendMessageToDigma({ action: globalActions.SET_OBSERVABILITY, payload: { diff --git a/src/components/RecentActivity/EnvironmentTypePanel/index.tsx b/src/components/RecentActivity/EnvironmentTypePanel/index.tsx index 223d48657..4c96b0795 100644 --- a/src/components/RecentActivity/EnvironmentTypePanel/index.tsx +++ b/src/components/RecentActivity/EnvironmentTypePanel/index.tsx @@ -1,6 +1,6 @@ import { useContext } from "react"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { ConfigContext } from "../../common/App/ConfigContext"; import { DeploymentType, EnvironmentType } from "../../common/App/types"; import { IconTag } from "../../common/IconTag"; @@ -22,9 +22,12 @@ export const EnvironmentTypePanel = (props: EnvironmentTypePanelProps) => { const typeData = environmentTypes.find((x) => x.type === type); if (typeData) { - sendTrackingEvent(trackingEvents.ENVIRONMENT_TYPE_BUTTON_CLICKED, { - type: typeData.title - }); + sendUserActionTrackingEvent( + trackingEvents.ENVIRONMENT_TYPE_BUTTON_CLICKED, + { + type: typeData.title + } + ); } if (type === "shared" && !isHelmDeployment) { diff --git a/src/components/RecentActivity/SetupOrgDigmaPanel/index.tsx b/src/components/RecentActivity/SetupOrgDigmaPanel/index.tsx index 40a601aa7..29fd21d65 100644 --- a/src/components/RecentActivity/SetupOrgDigmaPanel/index.tsx +++ b/src/components/RecentActivity/SetupOrgDigmaPanel/index.tsx @@ -6,9 +6,10 @@ import { } from "../../../constants"; import { dispatcher } from "../../../dispatcher"; import { usePrevious } from "../../../hooks/usePrevious"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; +import { sendTrackingEvent } from "../../../utils/actions/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { getHostnameFromURL } from "../../../utils/getHostNameFromURL"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { AsyncActionResultData } from "../../InstallationWizard/types"; import { ConfigContext } from "../../common/App/ConfigContext"; import { ConfigContextData } from "../../common/App/types"; @@ -177,7 +178,7 @@ export const SetupOrgDigmaPanel = (props: SetupOrgDigmaPanelProps) => { const handleFinishButtonClick = () => { const areSettingsMatch = config.digmaApiUrl === serverApiUrl; - sendTrackingEvent(trackingEvents.FINISH_BUTTON_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.FINISH_BUTTON_CLICKED, { result: areSettingsMatch ? "success" : "failure", ...(areSettingsMatch ? [] : [{ error: SETTINGS_MISMATCH_ERROR_MESSAGE }]) }); diff --git a/src/components/RecentActivity/index.tsx b/src/components/RecentActivity/index.tsx index d0b9dbb7f..544095d36 100644 --- a/src/components/RecentActivity/index.tsx +++ b/src/components/RecentActivity/index.tsx @@ -7,8 +7,8 @@ import { dispatcher } from "../../dispatcher"; import { usePrevious } from "../../hooks/usePrevious"; import { trackingEvents as globalTrackingEvents } from "../../trackingEvents"; import { ChangeEnvironmentPayload } from "../../types"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { groupBy } from "../../utils/groupBy"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; import { ConfigContext } from "../common/App/ConfigContext"; import { EnvironmentType } from "../common/App/types"; import { CursorFollower } from "../common/CursorFollower"; @@ -52,9 +52,12 @@ const viewModeOptions: ViewModeOption[] = [ ]; const handleTroubleshootButtonClick = () => { - sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, { - origin: "recent activity" - }); + sendUserActionTrackingEvent( + globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, + { + origin: "recent activity" + } + ); window.sendMessageToDigma({ action: globalActions.OPEN_TROUBLESHOOTING_GUIDE diff --git a/src/components/Tests/TestCard/index.tsx b/src/components/Tests/TestCard/index.tsx index cb95cc775..627131924 100644 --- a/src/components/Tests/TestCard/index.tsx +++ b/src/components/Tests/TestCard/index.tsx @@ -1,8 +1,9 @@ import { isString } from "../../../typeGuards/isString"; +import { sendTrackingEvent } from "../../../utils/actions/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { formatEnvironmentName } from "../../../utils/formatEnvironmentName"; import { formatTimeDistance } from "../../../utils/formatTimeDistance"; import { getDurationString } from "../../../utils/getDurationString"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { NewButton } from "../../common/NewButton"; import { Tag } from "../../common/Tag"; import { Tooltip } from "../../common/Tooltip"; @@ -63,7 +64,7 @@ const renderTestResultTag = (test: Test) => { export const TestCard = (props: TestCardProps) => { const handleTestNameClick = () => { - sendTrackingEvent(trackingEvents.TEST_NAME_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.TEST_NAME_LINK_CLICKED); window.sendMessageToDigma({ action: actions.GO_TO_SPAN_OF_TEST, payload: { @@ -75,12 +76,12 @@ export const TestCard = (props: TestCardProps) => { }; const handleTicketButtonClick = () => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED); props.onTicketInfoOpen(props.test); }; const handleTraceButtonClick = () => { - sendTrackingEvent(trackingEvents.GO_TO_TRACE_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.GO_TO_TRACE_BUTTON_CLICKED); const spanContext = props.spanContexts.find((context) => { const id = props.test.contextsSpanCodeObjectIds.find( (x) => x === context.spanCodeObjectId diff --git a/src/components/Tests/index.tsx b/src/components/Tests/index.tsx index 9e3f30d28..52e3e5415 100644 --- a/src/components/Tests/index.tsx +++ b/src/components/Tests/index.tsx @@ -10,7 +10,7 @@ import { actions as globalActions } from "../../actions"; import { dispatcher } from "../../dispatcher"; import { usePrevious } from "../../hooks/usePrevious"; import { isNumber } from "../../typeGuards/isNumber"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; +import { sendTrackingEvent } from "../../utils/actions/sendTrackingEvent"; import { ConfigContext } from "../common/App/ConfigContext"; import { MenuItem } from "../common/FilterMenu/types"; import { NewCircleLoader } from "../common/NewCircleLoader"; diff --git a/src/components/Troubleshooting/index.tsx b/src/components/Troubleshooting/index.tsx index 4f00ee85c..6f191d776 100644 --- a/src/components/Troubleshooting/index.tsx +++ b/src/components/Troubleshooting/index.tsx @@ -2,9 +2,10 @@ import { useEffect } from "react"; import { DefaultTheme, useTheme } from "styled-components"; import { actions as globalActions } from "../../actions"; import { SLACK_WORKSPACE_URL } from "../../constants"; +import { openURLInDefaultBrowser } from "../../utils/actions/openURLInDefaultBrowser"; +import { sendTrackingEvent } from "../../utils/actions/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; import { addPrefix } from "../../utils/addPrefix"; -import { openURLInDefaultBrowser } from "../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../utils/sendTrackingEvent"; import { getThemeKind } from "../common/App/styles"; import { CrossIcon } from "../common/icons/CrossIcon"; import { DockerLogoIcon } from "../common/icons/DockerLogoIcon"; @@ -86,7 +87,7 @@ export const Troubleshooting = () => { ]; const handleCloseButtonClick = () => { - sendTrackingEvent(trackingEvents.CLOSE_BUTTON_CLICKED); + sendUserActionTrackingEvent(trackingEvents.CLOSE_BUTTON_CLICKED); window.sendMessageToDigma({ action: actions.CLOSE @@ -94,7 +95,7 @@ export const Troubleshooting = () => { }; const handleRunOptionButtonClick = (key: string) => { - sendTrackingEvent(trackingEvents.RUN_OPTION_BUTTON_CLICKED, { + sendUserActionTrackingEvent(trackingEvents.RUN_OPTION_BUTTON_CLICKED, { buttonId: key }); @@ -107,7 +108,7 @@ export const Troubleshooting = () => { }; const handleSlackLinkClick = () => { - sendTrackingEvent(trackingEvents.SLACK_LINK_CLICKED); + sendUserActionTrackingEvent(trackingEvents.SLACK_LINK_CLICKED); openURLInDefaultBrowser(SLACK_WORKSPACE_URL); }; diff --git a/src/components/common/DigmaSignature/index.tsx b/src/components/common/DigmaSignature/index.tsx index 2ad38e2a9..696bc1084 100644 --- a/src/components/common/DigmaSignature/index.tsx +++ b/src/components/common/DigmaSignature/index.tsx @@ -1,5 +1,5 @@ import { MouseEvent } from "react"; -import { openURLInDefaultBrowser } from "../../../utils/openURLInDefaultBrowser"; +import { openURLInDefaultBrowser } from "../../../utils/actions/openURLInDefaultBrowser"; import { Link } from "../Link"; const DIGMA_URL = "https://digma.ai"; diff --git a/src/components/common/InsightsDescription/index.tsx b/src/components/common/InsightsDescription/index.tsx index 9bff28368..1bf43a617 100644 --- a/src/components/common/InsightsDescription/index.tsx +++ b/src/components/common/InsightsDescription/index.tsx @@ -16,14 +16,14 @@ export const ChattyApiDescription = () => ( responses or using the API more efficiently. ); -export const SessionInViewDescription = () => ( +export const EndpointSessionInViewDescription = () => ( Open Session in View is an anti-pattern in which the view rendering stage triggers DB calls because of lazy properties initialization. It is recommended to pass DTOs to the view and avoid hitting the DB. ); -export const HighNumberOfQueriesDescription = () => ( +export const EndpointHighNumberOfQueriesDescription = () => ( The high number of queries insight indicates that the current endpoint/consumer is triggering an abnormal number of DB queries. This can @@ -72,7 +72,7 @@ export const BottleneckDescription = () => ( ); -export const ScalingIssueDescription = () => ( +export const SpanScalingDescription = () => ( Scaling issues are performance problems that emerge when the code is run concurrently. Digma analyzes the correlation between concurrency and @@ -81,7 +81,7 @@ export const ScalingIssueDescription = () => ( ); -export const QueryOptimization = () => ( +export const QueryOptimizationDescription = () => ( This query has been found to be especially slow compared to other queries of the same type running against the same DB. Consider optimizing this query or diff --git a/src/components/common/JiraTicket/index.tsx b/src/components/common/JiraTicket/index.tsx index 624c2030f..dfcfa6e0d 100644 --- a/src/components/common/JiraTicket/index.tsx +++ b/src/components/common/JiraTicket/index.tsx @@ -3,9 +3,9 @@ import { useRef, useState } from "react"; import { useTheme } from "styled-components"; import { DefaultTheme } from "styled-components/dist/types"; import { isString } from "../../../typeGuards/isString"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { addPrefix } from "../../../utils/addPrefix"; import { downloadFile } from "../../../utils/downloadFile"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { CircleLoader } from "../../common/CircleLoader"; import { CircleLoaderColors } from "../../common/CircleLoader/types"; import { IconTag } from "../../common/IconTag"; @@ -17,8 +17,8 @@ import { PaperclipIcon } from "../../common/icons/12px/PaperclipIcon"; import { JiraLogoIcon } from "../../common/icons/16px/JiraLogoIcon"; import { AttachmentTag } from "./AttachmentTag"; import { Field } from "./Field"; -import { Section } from "./Section"; import { IconButton } from "./IconButton"; +import { Section } from "./Section"; import { TicketLinkButton } from "./TicketLinkButton"; import * as s from "./styles"; import { trackingEvents } from "./tracking"; @@ -50,7 +50,7 @@ export const JiraTicket = (props: JiraTicketProps) => { const prefixedTrackingEvents = addPrefix( props.tracking?.prefix || "", trackingEvents, - " " + "" ); const handleCloseButtonClick = () => { @@ -61,7 +61,7 @@ export const JiraTicket = (props: JiraTicketProps) => { field: string, value: HTMLElement | null | string ) => { - sendTrackingEvent( + sendUserActionTrackingEvent( prefixedTrackingEvents.JIRA_TICKET_FIELD_COPY_BUTTON_CLICKED, { ...(props.tracking?.additionalInfo || {}), @@ -84,7 +84,7 @@ export const JiraTicket = (props: JiraTicketProps) => { url: string; fileName: string; }) => { - sendTrackingEvent( + sendUserActionTrackingEvent( prefixedTrackingEvents.JIRA_TICKET_ATTACHMENT_DOWNLOAD_BUTTON_CLICKED, { ...(props.tracking?.additionalInfo || {}) } ); diff --git a/src/components/common/RegistrationDialog/index.tsx b/src/components/common/RegistrationDialog/index.tsx index 84d953721..c53d8d16d 100644 --- a/src/components/common/RegistrationDialog/index.tsx +++ b/src/components/common/RegistrationDialog/index.tsx @@ -1,7 +1,7 @@ import { KeyboardEvent, useEffect } from "react"; import { Controller, useForm } from "react-hook-form"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { isValidEmailFormat } from "../../../utils/isValidEmailFormat"; -import { sendTrackingEvent } from "../../../utils/sendTrackingEvent"; import { NewCircleLoader } from "../NewCircleLoader"; import { EnvelopeIcon } from "../icons/16px/EnvelopeIcon"; import { CrossIcon } from "../icons/CrossIcon"; @@ -56,11 +56,11 @@ export const RegistrationDialog = (props: RegistrationDialogProps) => { fullName: data.fullName.trim(), email: data.email }); - sendTrackingEvent("registration dialog form submitted"); + sendUserActionTrackingEvent("registration dialog form submitted"); }; const handleCloseButtonClick = () => { - sendTrackingEvent("registration dialog close button clicked"); + sendUserActionTrackingEvent("registration dialog close button clicked"); props.onClose(); }; diff --git a/src/components/common/v3/JiraButton/index.tsx b/src/components/common/v3/JiraButton/index.tsx index b6d36ee7b..51650478a 100644 --- a/src/components/common/v3/JiraButton/index.tsx +++ b/src/components/common/v3/JiraButton/index.tsx @@ -1,7 +1,7 @@ import { ForwardedRef, forwardRef, useState } from "react"; import { useTheme } from "styled-components"; -import { openURLInDefaultBrowser } from "../../../../utils/openURLInDefaultBrowser"; -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; +import { openURLInDefaultBrowser } from "../../../../utils/actions/openURLInDefaultBrowser"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; import { trackingEvents } from "../../../Insights/tracking"; import { MenuList } from "../../../Navigation/common/MenuList"; import { Popup } from "../../../Navigation/common/Popup"; @@ -30,9 +30,12 @@ export const JiraButtonComponent = ( const theme = useTheme(); const handleMenuOpenChange = (isOpen: boolean) => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType + } + ); setIsMenuOpen(isOpen); }; @@ -51,9 +54,12 @@ export const JiraButtonComponent = ( }; const handleJiraButtonClick = () => { - sendTrackingEvent(trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, { - insightType - }); + sendUserActionTrackingEvent( + trackingEvents.JIRA_TICKET_INFO_BUTTON_CLICKED, + { + insightType + } + ); openTicketInfo("jira button click"); }; diff --git a/src/components/common/v3/Pagination/index.tsx b/src/components/common/v3/Pagination/index.tsx index 863b8a392..65301a260 100644 --- a/src/components/common/v3/Pagination/index.tsx +++ b/src/components/common/v3/Pagination/index.tsx @@ -1,5 +1,6 @@ import { trackingEvents as globalTrackingEvents } from "../../../../trackingEvents"; -import { sendTrackingEvent } from "../../../../utils/sendTrackingEvent"; +import { sendUserActionTrackingEvent } from "../../../../utils/actions/sendUserActionTrackingEvent"; +import { addPrefix } from "../../../../utils/addPrefix"; import { ChevronIcon } from "../../icons/12px/ChevronIcon"; import { DoubleChevronIcon } from "../../icons/DoubleChevronIcon"; import { Direction } from "../../icons/types"; @@ -15,20 +16,20 @@ export const Pagination = ({ withDescription, trackingEventPrefix }: PaginationProps) => { + const prefixedGlobalTrackingEvents = addPrefix( + trackingEventPrefix || "", + globalTrackingEvents, + "" + ); const pageCount = Math.ceil(itemsCount / pageSize); const isPrevDisabled = page === 0; const isNextDisabled = page === pageCount - 1; const handleButtonClick = (page: number) => { - sendTrackingEvent(globalTrackingEvents.USER_ACTION, { - action: [ - trackingEventPrefix || "", - globalTrackingEvents.PAGINATION_BUTTON_CLICKED - ] - .join(" ") - .trim() - }); + sendUserActionTrackingEvent( + prefixedGlobalTrackingEvents.PAGINATION_BUTTON_CLICKED + ); onPageChange(page); }; diff --git a/src/featureFlags.ts b/src/featureFlags.ts index 701cd9e94..c6db1dc83 100644 --- a/src/featureFlags.ts +++ b/src/featureFlags.ts @@ -13,7 +13,7 @@ export const featureFlagMinBackendVersions: Record = { [FeatureFlag.IS_RECALCULATE_BUBBLE_ENABLED]: "v0.2.238", [FeatureFlag.IS_ANALYTICS_TAB_VISIBLE]: "v0.2.244", [FeatureFlag.IS_INSIGHT_MARKING_AS_READ_ENABLED]: "v0.2.250", - [FeatureFlag.IS_HIGHLIGHTS_TAB_VISIBLE]: "v0.2.261" + [FeatureFlag.IS_HIGHLIGHTS_TAB_VISIBLE]: "v0.2.263" }; export const getFeatureFlagValue = ( diff --git a/src/utils/openURLInDefaultBrowser.ts b/src/utils/actions/openURLInDefaultBrowser.ts similarity index 71% rename from src/utils/openURLInDefaultBrowser.ts rename to src/utils/actions/openURLInDefaultBrowser.ts index a4e64a830..72e3cd573 100644 --- a/src/utils/openURLInDefaultBrowser.ts +++ b/src/utils/actions/openURLInDefaultBrowser.ts @@ -1,5 +1,5 @@ -import { actions } from "../actions"; -import { isString } from "../typeGuards/isString"; +import { actions } from "../../actions"; +import { isString } from "../../typeGuards/isString"; export const openURLInDefaultBrowser = (url: string, title?: string) => { window.sendMessageToDigma({ diff --git a/src/utils/sendTrackingEvent.ts b/src/utils/actions/sendTrackingEvent.ts similarity index 68% rename from src/utils/sendTrackingEvent.ts rename to src/utils/actions/sendTrackingEvent.ts index 1127bc0e8..7af5e6735 100644 --- a/src/utils/sendTrackingEvent.ts +++ b/src/utils/actions/sendTrackingEvent.ts @@ -1,4 +1,4 @@ -import { actions } from "../actions"; +import { actions } from "../../actions"; export const sendTrackingEvent = ( eventName: string, @@ -7,8 +7,8 @@ export const sendTrackingEvent = ( window.sendMessageToDigma({ action: actions.SEND_TRACKING_EVENT, payload: { - eventName, - ...(data ? { data } : {}) + ...(data ? { data } : {}), + eventName } }); }; diff --git a/src/utils/actions/sendUserActionTrackingEvent.ts b/src/utils/actions/sendUserActionTrackingEvent.ts new file mode 100644 index 000000000..f249dbf60 --- /dev/null +++ b/src/utils/actions/sendUserActionTrackingEvent.ts @@ -0,0 +1,12 @@ +import { trackingEvents } from "../../trackingEvents"; +import { sendTrackingEvent } from "./sendTrackingEvent"; + +export const sendUserActionTrackingEvent = ( + action: string, + data?: Record +) => { + sendTrackingEvent(trackingEvents.USER_ACTION, { + ...(data ? { ...data } : {}), + action + }); +}; diff --git a/src/utils/addPrefix.ts b/src/utils/addPrefix.ts index 88a6bce31..77f8ccd7a 100644 --- a/src/utils/addPrefix.ts +++ b/src/utils/addPrefix.ts @@ -4,12 +4,12 @@ type PrefixedMap = Record; export const addPrefix = >( prefix: string, - actions: T, + entries: T, separator?: string ): PrefixedMap => { const res = {} as PrefixedMap; - for (const [key, value] of Object.entries(actions)) { + for (const [key, value] of Object.entries(entries)) { const prop = key as keyof T; res[prop] = `${prefix}${isString(separator) ? separator : "/"}${value}`; diff --git a/src/utils/getInsightTypeInfo.ts b/src/utils/getInsightTypeInfo.ts index 51e81a90a..edf1c96f9 100644 --- a/src/utils/getInsightTypeInfo.ts +++ b/src/utils/getInsightTypeInfo.ts @@ -93,7 +93,7 @@ export const getInsightTypeInfo = ( [InsightType.SpanScaling]: { icon: ScalesIcon, label: "Scaling Issue Found", - description: descriptionProvider.ScalingIssueDescription + description: descriptionProvider.SpanScalingDescription }, [InsightType.SpanUsages]: { icon: SineIcon, @@ -133,7 +133,7 @@ export const getInsightTypeInfo = ( [InsightType.EndpointSessionInView]: { icon: SQLDatabaseIcon, label: "Session in View Query Detected", - description: descriptionProvider.SessionInViewDescription + description: descriptionProvider.EndpointSessionInViewDescription }, // deprecated [InsightType.EndpointChattyApi]: { @@ -149,7 +149,7 @@ export const getInsightTypeInfo = ( [InsightType.EndpointHighNumberOfQueries]: { icon: SQLDatabaseIcon, label: "High number of queries", - description: descriptionProvider.HighNumberOfQueriesDescription + description: descriptionProvider.EndpointHighNumberOfQueriesDescription }, [InsightType.SpanNexus]: { icon: BottleneckIcon, @@ -159,18 +159,18 @@ export const getInsightTypeInfo = ( [InsightType.SpanQueryOptimization]: { icon: SQLDatabaseIcon, label: "Inefficient Query", - description: descriptionProvider.QueryOptimization + description: descriptionProvider.QueryOptimizationDescription }, // deprecated [InsightType.EndpointQueryOptimization]: { icon: SQLDatabaseIcon, label: "Inefficient Query", - description: descriptionProvider.QueryOptimization + description: descriptionProvider.QueryOptimizationDescription }, [InsightType.EndpointQueryOptimizationV2]: { icon: SQLDatabaseIcon, label: "Inefficient Query", - description: descriptionProvider.QueryOptimization + description: descriptionProvider.QueryOptimizationDescription } };