Browse Source

feat(ui): Support 'unknown' level (#38539)

Evan Purkhiser 2 years ago
parent
commit
a429bcedd3

+ 1 - 0
static/app/components/eventOrGroupHeader.tsx

@@ -65,6 +65,7 @@ function EventOrGroupHeader({
         {!hideLevel && level && (
           <Tooltip
             skipWrapper
+            disabled={level === 'unknown'}
             title={tct('Error level: [level]', {level: capitalize(level)})}
           >
             <GroupLevel level={level} />

+ 3 - 1
static/app/components/events/interfaces/spans/utils.tsx

@@ -887,7 +887,7 @@ export function getCumulativeAlertLevelFromErrors(
   return ERROR_LEVEL_TO_ALERT_TYPE[highestErrorLevel];
 }
 
-// Maps the six known error levels to one of three Alert component types
+// Maps the known error levels to an Alert component types
 const ERROR_LEVEL_TO_ALERT_TYPE: Record<TraceError['level'], keyof Theme['alert']> = {
   fatal: 'error',
   error: 'error',
@@ -895,6 +895,7 @@ const ERROR_LEVEL_TO_ALERT_TYPE: Record<TraceError['level'], keyof Theme['alert'
   warning: 'warning',
   sample: 'info',
   info: 'info',
+  unknown: 'muted',
 };
 
 // Allows sorting errors according to their level of severity
@@ -905,6 +906,7 @@ const ERROR_LEVEL_WEIGHTS: Record<TraceError['level'], number> = {
   warning: 3,
   sample: 2,
   info: 1,
+  unknown: 0,
 };
 
 /**

+ 1 - 1
static/app/types/event.tsx

@@ -10,7 +10,7 @@ import type {RawStacktrace, StackTraceMechanism, StacktraceType} from './stacktr
 // TODO(epurkhiser): objc and cocoa should almost definitely be moved into PlatformKey
 export type PlatformType = PlatformKey | 'objc' | 'cocoa';
 
-export type Level = 'error' | 'fatal' | 'info' | 'warning' | 'sample';
+export type Level = 'error' | 'fatal' | 'info' | 'warning' | 'sample' | 'unknown';
 
 /**
  * Grouping Configuration.

+ 1 - 0
static/app/utils/theme.tsx

@@ -481,6 +481,7 @@ const generateLevelTheme = (colors: BaseColors) => ({
   error: '#FF7738',
   fatal: colors.red300,
   default: colors.gray300,
+  unknown: colors.gray200,
 });
 
 const generateButtonTheme = (colors: BaseColors, alias: Aliases) => ({