Skip to content

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.

2.1 KB
Raw Blame
import { OPERATORS } from 'constants/queryBuilder';
import { ChartBar, DraftingCompass, ScrollText } from '@signozhq/icons';

/**
 * Supported operators for filtering with their display properties
 */
export const SUPPORTED_OPERATORS = {
	[OPERATORS['=']]: {
		label: 'Is this',
		icon: '=',
		value: '=',
	},
	[OPERATORS['!=']]: {
		label: 'Is not this',
		icon: '!=',
		value: '!=',
	},
	[OPERATORS['>=']]: {
		label: 'Is greater than or equal to',
		icon: '>=',
		value: '>=',
	},
	[OPERATORS['<=']]: {
		label: 'Is less than or equal to',
		icon: '<=',
		value: '<=',
	},
	[OPERATORS['<']]: {
		label: 'Is less than',
		icon: '<',
		value: '<',
	},
};

/**
 * Aggregate menu options for different views
 */
// TO REMOVE
export const AGGREGATE_OPTIONS = [
	{
		key: 'view_logs',
		icon: <ScrollText size={16} />,
		label: 'View in Logs',
	},
	// {
	// 	key: 'view_metrics',
	// 	icon: <BarChart2 size={16} />,
	// 	label: 'View in Metrics',
	// },
	{
		key: 'view_traces',
		icon: <DraftingCompass size={16} />,
		label: 'View in Traces',
	},
	{
		key: 'breakout',
		icon: <ChartBar size={16} />,
		label: 'Breakout by ..',
	},
];

/**
 * Aggregate menu options for different views
 */
export const getBaseContextConfig = ({
	handleBaseDrilldown,
	setSubMenu,
	showBreakoutOption,
}: {
	handleBaseDrilldown: (key: string) => void;
	setSubMenu: (subMenu: string) => void;
	showBreakoutOption: boolean;
}): {
	key: string;
	icon: React.ReactNode;
	label: string;
	onClick: () => void;
	hidden?: boolean;
}[] => [
	{
		key: 'view_logs',
		icon: <ScrollText size={16} />,
		label: 'View in Logs',
		onClick: (): void => handleBaseDrilldown('view_logs'),
	},
	// {
	// 	key: 'view_metrics',
	// 	icon: <BarChart2 size={16} />,
	// 	label: 'View in Metrics',
	// 	onClick: () => handleBaseDrilldown('view_metrics'),
	// },
	{
		key: 'view_traces',
		icon: <DraftingCompass size={16} />,
		label: 'View in Traces',
		onClick: (): void => handleBaseDrilldown('view_traces'),
	},
	{
		key: 'breakout',
		icon: <ChartBar size={16} />,
		label: 'Breakout by ..',
		onClick: (): void => setSubMenu('breakout'),
		hidden: !showBreakoutOption,
	},
];