mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Notifications: Hide display of trace ID behind feature flag (#48057)
* Notifications: Hide display of trace ID behind feature flag
This commit is contained in:
@@ -54,6 +54,7 @@ export interface FeatureToggles {
|
|||||||
storageLocalUpload?: boolean;
|
storageLocalUpload?: boolean;
|
||||||
azureMonitorResourcePickerForMetrics?: boolean;
|
azureMonitorResourcePickerForMetrics?: boolean;
|
||||||
explore2Dashboard?: boolean;
|
explore2Dashboard?: boolean;
|
||||||
|
tracing?: boolean;
|
||||||
persistNotifications?: boolean;
|
persistNotifications?: boolean;
|
||||||
commandPalette?: boolean;
|
commandPalette?: boolean;
|
||||||
savedItems?: boolean;
|
savedItems?: boolean;
|
||||||
|
|||||||
@@ -215,6 +215,12 @@ var (
|
|||||||
State: FeatureStateBeta,
|
State: FeatureStateBeta,
|
||||||
FrontendOnly: true,
|
FrontendOnly: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "tracing",
|
||||||
|
Description: "Adds trace ID to error notifications",
|
||||||
|
State: FeatureStateAlpha,
|
||||||
|
FrontendOnly: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "persistNotifications",
|
Name: "persistNotifications",
|
||||||
Description: "PoC Notifications page",
|
Description: "PoC Notifications page",
|
||||||
|
|||||||
@@ -159,6 +159,10 @@ const (
|
|||||||
// Experimental Explore to Dashboard workflow
|
// Experimental Explore to Dashboard workflow
|
||||||
FlagExplore2Dashboard = "explore2Dashboard"
|
FlagExplore2Dashboard = "explore2Dashboard"
|
||||||
|
|
||||||
|
// FlagTracing
|
||||||
|
// Adds trace ID to error notifications
|
||||||
|
FlagTracing = "tracing"
|
||||||
|
|
||||||
// FlagPersistNotifications
|
// FlagPersistNotifications
|
||||||
// PoC Notifications page
|
// PoC Notifications page
|
||||||
FlagPersistNotifications = "persistNotifications"
|
FlagPersistNotifications = "persistNotifications"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import React from 'react';
|
|||||||
import { useEffectOnce } from 'react-use';
|
import { useEffectOnce } from 'react-use';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { Alert, useStyles2 } from '@grafana/ui';
|
import { Alert, useStyles2 } from '@grafana/ui';
|
||||||
import { AppNotification, timeoutMap } from 'app/types';
|
import { AppNotification, timeoutMap } from 'app/types';
|
||||||
|
|
||||||
@@ -20,6 +21,8 @@ export default function AppNotificationItem({ appNotification, onClearNotificati
|
|||||||
}, timeoutMap[appNotification.severity]);
|
}, timeoutMap[appNotification.severity]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const showTraceId = config.featureToggles.tracing && appNotification.traceId;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Alert
|
<Alert
|
||||||
severity={appNotification.severity}
|
severity={appNotification.severity}
|
||||||
@@ -29,7 +32,7 @@ export default function AppNotificationItem({ appNotification, onClearNotificati
|
|||||||
>
|
>
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<span>{appNotification.component || appNotification.text}</span>
|
<span>{appNotification.component || appNotification.text}</span>
|
||||||
{appNotification.traceId && <span className={styles.trace}>Trace ID: {appNotification.traceId}</span>}
|
{showTraceId && <span className={styles.trace}>Trace ID: {appNotification.traceId}</span>}
|
||||||
</div>
|
</div>
|
||||||
</Alert>
|
</Alert>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { formatDistanceToNow } from 'date-fns';
|
|||||||
import React, { ReactNode } from 'react';
|
import React, { ReactNode } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { Icon, IconButton, IconName, useTheme2 } from '@grafana/ui';
|
import { Icon, IconButton, IconName, useTheme2 } from '@grafana/ui';
|
||||||
import { getIconFromSeverity } from '@grafana/ui/src/components/Alert/Alert';
|
import { getIconFromSeverity } from '@grafana/ui/src/components/Alert/Alert';
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ export const StoredNotificationItem = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = getStyles(theme, severity);
|
const styles = getStyles(theme, severity);
|
||||||
|
const showTraceId = config.featureToggles.tracing && traceId;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
@@ -35,7 +37,7 @@ export const StoredNotificationItem = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.title}>{title}</div>
|
<div className={styles.title}>{title}</div>
|
||||||
<div className={styles.body}>{children}</div>
|
<div className={styles.body}>{children}</div>
|
||||||
<span className={styles.trace}>{traceId && `Trace ID: ${traceId}`}</span>
|
<span className={styles.trace}>{showTraceId && `Trace ID: ${traceId}`}</span>
|
||||||
<div className={styles.close}>
|
<div className={styles.close}>
|
||||||
<IconButton aria-label="Close alert" name="times" onClick={onRemove} size="lg" type="button" />
|
<IconButton aria-label="Close alert" name="times" onClick={onRemove} size="lg" type="button" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user