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.

chore: product link and retires retry condition (#9018)

SagarRajput-70f5825a2b3dd
diff --git a/frontend/src/components/NewSelect/CustomMultiSelect.tsx b/frontend/src/components/NewSelect/CustomMultiSelect.tsx
index ed99a024d8..afe2116a04 100644
--- a/frontend/src/components/NewSelect/CustomMultiSelect.tsx
+++ b/frontend/src/components/NewSelect/CustomMultiSelect.tsx
@@ -1,3 +1,5 @@
+/* eslint-disable jsx-a11y/no-static-element-interactions */
+/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable no-nested-ternary */
@@ -70,6 +72,8 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
showIncompleteDataMessage = false,
showLabels = false,
enableRegexOption = false,
+ isDynamicVariable = false,
+ showRetryButton = true,
...rest
}) => {
// ===== State & Refs =====
@@ -1553,12 +1557,23 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
}
}}
>
- <Checkbox checked={allOptionsSelected} className="option-checkbox">
- <div className="option-content">
- <div className="all-option-text">
- ALL
+ <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
+ <Checkbox checked={allOptionsSelected} className="option-checkbox">
+ <div className="option-content">
+ <div className="all-option-text">ALL</div>
+ </div>
+ </Checkbox>
+ <div
+ onClick={(e): void => {
+ e.stopPropagation();
+ }}
+ onMouseDown={(e): void => {
+ e.stopPropagation();
+ }}
+ >
+ {isDynamicVariable && (
<TextToolTip
- text="Note about ALL in Dynamic Variable"
+ text="ALL in dynamic variable = No filter applied (unlike other variable types where ALL sends all selected values). Learn more"
url="https://signoz.io/docs/userguide/manage-variables/#note-about-all"
urlText="here"
useFilledIcon={false}
@@ -1567,15 +1582,14 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
size={14}
style={{
color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
- marginTop: 1,
- marginRight: 5,
+ marginLeft: 5,
}}
/>
}
/>
- </div>
+ )}
</div>
- </Checkbox>
+ </div>
</div>
<div className="divider" />
</>
@@ -1607,21 +1621,23 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
<div className="select-group" key={section.label}>
<div className="group-label" role="heading" aria-level={2}>
{section.label}
- <TextToolTip
- text="Learn more about this section "
- url="https://signoz.io/docs/userguide/manage-variables/#dynamic-variable-dropdowns-display-values-in-two-sections"
- urlText="here"
- useFilledIcon={false}
- outlinedIcon={
- <Info
- size={14}
- style={{
- color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
- marginTop: 1,
- }}
- />
- }
- />
+ {isDynamicVariable && (
+ <TextToolTip
+ text="Related values: Filtered by other variable selections. All values: Unfiltered complete list. Learn more"
+ url="https://signoz.io/docs/userguide/manage-variables/#dynamic-variable-dropdowns-display-values-in-two-sections"
+ urlText="here"
+ useFilledIcon={false}
+ outlinedIcon={
+ <Info
+ size={14}
+ style={{
+ color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
+ marginTop: 1,
+ }}
+ />
+ }
+ />
+ )}
</div>
<div role="group" aria-label={`${section.label} options`}>
<Virtuoso
@@ -1663,7 +1679,7 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
<div className="navigation-icons">
<LoadingOutlined />
</div>
- <div className="navigation-text">We are updating the values...</div>
+ <div className="navigation-text">Refreshing values...</div>
</div>
)}
{errorMessage && !loading && (
@@ -1671,7 +1687,7 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
<div className="navigation-text">
{errorMessage || SOMETHING_WENT_WRONG}
</div>
- {onRetry && (
+ {onRetry && showRetryButton && (
<div className="navigation-icons">
<ReloadOutlined
twoToneColor={Color.BG_CHERRY_400}
@@ -1690,7 +1706,7 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
!loading &&
!errorMessage && (
<div className="navigation-text-incomplete">
- Use search for more options
+ Don&apos;t see the value? Use search
</div>
)}
@@ -1728,6 +1744,8 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
isScrolledToBottom,
enableRegexOption,
isDarkMode,
+ isDynamicVariable,
+ showRetryButton,
]);
// Custom handler for dropdown visibility changes
diff --git a/frontend/src/components/NewSelect/CustomSelect.tsx b/frontend/src/components/NewSelect/CustomSelect.tsx
index 52a7cfdde9..f3ff021dbc 100644
--- a/frontend/src/components/NewSelect/CustomSelect.tsx
+++ b/frontend/src/components/NewSelect/CustomSelect.tsx
@@ -13,9 +13,11 @@ import {
import { Color } from '@signozhq/design-tokens';
import { Select } from 'antd';
import cx from 'classnames';
+import TextToolTip from 'components/TextToolTip';
import { SOMETHING_WENT_WRONG } from 'constants/api';
+import { useIsDarkMode } from 'hooks/useDarkMode';
import { capitalize, isEmpty } from 'lodash-es';
-import { ArrowDown, ArrowUp } from 'lucide-react';
+import { ArrowDown, ArrowUp, Info } from 'lucide-react';
import type { BaseSelectRef } from 'rc-select';
import React, {
useCallback,
@@ -59,6 +61,8 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
allowClear = false,
onRetry,
showIncompleteDataMessage = false,
+ showRetryButton = true,
+ isDynamicVariable = false,
...rest
}) => {
// ===== State & Refs =====
@@ -67,6 +71,8 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
const [activeOptionIndex, setActiveOptionIndex] = useState<number>(-1);
const [isScrolledToBottom, setIsScrolledToBottom] = useState(false);
+ const isDarkMode = useIsDarkMode();
+
// Refs for element access and scroll behavior
const selectRef = useRef<BaseSelectRef>(null);
const dropdownRef = useRef<HTMLDivElement>(null);
@@ -522,6 +528,23 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
<div className="select-group" key={section.label}>
<div className="group-label" role="heading" aria-level={2}>
{section.label}
+ {isDynamicVariable && (
+ <TextToolTip
+ text="Related values: Filtered by other variable selections. All values: Unfiltered complete list. Learn more"
+ url="https://signoz.io/docs/userguide/manage-variables/#dynamic-variable-dropdowns-display-values-in-two-sections"
+ urlText="here"
+ useFilledIcon={false}
+ outlinedIcon={
+ <Info
+ size={14}
+ style={{
+ color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
+ marginTop: 1,
+ }}
+ />
+ }
+ />
+ )}
</div>
<div role="group" aria-label={`${section.label} options`}>
{section.options && mapOptions(section.options)}
@@ -547,7 +570,7 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
<div className="navigation-icons">
<LoadingOutlined />
</div>
- <div className="navigation-text">We are updating the values...</div>
+ <div className="navigation-text">Refreshing values...</div>
</div>
)}
{errorMessage && !loading && (
@@ -555,7 +578,7 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
<div className="navigation-text">
{errorMessage || SOMETHING_WENT_WRONG}
</div>
- {onRetry && (
+ {onRetry && showRetryButton && (
<div className="navigation-icons">
<ReloadOutlined
twoToneColor={Color.BG_CHERRY_400}
@@ -574,7 +597,7 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
!loading &&
!errorMessage && (
<div className="navigation-text-incomplete">
- Use search for more options
+ Don&apos;t see the value? Use search
</div>
)}
@@ -605,6 +628,9 @@ const CustomSelect: React.FC<CustomSelectProps> = ({
onRetry,
showIncompleteDataMessage,
isScrolledToBottom,
+ showRetryButton,
+ isDarkMode,
+ isDynamicVariable,
]);
// Handle dropdown visibility changes
diff --git a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.comprehensive.test.tsx b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.comprehensive.test.tsx
index de7205f061..612fd26464 100644
--- a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.comprehensive.test.tsx
+++ b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.comprehensive.test.tsx
@@ -601,9 +601,7 @@ describe('CustomMultiSelect - Comprehensive Tests', () => {
// Check loading message is shown
await waitFor(() => {
- expect(
- screen.getByText('We are updating the values...'),
- ).toBeInTheDocument();
+ expect(screen.getByText('Refreshing values...')).toBeInTheDocument();
});
});
@@ -677,9 +675,7 @@ describe('CustomMultiSelect - Comprehensive Tests', () => {
const loadingFooter = document.querySelector('.navigation-loading');
expect(loadingFooter).toBeInTheDocument();
- expect(
- screen.getByText('We are updating the values...'),
- ).toBeInTheDocument();
+ expect(screen.getByText('Refreshing values...')).toBeInTheDocument();
});
});
diff --git a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.retry.test.tsx b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.retry.test.tsx
new file mode 100644
index 0000000000..79e6ccd78a
--- /dev/null
+++ b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.retry.test.tsx
@@ -0,0 +1,127 @@
+import {
+ fireEvent,
+ render,
+ RenderResult,
+ screen,
+ waitFor,
+} from '@testing-library/react';
+import { VirtuosoMockContext } from 'react-virtuoso';
+
+import CustomMultiSelect from '../CustomMultiSelect';
+
+// Mock scrollIntoView which isn't available in JSDOM
+window.HTMLElement.prototype.scrollIntoView = jest.fn();
+
+// Helper function to render with VirtuosoMockContext
+const renderWithVirtuoso = (component: React.ReactElement): RenderResult =>
+ render(
+ <VirtuosoMockContext.Provider
+ value={{ viewportHeight: 300, itemHeight: 100 }}
+ >
+ {component}
+ </VirtuosoMockContext.Provider>,
+ );
+
+// Mock options data
+const mockOptions = [
+ { label: 'Option 1', value: 'option1' },
+ { label: 'Option 2', value: 'option2' },
+ { label: 'Option 3', value: 'option3' },
+];
+
+// CSS selector for retry button
+const RETRY_BUTTON_SELECTOR = '.navigation-icons .anticon-reload';
+
+describe('CustomMultiSelect - Retry Functionality', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ it('should show retry button when 5xx error occurs and error message is displayed', async () => {
+ const mockOnRetry = jest.fn();
+ const errorMessage = 'Internal Server Error (500)';
+
+ renderWithVirtuoso(
+ <CustomMultiSelect
+ options={mockOptions}
+ errorMessage={errorMessage}
+ onRetry={mockOnRetry}
+ showRetryButton
+ loading={false}
+ />,
+ );
+
+ // Open dropdown to see error state
+ const selectElement = screen.getByRole('combobox');
+ fireEvent.mouseDown(selectElement);
+
+ // Wait for dropdown to appear with error message
+ await waitFor(() => {
+ expect(screen.getByText(errorMessage)).toBeInTheDocument();
+ });
+
+ // Check that retry button (ReloadOutlined icon) is present
+ const retryButton = document.querySelector(RETRY_BUTTON_SELECTOR);
+ expect(retryButton).toBeInTheDocument();
+ });
+
+ it('should show retry button when 4xx error occurs and error message is displayed (current behavior)', async () => {
+ const mockOnRetry = jest.fn();
+ const errorMessage = 'Bad Request (400)';
+
+ renderWithVirtuoso(
+ <CustomMultiSelect
+ options={mockOptions}
+ errorMessage={errorMessage}
+ onRetry={mockOnRetry}
+ showRetryButton={false}
+ loading={false}
+ />,
+ );
+
+ // Open dropdown
+ const selectElement = screen.getByRole('combobox');
+ fireEvent.mouseDown(selectElement);
+
+ // Wait for dropdown to appear with error message
+ await waitFor(() => {
+ expect(screen.getByText(errorMessage)).toBeInTheDocument();
+ });
+
+ const retryButton = document.querySelector(RETRY_BUTTON_SELECTOR);
+ expect(retryButton).not.toBeInTheDocument();
+ });
+
+ it('should call onRetry function when retry button is clicked', async () => {
+ const mockOnRetry = jest.fn();
+ const errorMessage = 'Internal Server Error (500)';
+
+ renderWithVirtuoso(
+ <CustomMultiSelect
+ options={mockOptions}
+ errorMessage={errorMessage}
+ onRetry={mockOnRetry}
+ showRetryButton
+ loading={false}
+ />,
+ );
+
+ // Open dropdown
+ const selectElement = screen.getByRole('combobox');
+ fireEvent.mouseDown(selectElement);
+
+ // Wait for dropdown to appear
+ await waitFor(() => {
+ expect(screen.getByText(errorMessage)).toBeInTheDocument();
+ });
+
+ // Find and click the retry button
+ const retryButton = document.querySelector(RETRY_BUTTON_SELECTOR);
+ expect(retryButton).toBeInTheDocument();
+
+ fireEvent.click(retryButton as Element);
+
+ // Verify onRetry was called
+ expect(mockOnRetry).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx
index 6900dcd9ab..0a457f9d6b 100644
--- a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx
+++ b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx
@@ -237,7 +237,7 @@ describe('CustomMultiSelect Component', () => {
fireEvent.mouseDown(selectElement);
// Check loading text is displayed
- expect(screen.getByText('We are updating the values...')).toBeInTheDocument();
+ expect(screen.getByText('Refreshing values...')).toBeInTheDocument();
});
it('shows error message', () => {
diff --git a/frontend/src/components/NewSelect/__test__/CustomSelect.test.tsx b/frontend/src/components/NewSelect/__test__/CustomSelect.test.tsx
index 26b9200698..98b4cf1381 100644
--- a/frontend/src/components/NewSelect/__test__/CustomSelect.test.tsx
+++ b/frontend/src/components/NewSelect/__test__/CustomSelect.test.tsx
@@ -140,7 +140,7 @@ describe('CustomSelect Component', () => {
fireEvent.mouseDown(selectElement);
// Check loading text is displayed
- expect(screen.getByText('We are updating the values...')).toBeInTheDocument();
+ expect(screen.getByText('Refreshing values...')).toBeInTheDocument();
});
it('shows error message', () => {
diff --git a/frontend/src/components/NewSelect/styles.scss b/frontend/src/components/NewSelect/styles.scss
index 904b897e73..c4023d9593 100644
--- a/frontend/src/components/NewSelect/styles.scss
+++ b/frontend/src/components/NewSelect/styles.scss
@@ -414,10 +414,6 @@ $custom-border-color: #2c3044;
align-items: center;
justify-content: space-between;
- :last-child {
- margin-right: 6px;
- }
-
font-weight: 500;
padding: 4px 12px;
font-size: 13px;
@@ -805,6 +801,10 @@ $custom-border-color: #2c3044;
.select-group {
.group-label {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
color: rgba(0, 0, 0, 0.85);
background-color: #fafafa;
border-bottom: 1px solid #f0f0f0;
diff --git a/frontend/src/components/NewSelect/types.ts b/frontend/src/components/NewSelect/types.ts
index 55eb6a6ea7..4fa47ff989 100644
--- a/frontend/src/components/NewSelect/types.ts
+++ b/frontend/src/components/NewSelect/types.ts
@@ -28,6 +28,8 @@ export interface CustomSelectProps extends Omit<SelectProps, 'options'> {
allowClear?: SelectProps['allowClear'];
onRetry?: () => void;
showIncompleteDataMessage?: boolean;
+ showRetryButton?: boolean;
+ isDynamicVariable?: boolean;
}
export interface CustomTagProps {
@@ -62,4 +64,6 @@ export interface CustomMultiSelectProps
showIncompleteDataMessage?: boolean;
showLabels?: boolean;
enableRegexOption?: boolean;
+ isDynamicVariable?: boolean;
+ showRetryButton?: boolean;
}
diff --git a/frontend/src/components/OrderBy/ListViewOrderBy.tsx b/frontend/src/components/OrderBy/ListViewOrderBy.tsx
index d207cba597..645bd07e5c 100644
--- a/frontend/src/components/OrderBy/ListViewOrderBy.tsx
+++ b/frontend/src/components/OrderBy/ListViewOrderBy.tsx
@@ -102,7 +102,7 @@ function ListViewOrderBy({
onChange={onChange}
onSearch={handleSearch}
notFoundContent={<Loader isLoading={isLoading} />}
- placeholder="Select an attribute"
+ placeholder="Select a field"
style={{ width: 200 }}
options={selectOptions}
filterOption={(input, option): boolean =>
diff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.styles.scss b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.styles.scss
index 3541a321a9..6e844b6370 100644
--- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.styles.scss
+++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.styles.scss
@@ -3,8 +3,8 @@
.dynamic-variable-config-container {
display: grid;
- grid-template-columns: 1fr 32px 200px;
- gap: 32px;
+ grid-template-columns: 1fr 32px 16px 200px;
+ gap: 16px;
align-items: center;
width: 100%;
diff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.tsx b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.tsx
index acbb75626d..99548c90b8 100644
--- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.tsx
+++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/DynamicVariable.tsx
@@ -1,10 +1,14 @@
import './DynamicVariable.styles.scss';
+import { Color } from '@signozhq/design-tokens';
import { Select, Typography } from 'antd';
import CustomSelect from 'components/NewSelect/CustomSelect';
+import TextToolTip from 'components/TextToolTip';
import { DEBOUNCE_DELAY } from 'constants/queryBuilderFilterConfig';
import { useGetFieldKeys } from 'hooks/dynamicVariables/useGetFieldKeys';
+import { useIsDarkMode } from 'hooks/useDarkMode';
import useDebounce from 'hooks/useDebounce';
+import { Info } from 'lucide-react';
import {
Dispatch,
SetStateAction,
@@ -14,9 +18,10 @@ import {
useState,
} from 'react';
import { FieldKey } from 'types/api/dynamicVariables/getFieldKeys';
+import { isRetryableError as checkIfRetryableError } from 'utils/errorUtils';
enum AttributeSource {
- ALL_SOURCES = 'All Sources',
+ ALL_TELEMETRY = 'All telemetry',
LOGS = 'Logs',
METRICS = 'Metrics',
TRACES = 'Traces',
@@ -45,7 +50,7 @@ function DynamicVariable({
errorAttributeKeyMessage?: string;
}): JSX.Element {
const sources = [
- AttributeSource.ALL_SOURCES,
+ AttributeSource.ALL_TELEMETRY,
AttributeSource.LOGS,
AttributeSource.TRACES,
AttributeSource.METRICS,
@@ -56,6 +61,7 @@ function DynamicVariable({
const [selectedAttribute, setSelectedAttribute] = useState<string>();
const [apiSearchText, setApiSearchText] = useState<string>('');
const [errorMessage, setErrorMessage] = useState<string>();
+ const [isRetryableError, setIsRetryableError] = useState<boolean>(true);
const debouncedApiSearchText = useDebounce(apiSearchText, DEBOUNCE_DELAY);
const [filteredAttributes, setFilteredAttributes] = useState<
@@ -77,7 +83,7 @@ function DynamicVariable({
const { data, error, isLoading, refetch } = useGetFieldKeys({
signal:
- attributeSource === AttributeSource.ALL_SOURCES
+ attributeSource === AttributeSource.ALL_TELEMETRY
? undefined
: (attributeSource?.toLowerCase() as 'traces' | 'logs' | 'metrics'),
name: debouncedApiSearchText,
@@ -93,6 +99,15 @@ function DynamicVariable({
}
}, [data]);
+ // Handle error from useGetFieldKeys
+ useEffect(() => {
+ if (error) {
+ // Check if error is retryable (5xx) or not (4xx)
+ const isRetryable = checkIfRetryableError(error);
+ setIsRetryableError(isRetryable);
+ }
+ }, [error]);
+
// refetch when attributeSource changes
useEffect(() => {
if (attributeSource) {
@@ -133,7 +148,7 @@ function DynamicVariable({
value:
attributeSource ||
dynamicVariablesSelectedValue?.value ||
- AttributeSource.ALL_SOURCES,
+ AttributeSource.ALL_TELEMETRY,
});
}
}, [
@@ -144,12 +159,13 @@ function DynamicVariable({
dynamicVariablesSelectedValue?.value,
]);
+ const isDarkMode = useIsDarkMode();
const errorText = (error as any)?.message || errorMessage;
return (
<div className="dynamic-variable-container">
<div className="dynamic-variable-config-container">
<CustomSelect
- placeholder="Select an Attribute"
+ placeholder="Select a field"
options={Object.keys(filteredAttributes).map((key) => ({
label: key,
value: key,
@@ -166,13 +182,30 @@ function DynamicVariable({
onRetry={(): void => {
// reset error message
setErrorMessage(undefined);
+ setIsRetryableError(true);
refetch();
}}
+ showRetryButton={isRetryableError}
/>
<Typography className="dynamic-variable-from-text">from</Typography>
+ <span style={{ display: 'inline-flex', alignItems: 'center' }}>
+ <TextToolTip
+ text="By default, this searches across logs, traces, and metrics, which can be slow. Selecting a single source improves performance. Many fields share the same values across different signals (for example, `k8s.pod.name` is identical in logs, traces and metrics) making one source enough. Only use `All telemetry` when you need fields that have different values in different signal types."
+ useFilledIcon={false}
+ outlinedIcon={
+ <Info
+ size={14}
+ style={{
+ color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
+ marginTop: 1,
+ }}
+ />
+ }
+ />
+ </span>
<Select
placeholder="Source"
- defaultValue={AttributeSource.ALL_SOURCES}
+ defaultValue={AttributeSource.ALL_TELEMETRY}
options={sources.map((source) => ({ label: source, value: source }))}
onChange={(value): void => setAttributeSource(value as AttributeSource)}
value={attributeSource || dynamicVariablesSelectedValue?.value}
diff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx
index 89691f441c..9a16dd5b52 100644
--- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx
+++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/DynamicVariable/__test__/DynamicVariable.test.tsx
@@ -20,8 +20,8 @@ jest.mock('hooks/useDebounce', () => ({
describe('DynamicVariable Component', () => {
const mockSetDynamicVariablesSelectedValue = jest.fn();
- const ATTRIBUTE_PLACEHOLDER = 'Select an Attribute';
- const LOADING_TEXT = 'We are updating the values...';
+ const ATTRIBUTE_PLACEHOLDER = 'Select a field';
+ const LOADING_TEXT = 'Refreshing values...';
const DEFAULT_PROPS = {
setDynamicVariablesSelectedValue: mockSetDynamicVariablesSelectedValue,
dynamicVariablesSelectedValue: undefined,
@@ -64,7 +64,7 @@ describe('DynamicVariable Component', () => {
// Check for main components
expect(screen.getByText(ATTRIBUTE_PLACEHOLDER)).toBeInTheDocument();
- expect(screen.getByText('All Sources')).toBeInTheDocument();
+ expect(screen.getByText('All telemetry')).toBeInTheDocument();
expect(screen.getByText('from')).toBeInTheDocument();
});
@@ -179,7 +179,7 @@ describe('DynamicVariable Component', () => {
// Check if the setter was called with the correct value
expect(mockSetDynamicVariablesSelectedValue).toHaveBeenCalledWith({
name: 'service.name',
- value: 'All Sources',
+ value: 'All telemetry',
});
});
@@ -197,7 +197,7 @@ describe('DynamicVariable Component', () => {
// Get the Select component
const select = screen
- .getByText('All Sources')
+ .getByText('All telemetry')
.closest('div[class*="ant-select"]');
expect(select).toBeInTheDocument();
diff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.test.tsx b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.test.tsx
index c2fe92776b..efc08169a5 100644
--- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.test.tsx
+++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.test.tsx
@@ -226,7 +226,7 @@ describe('VariableItem Component', () => {
name: '',
type: 'DYNAMIC',
dynamicVariablesAttribute: 'service name', // Contains whitespace
- dynamicVariablesSource: 'All Sources',
+ dynamicVariablesSource: 'All telemetry',
};
renderVariableItem(dynamicVariable);
@@ -247,7 +247,7 @@ describe('VariableItem Component', () => {
name: 'test-variable',
type: 'DYNAMIC',
dynamicVariablesAttribute: 'service.name',
- dynamicVariablesSource: 'All Sources',
+ dynamicVariablesSource: 'All telemetry',
};
renderVariableItem(
@@ -283,7 +283,7 @@ describe('VariableItem Component', () => {
name: 'test-variable',
type: 'DYNAMIC',
dynamicVariablesAttribute: 'service.name',
- dynamicVariablesSource: 'All Sources',
+ dynamicVariablesSource: 'All telemetry',
};
renderVariableItem(
@@ -326,7 +326,7 @@ describe('VariableItem Component', () => {
name: 'test-variable',
type: 'DYNAMIC',
dynamicVariablesAttribute: 'service.name',
- dynamicVariablesSource: 'All Sources',
+ dynamicVariablesSource: 'All telemetry',
};
renderVariableItem(
diff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx
index 4e87a8c4c9..f323d2d0e5 100644
--- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx
+++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx
@@ -1,3 +1,5 @@
+/* eslint-disable jsx-a11y/no-static-element-interactions */
+/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable sonarjs/cognitive-complexity */
import './VariableItem.styles.scss';
@@ -224,7 +226,7 @@ function VariableItem({
const { data: fieldValues } = useGetFieldValues({
signal:
- dynamicVariablesSelectedValue?.value === 'All Sources'
+ dynamicVariablesSelectedValue?.value === 'All telemetry'
? undefined
: (dynamicVariablesSelectedValue?.value?.toLowerCase() as
| 'traces'
@@ -523,8 +525,8 @@ function VariableItem({
<LabelContainer className="variable-type-label-container">
<Typography className="typography-variables">Variable Type</Typography>
<TextToolTip
- text="Learn more about supported variable types "
- url="https://signoz.io/docs/userguide/manage-variables/#dynamic-variable"
+ text="Learn more about supported variable types"
+ url="https://signoz.io/docs/userguide/manage-variables/#supported-variable-types"
urlText="here"
useFilledIcon={false}
outlinedIcon={
@@ -619,21 +621,23 @@ function VariableItem({
<Tag bordered={false} className="sidenav-beta-tag" color="warning">
Not Recommended
</Tag>
- <TextToolTip
- text="Learn why we don't recommend "
- url="https://signoz.io/docs/userguide/manage-variables/#why-avoid-clickhouse-query-variables"
- urlText="here"
- useFilledIcon={false}
- outlinedIcon={
- <Info
- size={14}
- style={{
- color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
- marginTop: 1,
- }}
- />
- }
- />
+ <div onClick={(e): void => e.stopPropagation()}>
+ <TextToolTip
+ text="Learn why we don't recommend"
+ url="https://signoz.io/docs/userguide/manage-variables/#why-avoid-clickhouse-query-variables"
+ urlText="here"
+ useFilledIcon={false}
+ outlinedIcon={
+ <Info
+ size={14}
+ style={{
+ color: isDarkMode ? Color.BG_VANILLA_100 : Color.BG_INK_500,
+ marginTop: 1,
+ }}
+ />
+ }
+ />
+ </div>
</Button>
</div>
</VariableItemRow>
@@ -756,9 +760,6 @@ function VariableItem({
<VariableItemRow className="sort-values-section">
<LabelContainer>
<Typography className="typography-variables">Sort Values</Typography>
- <Typography className="typography-sort">
- Sort the query output values
- </Typography>
</LabelContainer>
<Select
diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DynamicVariableSelection.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DynamicVariableSelection.tsx
index c559ef3a13..6919d41ca0 100644
--- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DynamicVariableSelection.tsx
+++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DynamicVariableSelection.tsx
@@ -17,6 +17,7 @@ import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
import { IDashboardVariable } from 'types/api/dashboard/getAll';
import { GlobalReducer } from 'types/reducer/globalTime';
+import { isRetryableError as checkIfRetryableError } from 'utils/errorUtils';
import { popupContainer } from 'utils/selectPopupContainer';
import { ALL_SELECT_VALUE } from '../utils';
@@ -50,6 +51,7 @@ function DynamicVariableSelection({
);
const [errorMessage, setErrorMessage] = useState<null | string>(null);
+ const [isRetryableError, setIsRetryableError] = useState<boolean>(true);
const [isComplete, setIsComplete] = useState<boolean>(false);
@@ -165,7 +167,7 @@ function DynamicVariableSelection({
enabled: variableData.type === 'DYNAMIC',
queryFn: () =>
getFieldValues(
- variableData.dynamicVariablesSource?.toLowerCase() === 'all sources'
+ variableData.dynamicVariablesSource?.toLowerCase() === 'all telemetry'
? undefined
: (variableData.dynamicVariablesSource?.toLowerCase() as
| 'traces'
@@ -223,6 +225,10 @@ function DynamicVariableSelection({
'Please make sure configuration is valid and you have required setup and permissions';
}
setErrorMessage(message);
+
+ // Check if error is retryable (5xx) or not (4xx)
+ const isRetryable = checkIfRetryableError(error);
+ setIsRetryableError(isRetryable);
}
},
},
@@ -545,9 +551,12 @@ function DynamicVariableSelection({
onSearch={handleSearch}
onRetry={(): void => {
setErrorMessage(null);
+ setIsRetryableError(true);
refetch();
}}
showIncompleteDataMessage={!isComplete && filteredOptionsData.length > 0}
+ isDynamicVariable
+ showRetryButton={isRetryableError}
/>
) : (
<CustomSelect
@@ -570,11 +579,15 @@ function DynamicVariableSelection({
defaultValue={variableData.defaultValue}
errorMessage={errorMessage}
onSearch={handleSearch}
+ // eslint-disable-next-line sonarjs/no-identical-functions
onRetry={(): void => {
setErrorMessage(null);
+ setIsRetryableError(true);
refetch();
}}
showIncompleteDataMessage={!isComplete && filteredOptionsData.length > 0}
+ isDynamicVariable
+ showRetryButton={isRetryableError}
/>
)}
</div>
diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/__test__/DynamicVariableSelection.test.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/__test__/DynamicVariableSelection.test.tsx
index 95335d96ee..1a46a844d1 100644
--- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/__test__/DynamicVariableSelection.test.tsx
+++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/__test__/DynamicVariableSelection.test.tsx
@@ -181,7 +181,7 @@ describe('DynamicVariableSelection Component', () => {
fireEvent.mouseDown(selectElement);
// The loading text should appear in the dropdown
- expect(screen.getByText('We are updating the values...')).toBeInTheDocument();
+ expect(screen.getByText('Refreshing values...')).toBeInTheDocument();
});
it('handles error state correctly', () => {
diff --git a/frontend/src/utils/__tests__/errorUtils.test.ts b/frontend/src/utils/__tests__/errorUtils.test.ts
new file mode 100644
index 0000000000..fefefa6442
--- /dev/null
+++ b/frontend/src/utils/__tests__/errorUtils.test.ts
@@ -0,0 +1,50 @@
+import { getHttpStatusCode, isRetryableError } from '../errorUtils';
+
+// Mock APIError class
+class MockAPIError {
+ constructor(public httpStatusCode: number) {}
+
+ getHttpStatusCode(): number {
+ return this.httpStatusCode;
+ }
+}
+
+describe('errorUtils', () => {
+ describe('getHttpStatusCode', () => {
+ it('should extract status code from APIError instance', () => {
+ const error = new MockAPIError(401);
+ expect(getHttpStatusCode(error)).toBe(401);
+ });
+
+ it('should extract status code from AxiosError response', () => {
+ const error = {
+ response: { status: 500 },
+ };
+ expect(getHttpStatusCode(error)).toBe(500);
+ });
+
+ it('should return undefined for error without status code', () => {
+ const error = { message: 'Some error' };
+ expect(getHttpStatusCode(error)).toBeUndefined();
+ });
+ });
+
+ describe('isRetryableError', () => {
+ it('should return false for 4xx client errors', () => {
+ expect(isRetryableError(new MockAPIError(401))).toBe(false);
+ expect(isRetryableError(new MockAPIError(404))).toBe(false);
+ expect(isRetryableError(new MockAPIError(499))).toBe(false);
+ });
+
+ it('should return true for 5xx server errors', () => {
+ expect(isRetryableError(new MockAPIError(500))).toBe(true);
+ expect(isRetryableError(new MockAPIError(502))).toBe(true);
+ expect(isRetryableError(new MockAPIError(503))).toBe(true);
+ });
+
+ it('should return true for errors without status code (default to retryable)', () => {
+ const errorWithoutStatus = { message: 'Network error' };
+ expect(isRetryableError(errorWithoutStatus)).toBe(true);
+ });
+ });
+});
diff --git a/frontend/src/utils/errorUtils.ts b/frontend/src/utils/errorUtils.ts
new file mode 100644
index 0000000000..784ce563da
--- /dev/null
+++ b/frontend/src/utils/errorUtils.ts
@@ -0,0 +1,28 @@
+/**
+ * Extracts HTTP status code from various error types
+ * @param error - The error object (could be APIError, AxiosError, or other error types)
+ * @returns HTTP status code if available, undefined otherwise
+ */
+export const getHttpStatusCode = (error: any): number | undefined => {
+ if (!error) return undefined;
+
+ // Try to get status code from APIError instance (transformed by ErrorResponseHandlerV2)
+ if (typeof error.getHttpStatusCode === 'function') {
+ return error.getHttpStatusCode();
+ }
+
+ // Fallback for AxiosError or other error types
+ return error?.response?.status || error?.status;
+};
+
+/**
+ * Determines if an error is retryable based on HTTP status code
+ * @param error - The error object
+ * @returns true if error is retryable (5xx server errors), false for 4xx client errors
+ */
+export const isRetryableError = (error: any): boolean => {
+ const statusCode = getHttpStatusCode(error);
+ // 4xx errors are client errors (not retryable), 5xx errors are server errors (retryable)
+ // If no status code is available, default to retryable
+ return !statusCode || statusCode >= 500;
+};