SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
import { Color } from '@signozhq/design-tokens';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { BellOff, CircleCheck, CircleOff, Flame } from '@signozhq/icons';
import { RuletypesAlertStateDTO } from 'api/generated/services/sigNoz.schemas';
import './AlertState.styles.scss';
type AlertStateProps = {
state: RuletypesAlertStateDTO | string;
showLabel?: boolean;
testId?: string;
};
export default function AlertState({
state,
showLabel,
testId,
}: AlertStateProps): JSX.Element {
let icon;
let label;
const isDarkMode = useIsDarkMode();
switch (state) {
case RuletypesAlertStateDTO.nodata:
icon = (
<CircleOff
size={18}
fill={Color.BG_SIENNA_400}
color={Color.BG_SIENNA_400}
/>
);
label = <span style={{ color: Color.BG_SIENNA_400 }}>No Data</span>;
break;
case RuletypesAlertStateDTO.disabled:
icon = (
<BellOff
size={18}
fill={Color.BG_VANILLA_400}
color={Color.BG_VANILLA_400}
/>
);
label = <span style={{ color: Color.BG_VANILLA_400 }}>Muted</span>;
break;
case RuletypesAlertStateDTO.firing:
icon = (
<Flame size={18} fill={Color.BG_CHERRY_500} color={Color.BG_CHERRY_500} />
);
label = <span style={{ color: Color.BG_CHERRY_500 }}>Firing</span>;
break;
case RuletypesAlertStateDTO.inactive:
case 'normal': // legacy
icon = (
<CircleCheck
size={18}
fill={Color.BG_FOREST_500}
color={isDarkMode ? Color.BG_INK_400 : Color.BG_VANILLA_100}
/>
);
label = <span style={{ color: Color.BG_FOREST_500 }}>Resolved</span>;
break;
default:
icon = null;
}
return (
<div className="alert-state" data-testid={testId}>
{icon} {showLabel && <div className="alert-state__label">{label}</div>}
</div>
);
}
AlertState.defaultProps = {
showLabel: false,
testId: undefined,
};