Skip to content

Commit

Permalink
feat(explore): Adding perf unit quota flag to metadata analytics even…
Browse files Browse the repository at this point in the history
…t. (#82950)

Co-authored-by: Abdullah Khan <[email protected]>
  • Loading branch information
Abdkhan14 and Abdullah Khan authored Jan 6, 2025
1 parent 28bd8e7 commit 60cb2d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions static/app/utils/analytics/tracingEventMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type TracingEventParameters = {
'trace.explorer.metadata': {
columns: string[];
columns_count: number;
has_exceeded_performance_usage_limit: boolean | null;
query_status: 'success' | 'error';
result_length: number;
result_missing_root: number;
Expand Down
11 changes: 10 additions & 1 deletion static/app/views/explore/hooks/useAnalytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {UseApiQueryResult} from 'sentry/utils/queryClient';
import type RequestError from 'sentry/utils/requestError/requestError';
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
import type {Visualize} from 'sentry/views/explore/contexts/pageParamsContext/visualizes';
import {usePerformanceSubscriptionDetails} from 'sentry/views/performance/newTraceDetails/traceTypeWarnings/usePerformanceSubscriptionDetails';

export function useAnalytics({
dataset,
Expand All @@ -33,8 +34,13 @@ export function useAnalytics({
resultMissingRoot?: number;
title?: string;
}) {
const {
data: {hasExceededPerformanceUsageLimit},
isLoading: isLoadingSubscriptionDetails,
} = usePerformanceSubscriptionDetails();

useEffect(() => {
if (resultStatus === 'pending') {
if (resultStatus === 'pending' || isLoadingSubscriptionDetails) {
return;
}

Expand All @@ -54,6 +60,7 @@ export function useAnalytics({
visualizes,
visualizes_count: visualizes.length,
title,
has_exceeded_performance_usage_limit: hasExceededPerformanceUsageLimit,
};

trackAnalytics('trace.explorer.metadata', params);
Expand All @@ -62,6 +69,8 @@ export function useAnalytics({
resultLength,
resultMissingRoot,
resultMode,
isLoadingSubscriptionDetails,
hasExceededPerformanceUsageLimit,
resultStatus,
visualizes,
columns,
Expand Down

0 comments on commit 60cb2d7

Please sign in to comment.