mirror of
https://github.com/SigNoz/signoz.git
synced 2026-05-27 04:10:28 +01:00
Compare commits
6 Commits
chore/migr
...
ns/flamegr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
168b2eaa9c | ||
|
|
6b613f18a3 | ||
|
|
1b0447181d | ||
|
|
20edff4771 | ||
|
|
2048ef3d2f | ||
|
|
53c551359e |
@@ -434,6 +434,17 @@ tracedetail:
|
||||
max_depth_to_auto_expand: 5
|
||||
# Threshold below which all spans are returned without windowing.
|
||||
max_limit_to_select_all_spans: 10000
|
||||
flamegraph:
|
||||
# Maximum number of BFS depth levels included in a windowed response.
|
||||
max_selected_levels: 50
|
||||
# Maximum spans per level before sampling is applied.
|
||||
max_spans_per_level: 100
|
||||
# Number of highest-latency spans always included when sampling a level.
|
||||
sampling_top_latency_count: 5
|
||||
# Number of timestamp buckets used for uniform sampling within a level.
|
||||
sampling_bucket_count: 50
|
||||
# Threshold below which all spans are returned without windowing or sampling.
|
||||
select_all_spans_limit: 100000
|
||||
|
||||
##################### Authz #################################
|
||||
authz:
|
||||
|
||||
@@ -19,7 +19,6 @@ const BANNED_COMPONENTS = {
|
||||
Switch: 'Use @signozhq/ui/switch Switch instead of antd Switch.',
|
||||
Badge: 'Use @signozhq/ui/badge instead of antd Badge.',
|
||||
Progress: 'Use @signozhq/ui/progress instead of antd Progress.',
|
||||
Tag: 'Use @signozhq/ui/badge Bagde instead of antd Tag.',
|
||||
};
|
||||
|
||||
export default {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Select, Tooltip } from 'antd';
|
||||
import { Select, Tag, Tooltip } from 'antd';
|
||||
import {
|
||||
OPERATORS,
|
||||
QUERY_BUILDER_OPERATORS_BY_TYPES,
|
||||
@@ -37,7 +37,7 @@ import { validationMapper } from 'hooks/queryBuilder/useIsValidTag';
|
||||
import { operatorTypeMapper } from 'hooks/queryBuilder/useOperatorType';
|
||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||
import { isArray, isEmpty, isEqual, isObject } from 'lodash-es';
|
||||
import { ChevronDown, ChevronUp, X } from '@signozhq/icons';
|
||||
import { ChevronDown, ChevronUp } from '@signozhq/icons';
|
||||
import type { BaseSelectRef } from 'rc-select';
|
||||
import {
|
||||
BaseAutocompleteData,
|
||||
@@ -51,7 +51,6 @@ import { popupContainer } from 'utils/selectPopupContainer';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import './ClientSideQBSearch.styles.scss';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
|
||||
export interface AttributeKey {
|
||||
key: string;
|
||||
@@ -548,7 +547,11 @@ function ClientSideQBSearch(
|
||||
|
||||
return (
|
||||
<span className="qb-search-bar-tokenised-tags">
|
||||
<Badge color="vanilla" className={tagDetails?.key?.type || ''}>
|
||||
<Tag
|
||||
closable={!searchValue && closable}
|
||||
onClose={onCloseHandler}
|
||||
className={tagDetails?.key?.type || ''}
|
||||
>
|
||||
<Tooltip title={chipValue}>
|
||||
<TypographyText
|
||||
$isInNin={isInNin}
|
||||
@@ -563,15 +566,7 @@ function ClientSideQBSearch(
|
||||
{chipValue}
|
||||
</TypographyText>
|
||||
</Tooltip>
|
||||
{!searchValue && closable && (
|
||||
<X
|
||||
size={12}
|
||||
className="close-icon"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={onCloseHandler}
|
||||
/>
|
||||
)}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button, Modal } from 'antd';
|
||||
import { Button, Modal, Tag } from 'antd';
|
||||
import { CircleAlert, X } from '@signozhq/icons';
|
||||
import KeyValueLabel from 'periscope/components/KeyValueLabel';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
@@ -9,7 +9,6 @@ import APIError from 'types/api/error';
|
||||
import ErrorContent from './components/ErrorContent';
|
||||
|
||||
import './ErrorModal.styles.scss';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
|
||||
type Props = {
|
||||
error: APIError;
|
||||
@@ -46,17 +45,14 @@ function ErrorModal({
|
||||
return (
|
||||
<>
|
||||
{!triggerComponent ? (
|
||||
<span
|
||||
<Tag
|
||||
className="error-modal__trigger"
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
icon={<CircleAlert size={14} color={Color.BG_CHERRY_500} />}
|
||||
color="error"
|
||||
onClick={(): void => setVisible(true)}
|
||||
onKeyDown={undefined}
|
||||
>
|
||||
<Badge color="error">
|
||||
<CircleAlert size={14} color={Color.BG_CHERRY_500} /> error
|
||||
</Badge>
|
||||
</span>
|
||||
error
|
||||
</Tag>
|
||||
) : (
|
||||
React.cloneElement(triggerComponent, {
|
||||
onClick: () => setVisible(true),
|
||||
|
||||
@@ -14,8 +14,7 @@ import { Color } from '@signozhq/design-tokens';
|
||||
import { copilot } from '@uiw/codemirror-theme-copilot';
|
||||
import { githubLight } from '@uiw/codemirror-theme-github';
|
||||
import CodeMirror, { EditorView, keymap, Prec } from '@uiw/react-codemirror';
|
||||
import { Button, Card, Collapse, Popover, Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Card, Collapse, Popover, Tag, Tooltip } from 'antd';
|
||||
import { getKeySuggestions } from 'api/querySuggestions/getKeySuggestions';
|
||||
import { getValueSuggestions } from 'api/querySuggestions/getValueSuggestion';
|
||||
import cx from 'classnames';
|
||||
@@ -665,26 +664,26 @@ function QuerySearch({
|
||||
// Helper function to render a badge for the current context mode
|
||||
const renderContextBadge = (): JSX.Element => {
|
||||
if (!editingMode) {
|
||||
return <Badge color="vanilla">Unknown</Badge>;
|
||||
return <Tag>Unknown</Tag>;
|
||||
}
|
||||
|
||||
switch (editingMode) {
|
||||
case 'key':
|
||||
return <Badge color="robin">Key</Badge>;
|
||||
return <Tag color="blue">Key</Tag>;
|
||||
case 'operator':
|
||||
return <Badge color="sakura">Operator</Badge>;
|
||||
return <Tag color="purple">Operator</Tag>;
|
||||
case 'value':
|
||||
return <Badge color="forest">Value</Badge>;
|
||||
return <Tag color="green">Value</Tag>;
|
||||
case 'conjunction':
|
||||
return <Badge color="amber">Conjunction</Badge>;
|
||||
return <Tag color="orange">Conjunction</Tag>;
|
||||
case 'function':
|
||||
return <Badge color="aqua">Function</Badge>;
|
||||
return <Tag color="cyan">Function</Tag>;
|
||||
case 'parenthesis':
|
||||
return <Badge color="sakura">Parenthesis</Badge>;
|
||||
return <Tag color="magenta">Parenthesis</Tag>;
|
||||
case 'bracketList':
|
||||
return <Badge color="cherry">Bracket List</Badge>;
|
||||
return <Tag color="red">Bracket List</Tag>;
|
||||
default:
|
||||
return <Badge color="vanilla">Unknown</Badge>;
|
||||
return <Tag>Unknown</Tag>;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1305,37 +1304,34 @@ function QuerySearch({
|
||||
Currently editing: {renderContextBadge()}
|
||||
{queryContext?.keyToken && (
|
||||
<span className="triplet-info">
|
||||
Key: <Badge color="vanilla">{queryContext.keyToken}</Badge>
|
||||
Key: <Tag>{queryContext.keyToken}</Tag>
|
||||
</span>
|
||||
)}
|
||||
{queryContext?.operatorToken && (
|
||||
<span className="triplet-info">
|
||||
Operator: <Badge color="vanilla">{queryContext.operatorToken}</Badge>
|
||||
Operator: <Tag>{queryContext.operatorToken}</Tag>
|
||||
</span>
|
||||
)}
|
||||
{queryContext?.valueToken && (
|
||||
<span className="triplet-info">
|
||||
Value: <Badge color="vanilla">{queryContext.valueToken}</Badge>
|
||||
Value: <Tag>{queryContext.valueToken}</Tag>
|
||||
</span>
|
||||
)}
|
||||
{queryContext?.currentPair && (
|
||||
<span className="triplet-info query-pair-info">
|
||||
Current pair: <Badge color="robin">{queryContext.currentPair.key}</Badge>
|
||||
<Badge color="sakura">{queryContext.currentPair.operator}</Badge>
|
||||
Current pair: <Tag color="blue">{queryContext.currentPair.key}</Tag>
|
||||
<Tag color="purple">{queryContext.currentPair.operator}</Tag>
|
||||
{queryContext.currentPair.value && (
|
||||
<Badge color="forest">{queryContext.currentPair.value}</Badge>
|
||||
<Tag color="green">{queryContext.currentPair.value}</Tag>
|
||||
)}
|
||||
<Badge
|
||||
color={queryContext.currentPair.isComplete ? 'success' : 'warning'}
|
||||
>
|
||||
<Tag color={queryContext.currentPair.isComplete ? 'success' : 'warning'}>
|
||||
{queryContext.currentPair.isComplete ? 'Complete' : 'Incomplete'}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</span>
|
||||
)}
|
||||
{queryContext?.queryPairs && queryContext.queryPairs.length > 0 && (
|
||||
<span className="triplet-info">
|
||||
Total pairs:{' '}
|
||||
<Badge color="robin">{queryContext.queryPairs.length}</Badge>
|
||||
Total pairs: <Tag color="blue">{queryContext.queryPairs.length}</Tag>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Popover } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Popover, Tag } from 'antd';
|
||||
|
||||
import { LabelColumnProps } from './TableRenderer.types';
|
||||
import TagWithToolTip from './TagWithToolTip';
|
||||
@@ -7,7 +6,7 @@ import { getLabelAndValueContent } from './utils';
|
||||
|
||||
import './LabelColumn.styles.scss';
|
||||
|
||||
function LabelColumn({ labels, value }: LabelColumnProps): JSX.Element {
|
||||
function LabelColumn({ labels, value, color }: LabelColumnProps): JSX.Element {
|
||||
const newLabels = labels.length > 3 ? labels.slice(0, 3) : labels;
|
||||
const remainingLabels = labels.length > 3 ? labels.slice(3) : [];
|
||||
|
||||
@@ -15,7 +14,7 @@ function LabelColumn({ labels, value }: LabelColumnProps): JSX.Element {
|
||||
<div className="label-column">
|
||||
{newLabels.map(
|
||||
(label: string): JSX.Element => (
|
||||
<TagWithToolTip key={label} label={label} value={value} />
|
||||
<TagWithToolTip key={label} label={label} color={color} value={value} />
|
||||
),
|
||||
)}
|
||||
{remainingLabels.length > 0 && (
|
||||
@@ -27,9 +26,9 @@ function LabelColumn({ labels, value }: LabelColumnProps): JSX.Element {
|
||||
{labels.map(
|
||||
(label: string): JSX.Element => (
|
||||
<div key={label}>
|
||||
<Badge className="label-column--tag" color="vanilla">
|
||||
<Tag className="label-column--tag" color={color}>
|
||||
{getLabelAndValueContent(label, value && value[label])}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
@@ -37,9 +36,9 @@ function LabelColumn({ labels, value }: LabelColumnProps): JSX.Element {
|
||||
}
|
||||
trigger="hover"
|
||||
>
|
||||
<Badge className="label-column--tag" color="vanilla">
|
||||
<Tag className="label-column--tag" color={color}>
|
||||
+{remainingLabels.length}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</Popover>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import { Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag, Tooltip } from 'antd';
|
||||
|
||||
import { getLabelRenderingValue } from './utils';
|
||||
|
||||
function TagWithToolTip({ label, value }: TagWithToolTipProps): JSX.Element {
|
||||
function TagWithToolTip({
|
||||
label,
|
||||
value,
|
||||
color,
|
||||
}: TagWithToolTipProps): JSX.Element {
|
||||
const tooltipTitle =
|
||||
value && value[label] ? `${label}: ${value[label]}` : label;
|
||||
return (
|
||||
<div key={label}>
|
||||
<Tooltip title={tooltipTitle}>
|
||||
<Badge className="label-column--tag" color="vanilla">
|
||||
<Tag className="label-column--tag" color={color}>
|
||||
{getLabelRenderingValue(label, value && value[label])}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
@@ -19,6 +22,7 @@ function TagWithToolTip({ label, value }: TagWithToolTipProps): JSX.Element {
|
||||
|
||||
type TagWithToolTipProps = {
|
||||
label: string;
|
||||
color?: string;
|
||||
value?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
@@ -26,6 +30,7 @@ type TagWithToolTipProps = {
|
||||
|
||||
TagWithToolTip.defaultProps = {
|
||||
value: undefined,
|
||||
color: undefined,
|
||||
};
|
||||
|
||||
export default TagWithToolTip;
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
.ant-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.ant-tag {
|
||||
margin-right: 0;
|
||||
background: var(--card);
|
||||
}
|
||||
}
|
||||
|
||||
.add-tag-container {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { Dispatch, SetStateAction, useState } from 'react';
|
||||
import { Check, Plus, X } from '@signozhq/icons';
|
||||
import { Button, Flex } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Flex, Tag } from 'antd';
|
||||
import Input from 'components/Input';
|
||||
|
||||
import './Tags.styles.scss';
|
||||
@@ -47,14 +46,14 @@ function Tags({ tags, setTags }: AddTagsProps): JSX.Element {
|
||||
return (
|
||||
<div className="tags-container">
|
||||
{tags.map<React.ReactNode>((tag) => (
|
||||
<Badge key={tag} color="vanilla" style={{ userSelect: 'none' }}>
|
||||
<Tag
|
||||
key={tag}
|
||||
closable
|
||||
style={{ userSelect: 'none' }}
|
||||
onClose={(): void => handleClose(tag)}
|
||||
>
|
||||
<span>{tag}</span>
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={(): void => handleClose(tag)}
|
||||
/>
|
||||
</Badge>
|
||||
</Tag>
|
||||
))}
|
||||
|
||||
{inputVisible && (
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { TableColumnType as ColumnType, Tooltip } from 'antd';
|
||||
import { TableColumnType as ColumnType, Tag, Tooltip } from 'antd';
|
||||
import { Progress } from '@signozhq/ui/progress';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { convertFiltersToExpressionWithExistingQuery } from 'components/QueryBuilderV2/utils';
|
||||
import {
|
||||
FiltersType,
|
||||
@@ -973,9 +972,13 @@ export const getEndPointsColumnsConfig = (
|
||||
})()}
|
||||
{isGroupedByAttribute
|
||||
? text.split(',').map((value) => (
|
||||
<Badge key={value} color="vanilla" className="endpoint-group-tag-item">
|
||||
<Tag
|
||||
key={value}
|
||||
color={Color.BG_SLATE_100}
|
||||
className="endpoint-group-tag-item"
|
||||
>
|
||||
{value === '' ? '<no-value>' : value}
|
||||
</Badge>
|
||||
</Tag>
|
||||
))
|
||||
: endPointName}
|
||||
</div>
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
Skeleton,
|
||||
Table,
|
||||
TableColumnsType as ColumnsType,
|
||||
Tag,
|
||||
} from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import getUsage, { UsageResponsePayloadProps } from 'api/billing/getUsage';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import updateCreditCardApi from 'api/v1/checkout/create';
|
||||
@@ -434,7 +434,7 @@ export default function BillingContainer(): JSX.Element {
|
||||
<Flex vertical>
|
||||
<Typography.Title level={5} style={{ marginTop: 2, fontWeight: 500 }}>
|
||||
{isCloudUserVal ? t('teams_cloud') : t('teams')}{' '}
|
||||
{isFreeTrial ? <Badge color="success"> Free Trial </Badge> : ''}
|
||||
{isFreeTrial ? <Tag color="success"> Free Trial </Tag> : ''}
|
||||
</Typography.Title>
|
||||
|
||||
{!isLoading && !isFetchingBillingData && !showGracePeriodMessage ? (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Row } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Row, Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { ALERTS_DATA_SOURCE_MAP } from 'constants/alerts';
|
||||
@@ -67,7 +66,13 @@ function SelectAlertType({ onSelect }: SelectAlertTypeProps): JSX.Element {
|
||||
<AlertTypeCard
|
||||
key={option.selection}
|
||||
title={option.title}
|
||||
extra={option.isBeta ? <Badge color="robin">Beta</Badge> : undefined}
|
||||
extra={
|
||||
option.isBeta ? (
|
||||
<Tag bordered={false} color="geekblue">
|
||||
Beta
|
||||
</Tag>
|
||||
) : undefined
|
||||
}
|
||||
onClick={(e): void => {
|
||||
onSelect(option.selection, isModifierKeyPressed(e));
|
||||
}}
|
||||
|
||||
@@ -16,8 +16,7 @@ import {
|
||||
Plus,
|
||||
X,
|
||||
} from '@signozhq/icons';
|
||||
import { Button, Card, Input, Modal, Popover, Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Card, Input, Modal, Popover, Tag, Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import ConfigureIcon from 'assets/Integrations/ConfigureIcon';
|
||||
@@ -507,9 +506,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
|
||||
{(tags?.length || 0) > 0 && (
|
||||
<div className="dashboard-tags">
|
||||
{tags?.map((tag) => (
|
||||
<Badge key={tag} className="tag" color="vanilla">
|
||||
<Tag key={tag} className="tag">
|
||||
{tag}
|
||||
</Badge>
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -359,7 +359,7 @@
|
||||
flex-flow: wrap;
|
||||
gap: 8px;
|
||||
|
||||
[data-slot='badge'] {
|
||||
.ant-tag {
|
||||
height: 30px;
|
||||
color: var(--l1-foreground);
|
||||
font-family: 'Space Mono';
|
||||
|
||||
@@ -5,8 +5,7 @@ import { useQuery } from 'react-query';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { orange } from '@ant-design/colors';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button, Collapse, Input, Select } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Collapse, Input, Select, Tag } from 'antd';
|
||||
import { Switch } from '@signozhq/ui/switch';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import dashboardVariablesQuery from 'api/dashboard/variables/dashboardVariablesQuery';
|
||||
@@ -543,9 +542,9 @@ function VariableItem({
|
||||
}}
|
||||
>
|
||||
Dynamic
|
||||
<Badge color="robin" className="sidenav-beta-tag">
|
||||
<Tag bordered={false} className="sidenav-beta-tag" color="geekblue">
|
||||
Beta
|
||||
</Badge>
|
||||
</Tag>
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
@@ -600,9 +599,9 @@ function VariableItem({
|
||||
}}
|
||||
>
|
||||
Query
|
||||
<Badge color="amber" className="sidenav-beta-tag">
|
||||
<Tag bordered={false} className="sidenav-beta-tag" color="warning">
|
||||
Not Recommended
|
||||
</Badge>
|
||||
</Tag>
|
||||
<div onClick={(e): void => e.stopPropagation()}>
|
||||
<TextToolTip
|
||||
text="Learn why we don't recommend"
|
||||
@@ -734,9 +733,7 @@ function VariableItem({
|
||||
<Typography style={{ color: orange[5] }}>{errorPreview}</Typography>
|
||||
) : (
|
||||
map(previewValues, (value, idx) => (
|
||||
<Badge key={`${value}${idx}`} color="vanilla">
|
||||
{value.toString()}
|
||||
</Badge>
|
||||
<Tag key={`${value}${idx}`}>{value.toString()}</Tag>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Dispatch, SetStateAction, useState } from 'react';
|
||||
import { X } from '@signozhq/icons';
|
||||
import { Col, Tooltip } from 'antd';
|
||||
import Input from 'components/Input';
|
||||
|
||||
@@ -61,7 +60,12 @@ function AddTags({ tags, setTags }: AddTagsProps): JSX.Element {
|
||||
const isLongTag = tag.length > 20;
|
||||
|
||||
const tagElem = (
|
||||
<NewTagContainer key={tag} color="vanilla" className="tag-container">
|
||||
<NewTagContainer
|
||||
closable
|
||||
key={tag}
|
||||
onClose={(): void => handleClose(tag)}
|
||||
className="tag-container"
|
||||
>
|
||||
<span
|
||||
onDoubleClick={(e): void => {
|
||||
setEditInputIndex(index);
|
||||
@@ -71,11 +75,6 @@ function AddTags({ tags, setTags }: AddTagsProps): JSX.Element {
|
||||
>
|
||||
{isLongTag ? `${tag.slice(0, 20)}...` : tag}
|
||||
</span>
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={(): void => handleClose(tag)}
|
||||
/>
|
||||
</NewTagContainer>
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Col } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Col, Tag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const TagsContainer = styled.div`
|
||||
@@ -9,7 +8,7 @@ export const TagsContainer = styled.div`
|
||||
gap: 6px;
|
||||
`;
|
||||
|
||||
export const NewTagContainer = styled(Badge)`
|
||||
export const NewTagContainer = styled(Tag)`
|
||||
&&& {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { X } from '@signozhq/icons';
|
||||
import { QueryChipContainer, QueryChipItem } from './styles';
|
||||
import { ILabelRecord } from './types';
|
||||
|
||||
@@ -14,15 +13,11 @@ export default function QueryChip({
|
||||
const { key, value } = queryData;
|
||||
return (
|
||||
<QueryChipContainer>
|
||||
<QueryChipItem color="vanilla">
|
||||
<QueryChipItem
|
||||
closable={key !== 'severity' && key !== 'description'}
|
||||
onClose={(): void => onRemove(key)}
|
||||
>
|
||||
{key}: {value}
|
||||
{key !== 'severity' && key !== 'description' && (
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={(): void => onRemove(key)}
|
||||
/>
|
||||
)}
|
||||
</QueryChipItem>
|
||||
</QueryChipContainer>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { grey } from '@ant-design/colors';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
interface SearchContainerProps {
|
||||
@@ -29,6 +29,6 @@ export const QueryChipContainer = styled.span`
|
||||
}
|
||||
`;
|
||||
|
||||
export const QueryChipItem = styled(Badge)`
|
||||
export const QueryChipItem = styled(Tag)`
|
||||
margin-right: 0.1rem;
|
||||
`;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Button, Skeleton } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Skeleton, Tag } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { useListRules } from 'api/generated/services/rules';
|
||||
import type { RuletypesRuleDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
@@ -178,14 +177,12 @@ export default function AlertRules({
|
||||
</div>
|
||||
|
||||
<div className="alert-rule-item-description home-data-item-tag">
|
||||
<Badge color="sienna" variant="outline">
|
||||
{rule?.labels?.severity}
|
||||
</Badge>
|
||||
<Tag color={rule?.labels?.severity}>{rule?.labels?.severity}</Tag>
|
||||
|
||||
{rule.state === 'firing' && (
|
||||
<Badge color="cherry" variant="outline" className="firing-tag">
|
||||
<Tag color="red" className="firing-tag">
|
||||
{rule.state}
|
||||
</Badge>
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Button, Skeleton } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Skeleton, Tag } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { useGetAllDashboard } from 'hooks/dashboard/useGetAllDashboard';
|
||||
@@ -149,9 +148,9 @@ export default function Dashboards({
|
||||
|
||||
<div className="alert-rule-item-description home-data-item-tag">
|
||||
{dashboard.data.tags?.map((tag) => (
|
||||
<Badge color="sienna" variant="outline" key={tag}>
|
||||
<Tag color={tag} key={tag}>
|
||||
{tag}
|
||||
</Badge>
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -574,7 +574,30 @@
|
||||
|
||||
.home-data-item-tag {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
|
||||
.ant-tag {
|
||||
display: flex;
|
||||
padding: 2px 12px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
border-radius: 20px;
|
||||
border: 1px solid color-mix(in srgb, var(--bg-sienna-500) 20%, transparent);
|
||||
background: color-mix(in srgb, var(--bg-sienna-500) 10%, transparent);
|
||||
|
||||
color: var(--bg-sienna-400);
|
||||
text-align: center;
|
||||
font-family: Inter;
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
line-height: 20px; /* 142.857% */
|
||||
letter-spacing: -0.07px;
|
||||
}
|
||||
|
||||
.firing-tag {
|
||||
color: var(--bg-sakura-500);
|
||||
background: color-mix(in srgb, var(--danger-background) 10%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
&.services-list-container {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Button, Skeleton } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Skeleton, Tag } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { getViewDetailsUsingViewKey } from 'components/ExplorerCard/utils';
|
||||
import ROUTES from 'constants/routes';
|
||||
@@ -250,9 +249,9 @@ export default function SavedViews({
|
||||
}
|
||||
|
||||
return (
|
||||
<Badge color="sienna" key={tag}>
|
||||
<Tag color={tag} key={tag}>
|
||||
{tag}
|
||||
</Badge>
|
||||
</Tag>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import { Progress } from '@signozhq/ui/progress';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import {
|
||||
@@ -52,14 +52,14 @@ export const hostDetailsMetadataConfig: K8sDetailsMetadataConfig<HostData>[] = [
|
||||
label: 'STATUS',
|
||||
getValue: (h): string => (h.active ? 'ACTIVE' : 'INACTIVE'),
|
||||
render: (value, h): React.ReactNode => (
|
||||
<Badge
|
||||
variant="outline"
|
||||
<Tag
|
||||
className={`${infraHostsStyles.infraMonitoringTags} ${
|
||||
h.active ? infraHostsStyles.tagsActive : infraHostsStyles.tagsInactive
|
||||
}`}
|
||||
bordered
|
||||
>
|
||||
{value}
|
||||
</Badge>
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -67,9 +67,9 @@ export const hostDetailsMetadataConfig: K8sDetailsMetadataConfig<HostData>[] = [
|
||||
getValue: (h): string => h.os || '-',
|
||||
render: (value): React.ReactNode =>
|
||||
value !== '-' ? (
|
||||
<Badge variant="outline" className={infraHostsStyles.infraMonitoringTags}>
|
||||
<Tag className={infraHostsStyles.infraMonitoringTags} bordered>
|
||||
{value}
|
||||
</Badge>
|
||||
</Tag>
|
||||
) : (
|
||||
<Typography.Text>-</Typography.Text>
|
||||
),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag, Tooltip } from 'antd';
|
||||
import { HostData } from 'api/infraMonitoring/getHostLists';
|
||||
import TanStackTable, { TableColumnDef } from 'components/TanStackTableView';
|
||||
import { getGroupByEl } from 'container/InfraMonitoringK8s/Base/utils';
|
||||
@@ -93,13 +92,14 @@ export const hostColumnsConfig: TableColumnDef<HostData>[] = [
|
||||
cell: ({ value }): React.ReactNode => {
|
||||
const active = value as boolean;
|
||||
return (
|
||||
<Badge
|
||||
<Tag
|
||||
bordered
|
||||
className={`${styles.statusTag} ${
|
||||
active ? styles.statusTagActive : styles.statusTagInactive
|
||||
}`}
|
||||
>
|
||||
{active ? 'ACTIVE' : 'INACTIVE'}
|
||||
</Badge>
|
||||
</Tag>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:global([data-slot='badge'] .ant-typography) {
|
||||
:global(.ant-tag .ant-typography) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:global([data-slot='badge'] .ant-typography) {
|
||||
:global(.ant-tag .ant-typography) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:global([data-slot='badge'] .ant-typography) {
|
||||
:global(.ant-tag .ant-typography) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:global([data-slot='badge'] .ant-typography) {
|
||||
:global(.ant-tag .ant-typography) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { TableColumnsType as ColumnsType } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { TableColumnsType as ColumnsType, Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
import { getMs } from 'container/Trace/Filters/Panel/PanelBody/Duration/util';
|
||||
@@ -94,9 +93,9 @@ export const getTraceListColumns = (
|
||||
if (primaryKey === 'httpMethod' || primaryKey === 'responseStatusCode') {
|
||||
return (
|
||||
<BlockLink to={getTraceLink(itemData)} openInNewTab>
|
||||
<Badge data-testid={key} color="sakura">
|
||||
<Tag data-testid={key} color="magenta">
|
||||
{getValueForKey(itemData, key)}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</BlockLink>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
[data-slot='badge'] .ant-typography {
|
||||
.ant-tag .ant-typography {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
@@ -349,7 +349,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
[data-slot='badge'] .ant-typography {
|
||||
.ant-tag .ant-typography {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
Table,
|
||||
TablePaginationConfig,
|
||||
TableProps as AntDTableProps,
|
||||
Tag,
|
||||
Tooltip,
|
||||
} from 'antd';
|
||||
import { Switch } from '@signozhq/ui/switch';
|
||||
@@ -1054,10 +1055,7 @@ function MultiIngestionSettings(): JSX.Element {
|
||||
<div className="ingestion-key-tags">
|
||||
{APIKey.tags.map((tag, index) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Badge key={`${tag}-${index}`} color="vanilla">
|
||||
{' '}
|
||||
{tag}{' '}
|
||||
</Badge>
|
||||
<Tag key={`${tag}-${index}`}> {tag} </Tag>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -310,7 +310,9 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
|
||||
return <Typography>-</Typography>;
|
||||
}
|
||||
|
||||
return <LabelColumn labels={withOutSeverityKeys} value={value} />;
|
||||
return (
|
||||
<LabelColumn labels={withOutSeverityKeys} value={value} color="magenta" />
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,46 +1,26 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import type { RuletypesRuleDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
|
||||
function Status({ status }: StatusProps): JSX.Element {
|
||||
switch (status) {
|
||||
case 'inactive': {
|
||||
return (
|
||||
<Badge color="forest" variant="outline">
|
||||
OK
|
||||
</Badge>
|
||||
);
|
||||
return <Tag color="green">OK</Tag>;
|
||||
}
|
||||
|
||||
case 'pending': {
|
||||
return (
|
||||
<Badge color="amber" variant="outline">
|
||||
Pending
|
||||
</Badge>
|
||||
);
|
||||
return <Tag color="orange">Pending</Tag>;
|
||||
}
|
||||
|
||||
case 'firing': {
|
||||
return (
|
||||
<Badge color="cherry" variant="outline">
|
||||
Firing
|
||||
</Badge>
|
||||
);
|
||||
return <Tag color="red">Firing</Tag>;
|
||||
}
|
||||
|
||||
case 'disabled': {
|
||||
return (
|
||||
<Badge color="vanilla" variant="outline">
|
||||
Disabled
|
||||
</Badge>
|
||||
);
|
||||
return <Tag>Disabled</Tag>;
|
||||
}
|
||||
|
||||
default: {
|
||||
return (
|
||||
<Badge color="vanilla" variant="outline">
|
||||
Unknown
|
||||
</Badge>
|
||||
);
|
||||
return <Tag color="default">Unknown</Tag>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ import {
|
||||
Popover,
|
||||
Skeleton,
|
||||
Table,
|
||||
Tag,
|
||||
Tooltip,
|
||||
} from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Switch } from '@signozhq/ui/switch';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import type { TableProps } from 'antd/lib';
|
||||
@@ -420,15 +420,15 @@ function DashboardsList(): JSX.Element {
|
||||
{dashboard?.tags && dashboard.tags.length > 0 && (
|
||||
<div className="dashboard-tags">
|
||||
{dashboard.tags.slice(0, 3).map((tag) => (
|
||||
<Badge className="tag" color="vanilla" key={tag}>
|
||||
<Tag className="tag" key={tag}>
|
||||
{tag}
|
||||
</Badge>
|
||||
</Tag>
|
||||
))}
|
||||
|
||||
{dashboard.tags.length > 3 && (
|
||||
<Badge className="tag" color="vanilla" key={dashboard.tags[3]}>
|
||||
<Tag className="tag" key={dashboard.tags[3]}>
|
||||
+ <span> {dashboard.tags.length - 3} </span>
|
||||
</Badge>
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const TagContainer = styled(Badge)`
|
||||
export const TagContainer = styled(Tag)`
|
||||
&&& {
|
||||
border-color: var(--bg-slate-400);
|
||||
border-radius: 0.25rem;
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
[data-slot='badge'] {
|
||||
.ant-tag-borderless {
|
||||
border-radius: 2px;
|
||||
background: color-mix(in srgb, var(--bg-robin-400) 8%, transparent);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ import MEditor, { EditorProps, Monaco } from '@monaco-editor/react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Switch } from '@signozhq/ui/switch';
|
||||
import { Collapse, Divider, Input } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Collapse, Divider, Input, Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { AddToQueryHOCProps } from 'components/Logs/AddToQueryHOC';
|
||||
import { ChangeViewFunctionType } from 'container/ExplorerOptions/types';
|
||||
@@ -105,11 +104,11 @@ function Overview({
|
||||
{
|
||||
key: '1',
|
||||
label: (
|
||||
<Badge color="vanilla">
|
||||
<Tag bordered={false}>
|
||||
<Typography.Text style={{ color: Color.BG_ROBIN_400 }}>
|
||||
body
|
||||
</Typography.Text>
|
||||
</Badge>
|
||||
</Tag>
|
||||
),
|
||||
children: (
|
||||
<div className="logs-body-content">
|
||||
@@ -143,7 +142,7 @@ function Overview({
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
// extra: <Badge className="tag" color="vanilla">JSON</Badge>,
|
||||
// extra: <Tag className="tag">JSON</Tag>,
|
||||
className: 'collapse-content',
|
||||
},
|
||||
]}
|
||||
@@ -164,11 +163,11 @@ function Overview({
|
||||
className="attribute-tab-header"
|
||||
onClick={toogleAttributePanelOpenState}
|
||||
>
|
||||
<Badge color="vanilla">
|
||||
<Tag bordered={false}>
|
||||
<Typography.Text style={{ color: Color.BG_ROBIN_400 }}>
|
||||
Attributes
|
||||
</Typography.Text>
|
||||
</Badge>
|
||||
</Tag>
|
||||
|
||||
{isAttributesExpanded && (
|
||||
<Button
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
[data-slot='badge'] .ant-typography {
|
||||
.ant-tag .ant-typography {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useMutation } from 'react-query';
|
||||
import { Radio, RadioChangeEvent } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Radio, RadioChangeEvent, Tag } from 'antd';
|
||||
import { Switch } from '@signozhq/ui/switch';
|
||||
import setLocalStorageApi from 'api/browser/localstorage/set';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
@@ -65,7 +64,9 @@ function MySettings(): JSX.Element {
|
||||
label: (
|
||||
<div className="theme-option">
|
||||
<Sun size={12} data-testid="light-theme-icon" /> Light{' '}
|
||||
<Badge color="robin">Beta</Badge>
|
||||
<Tag bordered={false} color="geekblue">
|
||||
Beta
|
||||
</Tag>
|
||||
</div>
|
||||
),
|
||||
value: 'light',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag as AntDTag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const Container = styled.div`
|
||||
@@ -20,6 +20,6 @@ export const PanelContainer = styled.div`
|
||||
overflow-y: auto;
|
||||
`;
|
||||
|
||||
export const Tag = styled(Badge)`
|
||||
export const Tag = styled(AntDTag)`
|
||||
margin: 0;
|
||||
`;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
|
||||
function Tags({ tags }: TagsProps): JSX.Element {
|
||||
return (
|
||||
<span>
|
||||
{tags?.map((tag) => (
|
||||
<Badge color="sakura" key={tag}>
|
||||
<Tag color="magenta" key={tag}>
|
||||
{tag}
|
||||
</Badge>
|
||||
</Tag>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { CircleAlert, CircleX, X } from '@signozhq/icons';
|
||||
import { Button, Input, InputRef, message, Modal, Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { CircleAlert, CircleX } from '@signozhq/icons';
|
||||
import { Button, Input, InputRef, message, Modal, Tag, Tooltip } from 'antd';
|
||||
|
||||
import { tagInputStyle } from '../PipelineListsView/config';
|
||||
import { TagInputWrapper } from './styles';
|
||||
@@ -91,7 +90,12 @@ function TagInput({
|
||||
}
|
||||
const isLongTag = tag.length > 20;
|
||||
const tagElem = (
|
||||
<Badge key={tag} color="vanilla" style={{ userSelect: 'none' }}>
|
||||
<Tag
|
||||
key={tag}
|
||||
closable
|
||||
style={{ userSelect: 'none' }}
|
||||
onClose={handleClose(tag)}
|
||||
>
|
||||
<span
|
||||
onDoubleClick={(e): void => {
|
||||
setEditInputIndex(index);
|
||||
@@ -101,12 +105,7 @@ function TagInput({
|
||||
>
|
||||
{isLongTag ? `${tag.slice(0, 20)}...` : tag}
|
||||
</span>
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={handleClose(tag)}
|
||||
/>
|
||||
</Badge>
|
||||
</Tag>
|
||||
);
|
||||
return isLongTag ? (
|
||||
<Tooltip title={tag} key={tag}>
|
||||
|
||||
@@ -4,20 +4,12 @@ exports[`PipelinePage container test should render Tags section 1`] = `
|
||||
<DocumentFragment>
|
||||
<span>
|
||||
<span
|
||||
class="_badge_1jqif_1"
|
||||
data-capitalize="false"
|
||||
data-color="sakura"
|
||||
data-slot="badge"
|
||||
data-variant="default"
|
||||
class="ant-tag ant-tag-magenta css-dev-only-do-not-override-2i2tap"
|
||||
>
|
||||
server
|
||||
</span>
|
||||
<span
|
||||
class="_badge_1jqif_1"
|
||||
data-capitalize="false"
|
||||
data-color="sakura"
|
||||
data-slot="badge"
|
||||
data-variant="default"
|
||||
class="ant-tag ant-tag-magenta css-dev-only-do-not-override-2i2tap"
|
||||
>
|
||||
app
|
||||
</span>
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
margin-bottom: 8px;
|
||||
overflow: auto;
|
||||
max-height: 100px;
|
||||
.ant-tag {
|
||||
user-select: none;
|
||||
height: 28px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-select {
|
||||
@@ -103,8 +109,61 @@
|
||||
}
|
||||
|
||||
.alert-rule-tags {
|
||||
.ant-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid color-mix(in srgb, var(--bg-robin-400) 20%, transparent);
|
||||
background: color-mix(in srgb, var(--bg-robin-400) 10%, transparent);
|
||||
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
|
||||
padding-right: 0px;
|
||||
border-right: 0;
|
||||
color: var(--bg-robin-400);
|
||||
|
||||
.ant-tag-close-icon {
|
||||
height: 28px;
|
||||
width: 20px !important;
|
||||
justify-content: center;
|
||||
border-left: 1px solid
|
||||
color-mix(in srgb, var(--bg-robin-400) 20%, transparent);
|
||||
border-radius: 0px 2px 2px 0px;
|
||||
background: color-mix(in srgb, var(--bg-robin-400) 30%, transparent);
|
||||
border-right: 1px solid
|
||||
color-mix(in srgb, var(--bg-robin-400) 20%, transparent);
|
||||
margin-right: 0px;
|
||||
|
||||
svg {
|
||||
fill: var(--primary-background);
|
||||
}
|
||||
}
|
||||
}
|
||||
.non-closable-tag {
|
||||
padding-right: 7px;
|
||||
border-right: 1px solid
|
||||
color-mix(in srgb, var(--bg-robin-400) 20%, transparent);
|
||||
}
|
||||
|
||||
.red-tag.non-closable-tag {
|
||||
border-right: 1px solid
|
||||
color-mix(in srgb, var(--bg-sakura-500) 20%, transparent) !important;
|
||||
}
|
||||
|
||||
.red-tag {
|
||||
border: 1px solid color-mix(in srgb, var(--bg-sakura-500) 20%, transparent);
|
||||
background: color-mix(in srgb, var(--bg-sakura-500) 10%, transparent);
|
||||
border-right: 0;
|
||||
color: var(--bg-sakura-400);
|
||||
|
||||
.ant-tag-close-icon {
|
||||
background: color-mix(in srgb, var(--bg-sakura-500) 30%, transparent);
|
||||
border-left: 1px solid
|
||||
color-mix(in srgb, var(--bg-sakura-500) 20%, transparent);
|
||||
border-right: 1px solid
|
||||
color-mix(in srgb, var(--bg-sakura-500) 20%, transparent);
|
||||
|
||||
svg {
|
||||
fill: var(--bg-sakura-500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +271,9 @@
|
||||
line-height: 18px;
|
||||
letter-spacing: -0.07px;
|
||||
}
|
||||
.ant-tag {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
display: flex;
|
||||
@@ -266,6 +328,12 @@
|
||||
width: 540px;
|
||||
max-height: 100px;
|
||||
overflow: auto;
|
||||
|
||||
.ant-tag {
|
||||
height: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.ant-collapse-content-active {
|
||||
border-top: 0;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import React, { ReactNode, useEffect } from 'react';
|
||||
import { UseQueryResult } from 'react-query';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Collapse, Flex, Space, Table, TableProps, Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Collapse, Flex, Space, Table, TableProps, Tag, Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import type { DefaultOptionType } from 'antd/es/select';
|
||||
import type {
|
||||
@@ -16,7 +15,7 @@ import cx from 'classnames';
|
||||
import dayjs from 'dayjs';
|
||||
import { useNotifications } from 'hooks/useNotifications';
|
||||
import { defaultTo } from 'lodash-es';
|
||||
import { CalendarClock, PenLine, Trash2, X } from '@signozhq/icons';
|
||||
import { CalendarClock, PenLine, Trash2 } from '@signozhq/icons';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { USER_ROLES } from 'types/roles';
|
||||
|
||||
@@ -49,10 +48,10 @@ export function AlertRuleTags(props: AlertRuleTagsProps): JSX.Element {
|
||||
{selectedTags?.map((tag: DefaultOptionType, index: number) => {
|
||||
const isLongTag = (tag?.label as string)?.length > 20;
|
||||
const tagElem = (
|
||||
<Badge
|
||||
<Tag
|
||||
key={tag.value}
|
||||
color={index % 2 ? 'sakura' : 'robin'}
|
||||
variant="outline"
|
||||
onClose={(): void => handleClose?.(tag?.value)}
|
||||
closable={closable}
|
||||
className={cx(
|
||||
{ 'red-tag': index % 2 },
|
||||
{ 'non-closable-tag': !closable },
|
||||
@@ -63,14 +62,7 @@ export function AlertRuleTags(props: AlertRuleTagsProps): JSX.Element {
|
||||
? `${(tag?.label as string | null)?.slice(0, 20)}...`
|
||||
: tag?.label}
|
||||
</span>
|
||||
{closable && (
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={(): void => handleClose?.(tag?.value)}
|
||||
/>
|
||||
)}
|
||||
</Badge>
|
||||
</Tag>
|
||||
);
|
||||
return isLongTag ? (
|
||||
<Tooltip title={tag?.label} key={tag?.value}>
|
||||
@@ -101,7 +93,7 @@ function HeaderComponent({
|
||||
<Flex className="header-content" justify="space-between">
|
||||
<Flex gap={8}>
|
||||
<Typography>{name}</Typography>
|
||||
<Badge color="vanilla">{duration}</Badge>
|
||||
<Tag>{duration}</Tag>
|
||||
</Flex>
|
||||
|
||||
{isCrudEnabled && (
|
||||
@@ -163,7 +155,9 @@ export function CollapseListContent({
|
||||
created_by_name ? (
|
||||
<Flex gap={8}>
|
||||
<Typography>{created_by_name}</Typography>
|
||||
{created_by_email && <Badge color="vanilla">{created_by_email}</Badge>}
|
||||
{created_by_email && (
|
||||
<Tag style={{ borderRadius: 20 }}>{created_by_email}</Tag>
|
||||
)}
|
||||
</Flex>
|
||||
) : (
|
||||
'-'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const StyledText = styled.span`
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
||||
export const StyledTag = styled(Badge)`
|
||||
export const StyledTag = styled(Tag)`
|
||||
margin-top: 0.125rem;
|
||||
margin-bottom: 0.125rem;
|
||||
padding-left: 0.5rem;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { X } from '@signozhq/icons';
|
||||
|
||||
import { HavingFilterTagProps } from './HavingFilterTag.interfaces';
|
||||
import { StyledTag, StyledText } from './HavingFilterTag.styled';
|
||||
|
||||
@@ -14,17 +12,10 @@ export function HavingFilterTag({
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledTag color="vanilla">
|
||||
<StyledTag closable={closable} onClose={onClose}>
|
||||
<span role="button" tabIndex={0} onClick={handleClick}>
|
||||
<StyledText>{value}</StyledText>
|
||||
</span>
|
||||
{closable && (
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={onClose}
|
||||
/>
|
||||
)}
|
||||
</StyledTag>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { Button, Select, Spin, Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Select, Spin, Tag, Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import cx from 'classnames';
|
||||
import {
|
||||
@@ -38,7 +37,6 @@ import {
|
||||
CornerDownLeft,
|
||||
Filter,
|
||||
Slash,
|
||||
X,
|
||||
} from '@signozhq/icons';
|
||||
import type { BaseSelectRef } from 'rc-select';
|
||||
import {
|
||||
@@ -201,7 +199,7 @@ function QueryBuilderSearch({
|
||||
const isDisabled = !!searchValue;
|
||||
|
||||
return (
|
||||
<Badge color="vanilla">
|
||||
<Tag closable={!searchValue && closable} onClose={onCloseHandler}>
|
||||
<Tooltip title={chipValue}>
|
||||
<TypographyText
|
||||
$isInNin={isInNin}
|
||||
@@ -215,14 +213,7 @@ function QueryBuilderSearch({
|
||||
{chipValue}
|
||||
</TypographyText>
|
||||
</Tooltip>
|
||||
{!searchValue && closable && (
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={onCloseHandler}
|
||||
/>
|
||||
)}
|
||||
</Badge>
|
||||
</Tag>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Check } from '@signozhq/icons';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const TypographyText = styled.span<{
|
||||
@@ -22,7 +22,7 @@ export const StyledCheckOutlined = styled(Check)`
|
||||
float: right;
|
||||
`;
|
||||
|
||||
export const TagContainer = styled(Badge)`
|
||||
export const TagContainer = styled(Tag)`
|
||||
&&& {
|
||||
display: inline-block;
|
||||
border-radius: 3px;
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
}
|
||||
|
||||
.qb-search-bar-tokenised-tags {
|
||||
[data-slot='badge'] {
|
||||
.ant-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 2px 0px 0px 2px;
|
||||
@@ -244,7 +244,7 @@
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
.ant-tag-close-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -265,7 +265,7 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
.ant-tag-close-icon {
|
||||
background: color-mix(in srgb, var(--bg-aqua-400) 6%, transparent);
|
||||
}
|
||||
}
|
||||
@@ -278,7 +278,7 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
.ant-tag-close-icon {
|
||||
background: color-mix(in srgb, var(--bg-sienna-400) 10%, transparent);
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
.ant-tag-close-icon {
|
||||
background: color-mix(in srgb, var(--bg-robin-400) 10%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { Select, Spin, Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Select, Spin, Tag, Tooltip } from 'antd';
|
||||
import cx from 'classnames';
|
||||
import {
|
||||
DATA_TYPE_VS_ATTRIBUTE_VALUES_KEY,
|
||||
@@ -39,7 +38,7 @@ import {
|
||||
isUndefined,
|
||||
unset,
|
||||
} from 'lodash-es';
|
||||
import { ChevronDown, ChevronUp, X } from '@signozhq/icons';
|
||||
import { ChevronDown, ChevronUp } from '@signozhq/icons';
|
||||
import type { BaseSelectRef } from 'rc-select';
|
||||
import {
|
||||
BaseAutocompleteData,
|
||||
@@ -955,7 +954,11 @@ function QueryBuilderSearchV2(
|
||||
|
||||
return (
|
||||
<span className="qb-search-bar-tokenised-tags">
|
||||
<Badge color="vanilla" className={tagDetails?.key?.type || ''}>
|
||||
<Tag
|
||||
closable={!searchValue && closable}
|
||||
onClose={onCloseHandler}
|
||||
className={tagDetails?.key?.type || ''}
|
||||
>
|
||||
<Tooltip title={chipValue}>
|
||||
<TypographyText
|
||||
$isInNin={isInNin}
|
||||
@@ -969,15 +972,7 @@ function QueryBuilderSearchV2(
|
||||
{chipValue}
|
||||
</TypographyText>
|
||||
</Tooltip>
|
||||
{!searchValue && closable && (
|
||||
<X
|
||||
size={12}
|
||||
className="close-icon"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={onCloseHandler}
|
||||
/>
|
||||
)}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
[data-slot='badge'] .ant-typography {
|
||||
.ant-tag .ant-typography {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { X } from '@signozhq/icons';
|
||||
import {
|
||||
convertMetricKeyToTrace,
|
||||
getResourceDeploymentKeys,
|
||||
@@ -21,19 +20,13 @@ function QueryChip({ queryData, onClose }: IQueryChipProps): JSX.Element {
|
||||
|
||||
return (
|
||||
<QueryChipContainer>
|
||||
<QueryChipItem color="vanilla">
|
||||
{convertMetricKeyToTrace(queryData.tagKey)}
|
||||
</QueryChipItem>
|
||||
<QueryChipItem color="vanilla">{queryData.operator}</QueryChipItem>
|
||||
<QueryChipItem color="vanilla">
|
||||
<QueryChipItem>{convertMetricKeyToTrace(queryData.tagKey)}</QueryChipItem>
|
||||
<QueryChipItem>{queryData.operator}</QueryChipItem>
|
||||
<QueryChipItem
|
||||
closable={queryData.tagKey !== getResourceDeploymentKeys(dotMetricsEnabled)}
|
||||
onClose={onCloseHandler}
|
||||
>
|
||||
{queryData.tagValue.join(', ')}
|
||||
{queryData.tagKey !== getResourceDeploymentKeys(dotMetricsEnabled) && (
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={onCloseHandler}
|
||||
/>
|
||||
)}
|
||||
</QueryChipItem>
|
||||
</QueryChipContainer>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { grey } from '@ant-design/colors';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const SearchContainer = styled.div`
|
||||
@@ -23,6 +23,6 @@ export const QueryChipContainer = styled.span`
|
||||
}
|
||||
`;
|
||||
|
||||
export const QueryChipItem = styled(Badge)`
|
||||
export const QueryChipItem = styled(Tag)`
|
||||
margin-right: 0.1rem;
|
||||
`;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button, Collapse, Flex } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Collapse, Flex, Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
import { PenLine, Trash2 } from '@signozhq/icons';
|
||||
@@ -119,9 +118,7 @@ function PolicyListItemContent({
|
||||
<Typography>Channels</Typography>
|
||||
<div>
|
||||
{routingPolicy.channels.map((channel) => (
|
||||
<Badge key={channel} color="vanilla">
|
||||
{channel}
|
||||
</Badge>
|
||||
<Tag key={channel}>{channel}</Tag>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Tooltip } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag, Tooltip } from 'antd';
|
||||
import cx from 'classnames';
|
||||
import { Pin, PinOff } from '@signozhq/icons';
|
||||
|
||||
@@ -59,17 +58,17 @@ export default function NavItem({
|
||||
|
||||
{isBeta && (
|
||||
<div className="nav-item-beta">
|
||||
<Badge color="robin" className="sidenav-beta-tag">
|
||||
<Tag bordered={false} className="sidenav-beta-tag">
|
||||
Beta
|
||||
</Badge>
|
||||
</Tag>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isNew && (
|
||||
<div className="nav-item-new">
|
||||
<Badge color="robin" className="sidenav-new-tag">
|
||||
<Tag bordered={false} className="sidenav-new-tag">
|
||||
New
|
||||
</Badge>
|
||||
</Tag>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { HTMLAttributes } from 'react';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { TableColumnsType as ColumnsType, TableProps } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { TableColumnsType as ColumnsType, TableProps, Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { ResizeTable } from 'components/ResizeTable';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
@@ -71,7 +70,7 @@ function TraceTable(): JSX.Element {
|
||||
if (value.length === 0) {
|
||||
return <Typography>-</Typography>;
|
||||
}
|
||||
return <Badge color="sakura">{value}</Badge>;
|
||||
return <Tag color="magenta">{value}</Tag>;
|
||||
};
|
||||
|
||||
const columns: ColumnsType<TableType> = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import type { TableColumnsType as ColumnsType } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { TelemetryFieldKey } from 'api/v5/v5';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
@@ -107,9 +107,9 @@ export const getListColumns = (
|
||||
) {
|
||||
return (
|
||||
<BlockLink to={getTraceLink(item)} openInNewTab={false}>
|
||||
<Badge data-testid={name} color="sakura" variant="outline">
|
||||
<Tag data-testid={name} color="magenta">
|
||||
{value}
|
||||
</Badge>
|
||||
</Tag>
|
||||
</BlockLink>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { useCallback, useMemo, useRef } from 'react';
|
||||
import { X } from '@signozhq/icons';
|
||||
import type { SelectProps } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tooltip } from 'antd';
|
||||
import { Tag, Tooltip } from 'antd';
|
||||
import type { BaseOptionType } from 'antd/es/select';
|
||||
import { Alerts } from 'types/api/alerts/getTriggered';
|
||||
|
||||
@@ -85,16 +83,14 @@ function Filter({
|
||||
const { closable, onClose, label } = props;
|
||||
|
||||
return (
|
||||
<Badge color="sakura" style={{ marginRight: 3 }}>
|
||||
<Tag
|
||||
color="magenta"
|
||||
closable={closable}
|
||||
onClose={onClose}
|
||||
style={{ marginRight: 3 }}
|
||||
>
|
||||
{label}
|
||||
{closable && (
|
||||
<X
|
||||
size={12}
|
||||
style={{ cursor: 'pointer', marginInlineStart: 4 }}
|
||||
onClick={(): void => onClose()}
|
||||
/>
|
||||
)}
|
||||
</Badge>
|
||||
</Tag>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
import { useTimezone } from 'providers/Timezone';
|
||||
@@ -51,7 +51,7 @@ function ExapandableRow({ allAlerts }: ExapandableRowProps): JSX.Element {
|
||||
<TableCell minWidth="90px" overflowX="scroll">
|
||||
<div>
|
||||
{tags.map((e) => (
|
||||
<Badge color="vanilla" key={e}>{`${e}:${labels[e]}`}</Badge>
|
||||
<Tag key={e}>{`${e}:${labels[e]}`}</Tag>
|
||||
))}
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { SquareMinus, SquarePlus } from '@signozhq/icons';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
import { Alerts } from 'types/api/alerts/getTriggered';
|
||||
|
||||
import ExapandableRow from './ExapandableRow';
|
||||
@@ -26,9 +26,9 @@ function TableRowComponent({
|
||||
</IconContainer>
|
||||
<>
|
||||
{tags.map((tag) => (
|
||||
<Badge color="sakura" key={tag}>
|
||||
<Tag color="magenta" key={tag}>
|
||||
{tag}
|
||||
</Badge>
|
||||
</Tag>
|
||||
))}
|
||||
</>
|
||||
</StatusContainer>
|
||||
|
||||
@@ -59,7 +59,9 @@ function NoFilterTable({
|
||||
return <Typography>-</Typography>;
|
||||
}
|
||||
|
||||
return <LabelColumn labels={withOutSeverityKeys} value={labels} />;
|
||||
return (
|
||||
<LabelColumn labels={withOutSeverityKeys} value={labels} color="magenta" />
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
|
||||
function Severity({ severity }: SeverityProps): JSX.Element {
|
||||
switch (severity) {
|
||||
case 'unprocessed': {
|
||||
return <Badge color="forest">UnProcessed</Badge>;
|
||||
return <Tag color="green">UnProcessed</Tag>;
|
||||
}
|
||||
|
||||
case 'active': {
|
||||
return <Badge color="cherry">Firing</Badge>;
|
||||
return <Tag color="red">Firing</Tag>;
|
||||
}
|
||||
|
||||
case 'suppressed': {
|
||||
return <Badge color="cherry">Suppressed</Badge>;
|
||||
return <Tag color="red">Suppressed</Tag>;
|
||||
}
|
||||
|
||||
default: {
|
||||
return <Badge color="vanilla">Unknown Status</Badge>;
|
||||
return <Tag color="default">Unknown Status</Tag>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Tag } from 'antd';
|
||||
|
||||
export default function BetaTag(): JSX.Element {
|
||||
return <Badge color="robin">Beta</Badge>;
|
||||
return (
|
||||
<Tag bordered={false} color="geekblue">
|
||||
Beta
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button } from 'antd';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { Button, Tag } from 'antd';
|
||||
import { TimelineFilter } from 'container/AlertHistory/types';
|
||||
import { Undo } from '@signozhq/icons';
|
||||
|
||||
@@ -66,7 +65,11 @@ function Tabs2({
|
||||
>
|
||||
{tab.label}
|
||||
|
||||
{tab.isBeta && <Badge color="robin">Beta</Badge>}
|
||||
{tab.isBeta && (
|
||||
<Tag bordered={false} color="geekblue">
|
||||
Beta
|
||||
</Tag>
|
||||
)}
|
||||
</Button>
|
||||
))}
|
||||
</Button.Group>
|
||||
|
||||
@@ -48,5 +48,23 @@ func (provider *provider) addTraceDetailRoutes(router *mux.Router) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := router.Handle("/api/v3/traces/{traceID}/flamegraph", handler.New(
|
||||
provider.authzMiddleware.ViewAccess(provider.traceDetailHandler.GetFlamegraph),
|
||||
handler.OpenAPIDef{
|
||||
ID: "GetFlamegraph",
|
||||
Tags: []string{"tracedetail"},
|
||||
Summary: "Get flamegraph view for a trace",
|
||||
Description: "Returns the flamegraph view of spans for a given trace ID.",
|
||||
Request: new(spantypes.PostableFlamegraph),
|
||||
RequestContentType: "application/json",
|
||||
Response: new(spantypes.GettableFlamegraphTrace),
|
||||
ResponseContentType: "application/json",
|
||||
SuccessStatusCode: http.StatusOK,
|
||||
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusNotFound},
|
||||
SecuritySchemes: newSecuritySchemes(types.RoleViewer),
|
||||
},
|
||||
)).Methods(http.MethodPost).GetError(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,7 +6,16 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Waterfall WaterfallConfig `mapstructure:"waterfall"`
|
||||
Waterfall WaterfallConfig `mapstructure:"waterfall"`
|
||||
Flamegraph FlamegraphConfig `mapstructure:"flamegraph"`
|
||||
}
|
||||
|
||||
type FlamegraphConfig struct {
|
||||
MaxSelectedLevels int `mapstructure:"max_selected_levels"`
|
||||
MaxSpansPerLevel int `mapstructure:"max_spans_per_level"`
|
||||
SamplingTopLatencySpansCount int `mapstructure:"sampling_top_latency_count"`
|
||||
SamplingBucketCount int `mapstructure:"sampling_bucket_count"`
|
||||
SelectAllSpansLimit uint `mapstructure:"select_all_spans_limit"`
|
||||
}
|
||||
|
||||
type WaterfallConfig struct {
|
||||
@@ -29,6 +38,13 @@ func newConfig() factory.Config {
|
||||
MaxDepthToAutoExpand: 5,
|
||||
MaxLimitToSelectAllSpans: 10_000,
|
||||
},
|
||||
Flamegraph: FlamegraphConfig{
|
||||
MaxSelectedLevels: 50,
|
||||
MaxSpansPerLevel: 100,
|
||||
SamplingTopLatencySpansCount: 5,
|
||||
SamplingBucketCount: 50,
|
||||
SelectAllSpansLimit: 100_000,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,5 +61,25 @@ func (c Config) Validate() error {
|
||||
return errors.NewInvalidInputf(errors.CodeInvalidInput,
|
||||
"tracedetail.waterfall.max_limit_to_select_all_spans must be positive")
|
||||
}
|
||||
if c.Flamegraph.MaxSelectedLevels <= 0 {
|
||||
return errors.NewInvalidInputf(errors.CodeInvalidInput,
|
||||
"tracedetail.flamegraph.level_limit must be positive, got %d", c.Flamegraph.MaxSelectedLevels)
|
||||
}
|
||||
if c.Flamegraph.MaxSpansPerLevel <= 0 {
|
||||
return errors.NewInvalidInputf(errors.CodeInvalidInput,
|
||||
"tracedetail.flamegraph.spans_per_level must be positive, got %d", c.Flamegraph.MaxSpansPerLevel)
|
||||
}
|
||||
if c.Flamegraph.SamplingTopLatencySpansCount < 0 {
|
||||
return errors.NewInvalidInputf(errors.CodeInvalidInput,
|
||||
"tracedetail.flamegraph.top_latency_count cannot be negative, got %d", c.Flamegraph.SamplingTopLatencySpansCount)
|
||||
}
|
||||
if c.Flamegraph.SamplingBucketCount <= 0 {
|
||||
return errors.NewInvalidInputf(errors.CodeInvalidInput,
|
||||
"tracedetail.flamegraph.bucket_count must be positive, got %d", c.Flamegraph.SamplingBucketCount)
|
||||
}
|
||||
if c.Flamegraph.SelectAllSpansLimit == 0 {
|
||||
return errors.NewInvalidInputf(errors.CodeInvalidInput,
|
||||
"tracedetail.flamegraph.max_limit_to_select_all_spans must be positive")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -59,3 +59,19 @@ func (h *handler) GetWaterfallV4(rw http.ResponseWriter, r *http.Request) {
|
||||
|
||||
render.Success(rw, http.StatusOK, result)
|
||||
}
|
||||
|
||||
func (h *handler) GetFlamegraph(rw http.ResponseWriter, r *http.Request) {
|
||||
req := new(spantypes.PostableFlamegraph)
|
||||
if err := binding.JSON.BindBody(r.Body, req); err != nil {
|
||||
render.Error(rw, err)
|
||||
return
|
||||
}
|
||||
|
||||
result, err := h.module.GetFlamegraph(r.Context(), mux.Vars(r)["traceID"], req)
|
||||
if err != nil {
|
||||
render.Error(rw, err)
|
||||
return
|
||||
}
|
||||
|
||||
render.Success(rw, http.StatusOK, result)
|
||||
}
|
||||
|
||||
@@ -105,6 +105,64 @@ func (m *module) getFullWaterfall(ctx context.Context, traceID string, summary *
|
||||
return spantypes.NewGettableWaterfallTrace(waterfallTrace, selectedSpans, nil, true, nil), nil
|
||||
}
|
||||
|
||||
func (m *module) GetFlamegraph(ctx context.Context, traceID string, req *spantypes.PostableFlamegraph) (*spantypes.GettableFlamegraphTrace, error) {
|
||||
summary, err := m.store.GetTraceSummary(ctx, traceID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if summary.NumSpans <= uint64(m.config.Flamegraph.SelectAllSpansLimit) {
|
||||
return m.getFullFlamegraph(ctx, traceID, summary)
|
||||
}
|
||||
return m.getWindowedFlamegraph(ctx, traceID, req.SelectedSpanID, summary)
|
||||
}
|
||||
|
||||
func (m *module) getFullFlamegraph(ctx context.Context, traceID string, summary *spantypes.TraceSummary) (*spantypes.GettableFlamegraphTrace, error) {
|
||||
fullSpans, err := m.store.GetTraceSpans(ctx, traceID, summary)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(fullSpans) == 0 {
|
||||
return nil, spantypes.ErrTraceNotFound
|
||||
}
|
||||
flamegraphTrace := spantypes.NewFlamegraphTraceFromStorable(fullSpans)
|
||||
return spantypes.NewGettableFlamegraphTrace(
|
||||
flamegraphTrace.GetAllLevels(),
|
||||
summary.Start.UnixMilli(), summary.End.UnixMilli(), false,
|
||||
), nil
|
||||
}
|
||||
|
||||
// getWindowedFlamegraph returns a window of a max levels and max sampled spans per level around the selected span
|
||||
func (m *module) getWindowedFlamegraph(ctx context.Context, traceID, selectedSpanID string, summary *spantypes.TraceSummary) (*spantypes.GettableFlamegraphTrace, error) {
|
||||
minimalSpans, err := m.store.GetMinimalSpans(ctx, traceID, summary.Start, summary.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(minimalSpans) == 0 {
|
||||
return nil, spantypes.ErrTraceNotFound
|
||||
}
|
||||
|
||||
flamegraphTrace := spantypes.NewFlamegraphTraceFromMinimal(minimalSpans)
|
||||
minimalSpans = nil
|
||||
|
||||
cfg := m.config.Flamegraph
|
||||
selectedSpans := flamegraphTrace.GetSelectedLevels(selectedSpanID,
|
||||
cfg.MaxSelectedLevels, cfg.MaxSpansPerLevel, cfg.SamplingTopLatencySpansCount, cfg.SamplingBucketCount)
|
||||
if len(selectedSpans) == 0 {
|
||||
return nil, spantypes.ErrTraceNotFound
|
||||
}
|
||||
|
||||
fullSpans, err := m.store.GetTraceSpansByIDs(ctx, traceID, summary.Start, summary.End,
|
||||
spantypes.FlamegraphWindowSpanIDs(selectedSpans))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return spantypes.NewGettableFlamegraphTrace(
|
||||
flamegraphTrace.EnrichSelectedSpans(selectedSpans, fullSpans),
|
||||
summary.Start.UnixMilli(), summary.End.UnixMilli(), true,
|
||||
), nil
|
||||
}
|
||||
|
||||
// getWindowedWaterfall builds the waterfall tree with minimal data and then returns only a window of full spans.
|
||||
func (m *module) getWindowedWaterfall(ctx context.Context, traceID, selectedSpanID string, uncollapsedSpans []string, start, end time.Time) (*spantypes.GettableWaterfallTrace, error) {
|
||||
// Step 1: minimal fetch → build full tree → select visible window
|
||||
|
||||
@@ -11,10 +11,12 @@ import (
|
||||
type Handler interface {
|
||||
GetWaterfall(http.ResponseWriter, *http.Request)
|
||||
GetWaterfallV4(http.ResponseWriter, *http.Request)
|
||||
GetFlamegraph(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
// Module defines the business logic for trace detail operations.
|
||||
type Module interface {
|
||||
GetWaterfall(ctx context.Context, traceID string, req *spantypes.PostableWaterfall) (*spantypes.GettableWaterfallTrace, error)
|
||||
GetWaterfallV4(ctx context.Context, traceID string, selectedSpanID string, uncollapsedSpans []string, selectAllLimit uint) (*spantypes.GettableWaterfallTrace, error)
|
||||
GetFlamegraph(ctx context.Context, traceID string, req *spantypes.PostableFlamegraph) (*spantypes.GettableFlamegraphTrace, error)
|
||||
}
|
||||
|
||||
81
pkg/types/spantypes/flamegraph_span.go
Normal file
81
pkg/types/spantypes/flamegraph_span.go
Normal file
@@ -0,0 +1,81 @@
|
||||
package spantypes
|
||||
|
||||
import (
|
||||
"maps"
|
||||
|
||||
"github.com/SigNoz/signoz/pkg/types/telemetrytypes"
|
||||
)
|
||||
|
||||
type FlamegraphSpan struct {
|
||||
SpanID string `json:"spanId"`
|
||||
ParentSpanID string `json:"parentSpanId"`
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
DurationNano uint64 `json:"durationNano"`
|
||||
HasError bool `json:"hasError"`
|
||||
ServiceName string `json:"serviceName"`
|
||||
Name string `json:"name"`
|
||||
Level int64 `json:"level"`
|
||||
Events []Event `json:"event"`
|
||||
Attributes map[string]any `json:"attributes,omitempty"`
|
||||
Resource map[string]string `json:"resource,omitempty"`
|
||||
Children []*FlamegraphSpan `json:"-"` // internal tree use only
|
||||
}
|
||||
|
||||
// FlamegraphLevel groups span IDs at a single level within the selected window.
|
||||
type FlamegraphLevel struct {
|
||||
Level int64
|
||||
SpanIDs []string
|
||||
}
|
||||
|
||||
type PostableFlamegraph struct {
|
||||
SelectedSpanID string `json:"selectedSpanId"`
|
||||
SelectFields []telemetrytypes.TelemetryFieldKey `json:"selectFields,omitempty"`
|
||||
}
|
||||
|
||||
// GettableFlamegraphTrace is the response for the v3 flamegraph API.
|
||||
type GettableFlamegraphTrace struct {
|
||||
Spans [][]*FlamegraphSpan `json:"spans"`
|
||||
StartTimestampMillis int64 `json:"startTimestampMillis"`
|
||||
EndTimestampMillis int64 `json:"endTimestampMillis"`
|
||||
HasMore bool `json:"hasMore"`
|
||||
}
|
||||
|
||||
func NewGettableFlamegraphTrace(spans [][]*FlamegraphSpan, startMs, endMs int64, hasMore bool) *GettableFlamegraphTrace {
|
||||
return &GettableFlamegraphTrace{
|
||||
Spans: spans,
|
||||
StartTimestampMillis: startMs,
|
||||
EndTimestampMillis: endMs,
|
||||
HasMore: hasMore,
|
||||
}
|
||||
}
|
||||
|
||||
func NewFlamegraphSpanFromStorable(s *StorableSpan, level int64) *FlamegraphSpan {
|
||||
resources := make(map[string]string, len(s.ResourcesString))
|
||||
maps.Copy(resources, s.ResourcesString)
|
||||
return &FlamegraphSpan{
|
||||
SpanID: s.SpanID,
|
||||
ParentSpanID: s.ParentSpanID,
|
||||
Timestamp: uint64(s.StartTime.UnixNano()),
|
||||
DurationNano: s.DurationNano,
|
||||
HasError: s.HasError,
|
||||
ServiceName: s.ServiceName,
|
||||
Name: s.Name,
|
||||
Level: level,
|
||||
Events: s.UnmarshalledEvents(),
|
||||
Attributes: s.Attributes(),
|
||||
Resource: resources,
|
||||
}
|
||||
}
|
||||
|
||||
// FlamegraphWindowSpanIDs collects all span IDs from a level window into a flat slice.
|
||||
func FlamegraphWindowSpanIDs(window []FlamegraphLevel) []string {
|
||||
total := 0
|
||||
for _, lvl := range window {
|
||||
total += len(lvl.SpanIDs)
|
||||
}
|
||||
ids := make([]string, 0, total)
|
||||
for _, lvl := range window {
|
||||
ids = append(ids, lvl.SpanIDs...)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
279
pkg/types/spantypes/flamegraph_trace.go
Normal file
279
pkg/types/spantypes/flamegraph_trace.go
Normal file
@@ -0,0 +1,279 @@
|
||||
package spantypes
|
||||
|
||||
import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// FlamegraphTrace holds the level wise tree built from minimal spans.
|
||||
type FlamegraphTrace struct {
|
||||
roots []*FlamegraphSpan
|
||||
nodeByID map[string]*FlamegraphSpan
|
||||
startTime uint64
|
||||
endTime uint64
|
||||
}
|
||||
|
||||
func NewFlamegraphTraceFromMinimal(spans []MinimalSpan) *FlamegraphTrace {
|
||||
t := &FlamegraphTrace{
|
||||
nodeByID: make(map[string]*FlamegraphSpan, len(spans)),
|
||||
}
|
||||
for i := range spans {
|
||||
node := spans[i].ToFlamegraphSpan()
|
||||
t.updateTimeRange(node.Timestamp, node.DurationNano)
|
||||
t.nodeByID[node.SpanID] = node
|
||||
}
|
||||
t.wireTree()
|
||||
return t
|
||||
}
|
||||
|
||||
func NewFlamegraphTraceFromStorable(spans []StorableSpan) *FlamegraphTrace {
|
||||
t := &FlamegraphTrace{
|
||||
nodeByID: make(map[string]*FlamegraphSpan, len(spans)),
|
||||
}
|
||||
for i := range spans {
|
||||
node := NewFlamegraphSpanFromStorable(&spans[i], 0) // level is set later by BFS
|
||||
t.updateTimeRange(node.Timestamp, node.DurationNano)
|
||||
t.nodeByID[node.SpanID] = node
|
||||
}
|
||||
t.wireTree()
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *FlamegraphTrace) GetAllLevels() [][]*FlamegraphSpan {
|
||||
allLevels := t.buildAllLevels()
|
||||
for _, node := range t.nodeByID {
|
||||
node.Children = nil // children not required after building tree
|
||||
}
|
||||
return allLevels
|
||||
}
|
||||
|
||||
// GetSelectedLevels returns the level window for selectedSpanID with sampling applied to
|
||||
// dense levels. It always applies windowing — callers should only invoke this when the
|
||||
// trace is known to exceed the select-all limit.
|
||||
// Children are cleared after traversal so the tree can be GC'd.
|
||||
func (t *FlamegraphTrace) GetSelectedLevels(
|
||||
selectedSpanID string,
|
||||
levelLimit, spansPerLevel, topLatencyCount, bucketCount int,
|
||||
) []FlamegraphLevel {
|
||||
allLevels := t.buildAllLevels()
|
||||
for _, node := range t.nodeByID {
|
||||
node.Children = nil
|
||||
}
|
||||
|
||||
selectedIndex := 0
|
||||
if selectedSpanID != "" {
|
||||
outer:
|
||||
for i, lvl := range allLevels {
|
||||
for _, span := range lvl {
|
||||
if span.SpanID == selectedSpanID {
|
||||
selectedIndex = i
|
||||
break outer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lowerLimit := selectedIndex - int(float64(levelLimit)*0.4)
|
||||
upperLimit := selectedIndex + int(float64(levelLimit)*0.6)
|
||||
|
||||
if lowerLimit < 0 {
|
||||
upperLimit -= lowerLimit
|
||||
lowerLimit = 0
|
||||
}
|
||||
if upperLimit > len(allLevels) {
|
||||
lowerLimit -= upperLimit - len(allLevels)
|
||||
upperLimit = len(allLevels)
|
||||
}
|
||||
if lowerLimit < 0 {
|
||||
lowerLimit = 0
|
||||
}
|
||||
|
||||
result := make([]FlamegraphLevel, 0, upperLimit-lowerLimit)
|
||||
for i := lowerLimit; i < upperLimit; i++ {
|
||||
lvl := allLevels[i]
|
||||
if len(lvl) == 0 {
|
||||
continue
|
||||
}
|
||||
var sampled []*FlamegraphSpan
|
||||
if len(lvl) > spansPerLevel {
|
||||
sampled = sampleFlamegraphLevel(lvl, selectedSpanID, i == selectedIndex,
|
||||
t.startTime, t.endTime, topLatencyCount, bucketCount)
|
||||
} else {
|
||||
sampled = lvl
|
||||
}
|
||||
if len(sampled) == 0 {
|
||||
continue
|
||||
}
|
||||
spanIDs := make([]string, len(sampled))
|
||||
for j, s := range sampled {
|
||||
spanIDs[j] = s.SpanID
|
||||
}
|
||||
result = append(result, FlamegraphLevel{
|
||||
Level: sampled[0].Level,
|
||||
SpanIDs: spanIDs,
|
||||
})
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (t *FlamegraphTrace) EnrichSelectedSpans(selectedSpans []FlamegraphLevel, fullSpans []StorableSpan) [][]*FlamegraphSpan {
|
||||
fullByID := make(map[string]*StorableSpan, len(fullSpans))
|
||||
for i := range fullSpans {
|
||||
fullByID[fullSpans[i].SpanID] = &fullSpans[i]
|
||||
}
|
||||
|
||||
result := make([][]*FlamegraphSpan, len(selectedSpans))
|
||||
for i, lvl := range selectedSpans {
|
||||
result[i] = make([]*FlamegraphSpan, 0, len(lvl.SpanIDs))
|
||||
for _, spanID := range lvl.SpanIDs {
|
||||
if full, ok := fullByID[spanID]; ok {
|
||||
result[i] = append(result[i], NewFlamegraphSpanFromStorable(full, lvl.Level))
|
||||
} else if lean, ok := t.nodeByID[spanID]; ok {
|
||||
result[i] = append(result[i], lean)
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (t *FlamegraphTrace) updateTimeRange(timestamp, durationNano uint64) {
|
||||
if t.startTime == 0 || timestamp < t.startTime {
|
||||
t.startTime = timestamp
|
||||
}
|
||||
if end := timestamp + durationNano; end > t.endTime {
|
||||
t.endTime = end
|
||||
}
|
||||
}
|
||||
|
||||
func (t *FlamegraphTrace) wireTree() {
|
||||
for _, node := range t.nodeByID {
|
||||
if node.ParentSpanID != "" {
|
||||
if parent, ok := t.nodeByID[node.ParentSpanID]; ok {
|
||||
parent.Children = append(parent.Children, node)
|
||||
} else {
|
||||
missing := &FlamegraphSpan{
|
||||
SpanID: node.ParentSpanID,
|
||||
Name: "Missing Span",
|
||||
Timestamp: node.Timestamp,
|
||||
DurationNano: node.DurationNano,
|
||||
Children: []*FlamegraphSpan{node},
|
||||
}
|
||||
t.nodeByID[missing.SpanID] = missing
|
||||
t.roots = append(t.roots, missing)
|
||||
}
|
||||
} else if flamegraphSpanIndex(t.roots, node.SpanID) == -1 {
|
||||
t.roots = append(t.roots, node)
|
||||
}
|
||||
}
|
||||
|
||||
sort.Slice(t.roots, func(i, j int) bool {
|
||||
if t.roots[i].Timestamp == t.roots[j].Timestamp {
|
||||
return t.roots[i].SpanID < t.roots[j].SpanID
|
||||
}
|
||||
return t.roots[i].Timestamp < t.roots[j].Timestamp
|
||||
})
|
||||
}
|
||||
|
||||
func (t *FlamegraphTrace) buildAllLevels() [][]*FlamegraphSpan {
|
||||
var result [][]*FlamegraphSpan
|
||||
|
||||
type entry struct {
|
||||
node *FlamegraphSpan
|
||||
depth int64
|
||||
}
|
||||
|
||||
for _, root := range t.roots {
|
||||
levelMap := make(map[int64][]*FlamegraphSpan)
|
||||
maxDepth := int64(-1)
|
||||
|
||||
queue := []entry{{root, 0}}
|
||||
for len(queue) > 0 {
|
||||
curr := queue[0]
|
||||
queue = queue[1:]
|
||||
curr.node.Level = curr.depth
|
||||
levelMap[curr.depth] = append(levelMap[curr.depth], curr.node)
|
||||
if curr.depth > maxDepth {
|
||||
maxDepth = curr.depth
|
||||
}
|
||||
for _, child := range curr.node.Children {
|
||||
queue = append(queue, entry{child, curr.depth + 1})
|
||||
}
|
||||
}
|
||||
|
||||
for depth := int64(0); depth <= maxDepth; depth++ {
|
||||
if spans, ok := levelMap[depth]; ok {
|
||||
result = append(result, spans)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func sampleFlamegraphLevel(
|
||||
spans []*FlamegraphSpan,
|
||||
selectedSpanID string,
|
||||
isSelectedLevel bool,
|
||||
startTime, endTime uint64,
|
||||
topLatencyCount, bucketCount int,
|
||||
) []*FlamegraphSpan {
|
||||
sorted := make([]*FlamegraphSpan, len(spans))
|
||||
copy(sorted, spans)
|
||||
sort.Slice(sorted, func(i, j int) bool {
|
||||
return sorted[i].DurationNano > sorted[j].DurationNano
|
||||
})
|
||||
|
||||
var sampled []*FlamegraphSpan
|
||||
|
||||
topK := topLatencyCount
|
||||
if topK > len(sorted) {
|
||||
topK = len(sorted)
|
||||
}
|
||||
sampled = append(sampled, sorted[:topK]...)
|
||||
|
||||
if isSelectedLevel {
|
||||
for _, span := range sorted {
|
||||
if span.SpanID == selectedSpanID {
|
||||
sampled = append(sampled, span)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bucketSize := (endTime - startTime) / uint64(bucketCount)
|
||||
if bucketSize == 0 {
|
||||
bucketSize = 1
|
||||
}
|
||||
buckets := make([][]*FlamegraphSpan, bucketCount)
|
||||
for _, span := range sorted {
|
||||
if span.Timestamp < startTime || span.Timestamp > endTime {
|
||||
continue
|
||||
}
|
||||
idx := int((span.Timestamp - startTime) / bucketSize)
|
||||
if idx < 0 {
|
||||
idx = 0
|
||||
} else if idx >= bucketCount {
|
||||
idx = bucketCount - 1
|
||||
}
|
||||
buckets[idx] = append(buckets[idx], span)
|
||||
}
|
||||
for i := range buckets {
|
||||
if len(buckets[i]) > 2 {
|
||||
buckets[i] = buckets[i][:2]
|
||||
}
|
||||
}
|
||||
for _, bucket := range buckets {
|
||||
sampled = append(sampled, bucket...)
|
||||
}
|
||||
|
||||
return sampled
|
||||
}
|
||||
|
||||
func flamegraphSpanIndex(spans []*FlamegraphSpan, spanID string) int {
|
||||
for i, s := range spans {
|
||||
if s != nil && s.SpanID == spanID {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
@@ -156,6 +156,18 @@ func (item *MinimalSpan) ToWaterfallSpan(traceID string) *WaterfallSpan {
|
||||
}
|
||||
}
|
||||
|
||||
func (item *MinimalSpan) ToFlamegraphSpan() *FlamegraphSpan {
|
||||
return &FlamegraphSpan{
|
||||
SpanID: item.SpanID,
|
||||
ParentSpanID: item.ParentSpanID,
|
||||
Timestamp: uint64(item.StartTime.UnixNano()),
|
||||
DurationNano: item.DurationNano,
|
||||
HasError: item.HasError,
|
||||
ServiceName: item.ServiceName,
|
||||
Children: make([]*FlamegraphSpan, 0),
|
||||
}
|
||||
}
|
||||
|
||||
// NewMissingWaterfallSpan creates a synthetic placeholder span for a parent that has no recorded data.
|
||||
func NewMissingWaterfallSpan(spanID, traceID string, timeUnixNano, durationNano uint64) *WaterfallSpan {
|
||||
return &WaterfallSpan{
|
||||
|
||||
Reference in New Issue
Block a user