diff --git a/datahub-web-react/src/app/analytics/event.ts b/datahub-web-react/src/app/analytics/event.ts index 28cd61ff31..2734026400 100644 --- a/datahub-web-react/src/app/analytics/event.ts +++ b/datahub-web-react/src/app/analytics/event.ts @@ -35,6 +35,8 @@ export enum EventType { SearchBarExploreAllClickEvent, SearchResultsExploreAllClickEvent, SearchAcrossLineageEvent, + VisualLineageViewEvent, + VisualLineageExpandGraphEvent, SearchAcrossLineageResultsViewEvent, DownloadAsCsvEvent, SignUpEvent, @@ -340,12 +342,23 @@ export interface HomePageRecommendationClickEvent extends BaseEvent { index?: number; } +export interface VisualLineageViewEvent extends BaseEvent { + type: EventType.VisualLineageViewEvent; + entityType?: EntityType; +} + +export interface VisualLineageExpandGraphEvent extends BaseEvent { + type: EventType.VisualLineageExpandGraphEvent; + targetEntityType?: EntityType; +} + export interface SearchAcrossLineageEvent extends BaseEvent { type: EventType.SearchAcrossLineageEvent; query: string; entityTypeFilter?: EntityType; pageNumber: number; originPath: string; + maxDegree?: string; } export interface SearchAcrossLineageResultsViewEvent extends BaseEvent { type: EventType.SearchAcrossLineageResultsViewEvent; @@ -353,6 +366,7 @@ export interface SearchAcrossLineageResultsViewEvent extends BaseEvent { entityTypeFilter?: EntityType; page?: number; total: number; + maxDegree?: string; } export interface DownloadAsCsvEvent extends BaseEvent { @@ -641,6 +655,8 @@ export type Event = | RecommendationImpressionEvent | SearchAcrossLineageEvent | SearchAcrossLineageResultsViewEvent + | VisualLineageViewEvent + | VisualLineageExpandGraphEvent | DownloadAsCsvEvent | RecommendationClickEvent | HomePageRecommendationClickEvent diff --git a/datahub-web-react/src/app/entity/shared/components/styled/search/EmbeddedListSearch.tsx b/datahub-web-react/src/app/entity/shared/components/styled/search/EmbeddedListSearch.tsx index 4119a341c5..e27a63b98f 100644 --- a/datahub-web-react/src/app/entity/shared/components/styled/search/EmbeddedListSearch.tsx +++ b/datahub-web-react/src/app/entity/shared/components/styled/search/EmbeddedListSearch.tsx @@ -7,7 +7,7 @@ import { FacetMetadata, SearchAcrossEntitiesInput, } from '../../../../../../types.generated'; -import { UnionType } from '../../../../../search/utils/constants'; +import { DEGREE_FILTER_NAME, UnionType } from '../../../../../search/utils/constants'; import { SearchCfg } from '../../../../../../conf'; import { EmbeddedListSearchResults } from './EmbeddedListSearchResults'; import EmbeddedListSearchHeader from './EmbeddedListSearchHeader'; @@ -27,6 +27,7 @@ import { import { useEntityContext } from '../../../EntityContext'; import { EntityActionProps } from './EntitySearchResults'; import { useUserContext } from '../../../../../context/useUserContext'; +import analytics, { EventType } from '../../../../../analytics'; const Container = styled.div` display: flex; @@ -266,6 +267,20 @@ export const EmbeddedListSearch = ({ const finalFacets = (fixedFilters && removeFixedFiltersFromFacets(fixedFilters, data?.facets || [])) || data?.facets; + // used for logging impact anlaysis events + const degreeFilter = filters.find((filter) => filter.field === DEGREE_FILTER_NAME); + + // we already have some lineage logging through Tab events, but this adds additional context, particularly degree + if (!loading && (degreeFilter?.values?.length || 0) > 0) { + analytics.event({ + type: EventType.SearchAcrossLineageResultsViewEvent, + query, + page, + total: data?.total || 0, + maxDegree: degreeFilter?.values?.sort()?.reverse()[0] || '1', + }); + } + return ( {error && } diff --git a/datahub-web-react/src/app/lineage/LineageExplorer.tsx b/datahub-web-react/src/app/lineage/LineageExplorer.tsx index 2683b9125a..ed0b26bde1 100644 --- a/datahub-web-react/src/app/lineage/LineageExplorer.tsx +++ b/datahub-web-react/src/app/lineage/LineageExplorer.tsx @@ -17,6 +17,7 @@ import { SHOW_COLUMNS_URL_PARAMS, useIsShowColumnsMode } from './utils/useIsShow import { ErrorSection } from '../shared/error/ErrorSection'; import usePrevious from '../shared/usePrevious'; import { useGetLineageTimeParams } from './utils/useGetLineageTimeParams'; +import analytics, { EventType } from '../analytics'; const DEFAULT_DISTANCE_FROM_TOP = 106; @@ -85,7 +86,13 @@ export default function LineageExplorer({ urn, type }: Props) { // they should be added to the dependency array below. useEffect(() => { setAsyncEntities({}); - }, [isHideSiblingMode, startTimeMillis, endTimeMillis]); + // this can also be our hook for emitting the tracking event + + analytics.event({ + type: EventType.VisualLineageViewEvent, + entityType: entityData?.type, + }); + }, [isHideSiblingMode, startTimeMillis, endTimeMillis, entityData?.type]); useEffect(() => { if (showColumns) { @@ -183,6 +190,10 @@ export default function LineageExplorer({ urn, type }: Props) { onLineageExpand={(asyncData: EntityAndType) => { resetAsyncEntity(asyncData.entity.urn); maybeAddAsyncLoadedEntity(asyncData); + analytics.event({ + type: EventType.VisualLineageExpandGraphEvent, + targetEntityType: asyncData?.type, + }); }} refetchCenterNode={() => { refetch().then(() => { diff --git a/metadata-service/services/src/main/java/com/linkedin/metadata/datahubusage/DataHubUsageEventType.java b/metadata-service/services/src/main/java/com/linkedin/metadata/datahubusage/DataHubUsageEventType.java index 036fb20b33..c1018e2031 100644 --- a/metadata-service/services/src/main/java/com/linkedin/metadata/datahubusage/DataHubUsageEventType.java +++ b/metadata-service/services/src/main/java/com/linkedin/metadata/datahubusage/DataHubUsageEventType.java @@ -67,6 +67,8 @@ public enum DataHubUsageEventType { MANUALLY_DELETE_LINEAGE_EVENT("ManuallyDeleteLineageEvent"), LINEAGE_GRAPH_TIME_RANGE_SELECTION_EVENT("LineageGraphTimeRangeSelectionEvent"), LINEAGE_TAB_TIME_RANGE_SELECTION_EVENT("LineageTabTimeRangeSelectionEvent"), + VISUAL_LINEAGE_EXPAND_GRAPH_EVENT("VisualLineageExpandGraphEvent"), + VISUAL_LINEAGE_VIEW_EVENT("VisualLineageViewEvent"), CREATE_QUERY_EVENT("CreateQueryEvent"), DELETE_QUERY_EVENT("DeleteQueryEvent"), UPDATE_QUERY_EVENT("UpdateQueryEvent"),