diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index acc2a12fa63..61741409adc 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -54,6 +54,7 @@ export interface FeatureToggles { storageLocalUpload?: boolean; azureMonitorResourcePickerForMetrics?: boolean; explore2Dashboard?: boolean; + tracing?: boolean; persistNotifications?: boolean; commandPalette?: boolean; savedItems?: boolean; diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 12871130853..8458c57093b 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -215,6 +215,12 @@ var ( State: FeatureStateBeta, FrontendOnly: true, }, + { + Name: "tracing", + Description: "Adds trace ID to error notifications", + State: FeatureStateAlpha, + FrontendOnly: true, + }, { Name: "persistNotifications", Description: "PoC Notifications page", diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 3b9b0e59a67..18ebac24d06 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -159,6 +159,10 @@ const ( // Experimental Explore to Dashboard workflow FlagExplore2Dashboard = "explore2Dashboard" + // FlagTracing + // Adds trace ID to error notifications + FlagTracing = "tracing" + // FlagPersistNotifications // PoC Notifications page FlagPersistNotifications = "persistNotifications" diff --git a/public/app/core/components/AppNotifications/AppNotificationItem.tsx b/public/app/core/components/AppNotifications/AppNotificationItem.tsx index 3ec1a2b59a2..a02b1e2edb6 100644 --- a/public/app/core/components/AppNotifications/AppNotificationItem.tsx +++ b/public/app/core/components/AppNotifications/AppNotificationItem.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { useEffectOnce } from 'react-use'; import { GrafanaTheme2 } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { Alert, useStyles2 } from '@grafana/ui'; import { AppNotification, timeoutMap } from 'app/types'; @@ -20,6 +21,8 @@ export default function AppNotificationItem({ appNotification, onClearNotificati }, timeoutMap[appNotification.severity]); }); + const showTraceId = config.featureToggles.tracing && appNotification.traceId; + return (
{appNotification.component || appNotification.text} - {appNotification.traceId && Trace ID: {appNotification.traceId}} + {showTraceId && Trace ID: {appNotification.traceId}}
); diff --git a/public/app/core/components/AppNotifications/StoredNotificationItem.tsx b/public/app/core/components/AppNotifications/StoredNotificationItem.tsx index d6fe2992b5a..57b612db7ae 100644 --- a/public/app/core/components/AppNotifications/StoredNotificationItem.tsx +++ b/public/app/core/components/AppNotifications/StoredNotificationItem.tsx @@ -3,6 +3,7 @@ import { formatDistanceToNow } from 'date-fns'; import React, { ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { Icon, IconButton, IconName, useTheme2 } from '@grafana/ui'; import { getIconFromSeverity } from '@grafana/ui/src/components/Alert/Alert'; @@ -27,6 +28,7 @@ export const StoredNotificationItem = ({ }: Props) => { const theme = useTheme2(); const styles = getStyles(theme, severity); + const showTraceId = config.featureToggles.tracing && traceId; return (
@@ -35,7 +37,7 @@ export const StoredNotificationItem = ({
{title}
{children}
- {traceId && `Trace ID: ${traceId}`} + {showTraceId && `Trace ID: ${traceId}`}