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.

feat: created new error content plugin for QB v5 (#8700)

SagarRajput-701202b580013
diff --git a/frontend/src/api/metrics/getQueryRange.ts b/frontend/src/api/metrics/getQueryRange.ts
index 631372478d..d3ab626fa3 100644
--- a/frontend/src/api/metrics/getQueryRange.ts
+++ b/frontend/src/api/metrics/getQueryRange.ts
@@ -2,7 +2,7 @@ import { ApiV3Instance, ApiV4Instance } from 'api';
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
import { AxiosError } from 'axios';
import { ENTITY_VERSION_V4 } from 'constants/app';
-import { ErrorResponse, SuccessResponse } from 'types/api';
+import { ErrorResponse, SuccessResponse, Warning } from 'types/api';
import {
MetricRangePayloadV3,
QueryRangePayload,
@@ -13,7 +13,9 @@ export const getMetricsQueryRange = async (
version: string,
signal: AbortSignal,
headers?: Record<string, string>,
-): Promise<SuccessResponse<MetricRangePayloadV3> | ErrorResponse> => {
+): Promise<
+ (SuccessResponse<MetricRangePayloadV3> & { warning?: Warning }) | ErrorResponse
+> => {
try {
if (version && version === ENTITY_VERSION_V4) {
const response = await ApiV4Instance.post('/query_range', props, {
diff --git a/frontend/src/api/v5/queryRange/convertV5Response.ts b/frontend/src/api/v5/queryRange/convertV5Response.ts
index 37ff2bf8af..0be654bd0b 100644
--- a/frontend/src/api/v5/queryRange/convertV5Response.ts
+++ b/frontend/src/api/v5/queryRange/convertV5Response.ts
@@ -1,5 +1,5 @@
import { cloneDeep, isEmpty } from 'lodash-es';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
import { MetricRangePayloadV3 } from 'types/api/metrics/getQueryRange';
import {
DistributionData,
@@ -341,7 +341,7 @@ export function convertV5ResponseToLegacy(
v5Response: SuccessResponse<MetricRangePayloadV5>,
legendMap: Record<string, string>,
formatForWeb?: boolean,
-): SuccessResponse<MetricRangePayloadV3> {
+): SuccessResponse<MetricRangePayloadV3> & { warning?: Warning } {
const { payload, params } = v5Response;
const v5Data = payload?.data;
@@ -367,6 +367,7 @@ export function convertV5ResponseToLegacy(
legendMap,
aggregationPerQuery,
);
+
return {
...v5Response,
payload: {
@@ -374,7 +375,9 @@ export function convertV5ResponseToLegacy(
resultType: 'scalar',
result: webTables,
},
+ warning: v5Data?.warning || undefined,
},
+ warning: v5Data?.warning || undefined,
};
}
@@ -390,6 +393,7 @@ export function convertV5ResponseToLegacy(
...v5Response,
payload: {
data: convertedData,
+ warning: v5Response.payload?.data?.warning || undefined,
},
};
diff --git a/frontend/src/components/ErrorInPlace/ErrorInPlace.tsx b/frontend/src/components/ErrorInPlace/ErrorInPlace.tsx
new file mode 100644
index 0000000000..7fae206d04
--- /dev/null
+++ b/frontend/src/components/ErrorInPlace/ErrorInPlace.tsx
@@ -0,0 +1,79 @@
+import ErrorContent from 'components/ErrorModal/components/ErrorContent';
+import { ReactNode } from 'react';
+import APIError from 'types/api/error';
+
+interface ErrorInPlaceProps {
+ /** The error object to display */
+ error: APIError;
+ /** Custom class name */
+ className?: string;
+ /** Custom style */
+ style?: React.CSSProperties;
+ /** Whether to show a border */
+ bordered?: boolean;
+ /** Background color */
+ background?: string;
+ /** Padding */
+ padding?: string | number;
+ /** Height - defaults to 100% to take available space */
+ height?: string | number;
+ /** Width - defaults to 100% to take available space */
+ width?: string | number;
+ /** Custom content instead of ErrorContent */
+ children?: ReactNode;
+}
+
+/**
+ * ErrorInPlace - A component that renders error content directly in the available space
+ * of its parent container. Perfect for displaying errors in widgets, cards, or any
+ * container where you want the error to take up the full available space.
+ *
+ * @example
+ * <ErrorInPlace error={error} />
+ *
+ * @example
+ * <ErrorInPlace error={error} bordered background="#f5f5f5" padding={16} />
+ */
+function ErrorInPlace({
+ error,
+ className = '',
+ style,
+ bordered = false,
+ background,
+ padding = 16,
+ height = '100%',
+ width = '100%',
+ children,
+}: ErrorInPlaceProps): JSX.Element {
+ const containerStyle: React.CSSProperties = {
+ display: 'flex',
+ flexDirection: 'column',
+ width,
+ height,
+ padding: typeof padding === 'number' ? `${padding}px` : padding,
+ backgroundColor: background,
+ border: bordered ? '1px solid var(--bg-slate-400, #374151)' : 'none',
+ borderRadius: bordered ? '4px' : '0',
+ overflow: 'auto',
+ ...style,
+ };
+
+ return (
+ <div className={`error-in-place ${className}`.trim()} style={containerStyle}>
+ {children || <ErrorContent error={error} />}
+ </div>
+ );
+}
+
+ErrorInPlace.defaultProps = {
+ className: undefined,
+ style: undefined,
+ bordered: undefined,
+ background: undefined,
+ padding: undefined,
+ height: undefined,
+ width: undefined,
+ children: undefined,
+};
+
+export default ErrorInPlace;
diff --git a/frontend/src/components/ErrorPopover/ErrorPopover.tsx b/frontend/src/components/ErrorPopover/ErrorPopover.tsx
new file mode 100644
index 0000000000..0aa30901d3
--- /dev/null
+++ b/frontend/src/components/ErrorPopover/ErrorPopover.tsx
@@ -0,0 +1,33 @@
+/* eslint-disable react/jsx-props-no-spreading */
+import { Popover, PopoverProps } from 'antd';
+import { ReactNode } from 'react';
+
+interface ErrorPopoverProps extends Omit<PopoverProps, 'content'> {
+ /** Content to display in the popover */
+ content: ReactNode;
+ /** Element that triggers the popover */
+ children: ReactNode;
+}
+
+/**
+ * ErrorPopover - A clean wrapper around Ant Design's Popover
+ * that provides a simple interface for displaying content in a popover.
+ *
+ * @example
+ * <ErrorPopover content={<ErrorContent error={error} />}>
+ * <CircleX />
+ * </ErrorPopover>
+ */
+function ErrorPopover({
+ content,
+ children,
+ ...popoverProps
+}: ErrorPopoverProps): JSX.Element {
+ return (
+ <Popover content={content} {...popoverProps}>
+ {children}
+ </Popover>
+ );
+}
+
+export default ErrorPopover;
diff --git a/frontend/src/components/WarningPopover/WarningPopover.styles.scss b/frontend/src/components/WarningPopover/WarningPopover.styles.scss
new file mode 100644
index 0000000000..1867cf241e
--- /dev/null
+++ b/frontend/src/components/WarningPopover/WarningPopover.styles.scss
@@ -0,0 +1,208 @@
+.warning-content {
+ display: flex;
+ flex-direction: column;
+ // === SECTION: Summary (Top)
+ &__summary-section {
+ display: flex;
+ flex-direction: column;
+ border-bottom: 1px solid var(--bg-slate-400);
+ }
+
+ &__summary {
+ display: flex;
+ justify-content: space-between;
+ padding: 16px;
+ }
+
+ &__summary-left {
+ display: flex;
+ align-items: baseline;
+ gap: 8px;
+ }
+
+ &__summary-text {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ }
+
+ &__warning-code {
+ color: var(--bg-vanilla-100);
+ margin: 0;
+ font-size: 16px;
+ font-weight: 500;
+ line-height: 24px; /* 150% */
+ letter-spacing: -0.08px;
+ }
+
+ &__warning-message {
+ margin: 0;
+ color: var(--bg-vanilla-400);
+ font-size: 14px;
+ font-weight: 400;
+ line-height: 20px; /* 142.857% */
+ letter-spacing: -0.07px;
+ }
+
+ &__docs-button {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 9px 12.5px;
+ color: var(--bg-vanilla-400);
+ font-size: 12px;
+ font-weight: 400;
+ line-height: 18px; /* 150% */
+ letter-spacing: 0.12px;
+ border-radius: 2px;
+ border: 1px solid var(--bg-slate-400);
+ background: var(--bg-ink-300);
+ box-shadow: none;
+ }
+
+ &__message-badge {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 0px 16px 16px;
+
+ .key-value-label {
+ width: fit-content;
+ border-color: var(--bg-slate-400);
+ border-radius: 20px;
+ overflow: hidden;
+ &__key {
+ padding-left: 8px;
+ padding-right: 8px;
+ }
+ &__value {
+ padding-right: 10px;
+ color: var(--bg-vanilla-400);
+ font-size: 12px;
+ font-weight: 500;
+ line-height: 18px; /* 150% */
+ letter-spacing: 0.48px;
+ pointer-events: none;
+ }
+ }
+ &-label {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ &-dot {
+ height: 6px;
+ width: 6px;
+ background: var(--bg-sakura-500);
+ border-radius: 50%;
+ }
+ &-text {
+ color: var(--bg-vanilla-100);
+ font-size: 10px;
+ font-weight: 500;
+ line-height: 18px; /* 180% */
+ letter-spacing: 0.5px;
+ }
+ }
+ &-line {
+ flex: 1;
+ height: 8px;
+ background-image: radial-gradient(circle, #444c63 1px, transparent 2px);
+ background-size: 8px 11px;
+ background-position: top left;
+ padding: 6px;
+ }
+ }
+
+ // === SECTION: Message List (Bottom)
+
+ &__message-list-container {
+ position: relative;
+ }
+
+ &__message-list {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ max-height: 275px;
+ }
+
+ &__message-item {
+ position: relative;
+ margin-bottom: 4px;
+ color: var(--bg-vanilla-400);
+ font-family: Geist Mono;
+ font-size: 12px;
+ font-weight: 400;
+ line-height: 18px;
+ color: var(--bg-vanilla-400);
+ padding: 3px 12px;
+ padding-left: 26px;
+ }
+
+ &__message-item::before {
+ font-family: unset;
+ content: '';
+ position: absolute;
+ left: 12px;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 2px;
+ height: 4px;
+ border-radius: 50px;
+ background: var(--bg-slate-400);
+ }
+
+ &__scroll-hint {
+ position: absolute;
+ bottom: 10px;
+ left: 0px;
+ right: 0px;
+ margin: auto;
+ width: fit-content;
+ display: inline-flex;
+ padding: 4px 12px 4px 10px;
+ justify-content: center;
+ align-items: center;
+ gap: 3px;
+ background: var(--bg-slate-200);
+ border-radius: 20px;
+ box-shadow: 0px 103px 12px 0px rgba(0, 0, 0, 0.01),
+ 0px 66px 18px 0px rgba(0, 0, 0, 0.01), 0px 37px 22px 0px rgba(0, 0, 0, 0.03),
+ 0px 17px 17px 0px rgba(0, 0, 0, 0.04), 0px 4px 9px 0px rgba(0, 0, 0, 0.04);
+ }
+
+ &__scroll-hint-text {
+ color: var(--bg-vanilla-100);
+
+ font-size: 12px;
+ font-weight: 400;
+ line-height: 18px;
+ letter-spacing: -0.06px;
+ }
+}
+
+.lightMode {
+ .warning-content {
+ &__warning-code {
+ color: var(--bg-ink-100);
+ }
+ &__warning-message {
+ color: var(--bg-ink-400);
+ }
+ &__message-item {
+ color: var(--bg-ink-400);
+ }
+ &__message-badge {
+ &-label-text {
+ color: var(--bg-ink-400);
+ }
+ .key-value-label__value {
+ color: var(--bg-ink-400);
+ }
+ }
+ &__docs-button {
+ background: var(--bg-vanilla-100);
+ color: var(--bg-ink-100);
+ }
+ }
+}
diff --git a/frontend/src/components/WarningPopover/WarningPopover.tsx b/frontend/src/components/WarningPopover/WarningPopover.tsx
new file mode 100644
index 0000000000..472ecd74f3
--- /dev/null
+++ b/frontend/src/components/WarningPopover/WarningPopover.tsx
@@ -0,0 +1,142 @@
+/* eslint-disable react/jsx-props-no-spreading */
+import './WarningPopover.styles.scss';
+
+import { Color } from '@signozhq/design-tokens';
+import { Button, Popover, PopoverProps } from 'antd';
+import ErrorIcon from 'assets/Error';
+import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
+import { BookOpenText, ChevronsDown, TriangleAlert } from 'lucide-react';
+import KeyValueLabel from 'periscope/components/KeyValueLabel';
+import { ReactNode } from 'react';
+import { Warning } from 'types/api';
+
+interface WarningContentProps {
+ warning: Warning;
+}
+
+export function WarningContent({ warning }: WarningContentProps): JSX.Element {
+ const {
+ url: warningUrl,
+ warnings: warningMessages,
+ code: warningCode,
+ message: warningMessage,
+ } = warning || {};
+
+ if (!warning) {
+ return <div />;
+ }
+
+ return (
+ <section className="warning-content">
+ {/* Summary Header */}
+ <section className="warning-content__summary-section">
+ <header className="warning-content__summary">
+ <div className="warning-content__summary-left">
+ <div className="warning-content__icon-wrapper">
+ <ErrorIcon />
+ </div>
+
+ <div className="warning-content__summary-text">
+ <h2 className="warning-content__warning-code">{warningCode}</h2>
+ <p className="warning-content__warning-message">{warningMessage}</p>
+ </div>
+ </div>
+
+ {warningUrl && (
+ <div className="warning-content__summary-right">
+ <Button
+ type="default"
+ className="warning-content__docs-button"
+ href={warningUrl}
+ target="_blank"
+ data-testid="warning-docs-button"
+ >
+ <BookOpenText size={14} />
+ Open Docs
+ </Button>
+ </div>
+ )}
+ </header>
+
+ {warningMessages?.length > 0 && (
+ <div className="warning-content__message-badge">
+ <KeyValueLabel
+ badgeKey={
+ <div className="warning-content__message-badge-label">
+ <div className="warning-content__message-badge-label-dot" />
+ <div className="warning-content__message-badge-label-text">
+ MESSAGES
+ </div>
+ </div>
+ }
+ badgeValue={warningMessages.length.toString()}
+ />
+ <div className="warning-content__message-badge-line" />
+ </div>
+ )}
+ </section>
+
+ {/* Detailed Messages */}
+ <section className="warning-content__messages-section">
+ <div className="warning-content__message-list-container">
+ <OverlayScrollbar>
+ <ul className="warning-content__message-list">
+ {warningMessages?.map((warning) => (
+ <li className="warning-content__message-item" key={warning.message}>
+ {warning.message}
+ </li>
+ ))}
+ </ul>
+ </OverlayScrollbar>
+ {warningMessages?.length > 10 && (
+ <div className="warning-content__scroll-hint">
+ <ChevronsDown
+ size={16}
+ color={Color.BG_VANILLA_100}
+ className="warning-content__scroll-hint-icon"
+ />
+ <span className="warning-content__scroll-hint-text">
+ Scroll for more
+ </span>
+ </div>
+ )}
+ </div>
+ </section>
+ </section>
+ );
+}
+
+interface WarningPopoverProps extends PopoverProps {
+ children?: ReactNode;
+ warningData: Warning;
+}
+
+function WarningPopover({
+ children,
+ warningData,
+ ...popoverProps
+}: WarningPopoverProps): JSX.Element {
+ return (
+ <Popover
+ content={<WarningContent warning={warningData} />}
+ overlayStyle={{ padding: 0, maxWidth: '600px' }}
+ overlayInnerStyle={{ padding: 0 }}
+ autoAdjustOverflow
+ {...popoverProps}
+ >
+ {children || (
+ <TriangleAlert
+ size={16}
+ style={{ cursor: 'pointer' }}
+ color={Color.BG_AMBER_500}
+ />
+ )}
+ </Popover>
+ );
+}
+
+WarningPopover.defaultProps = {
+ children: undefined,
+};
+
+export default WarningPopover;
diff --git a/frontend/src/container/FormAlertRules/ChartPreview/ChartPreview.styles.scss b/frontend/src/container/FormAlertRules/ChartPreview/ChartPreview.styles.scss
index f8bcbc693c..8900af3f78 100644
--- a/frontend/src/container/FormAlertRules/ChartPreview/ChartPreview.styles.scss
+++ b/frontend/src/container/FormAlertRules/ChartPreview/ChartPreview.styles.scss
@@ -2,6 +2,12 @@
height: 57vh;
width: 100%;
+ .chart-preview-header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
.threshold-alert-uplot-chart-container {
height: calc(100% - 24px);
}
diff --git a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
index f8fb6d97bf..e6e56b5d02 100644
--- a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
+++ b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx
@@ -1,7 +1,8 @@
import './ChartPreview.styles.scss';
-import { InfoCircleOutlined } from '@ant-design/icons';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import Spinner from 'components/Spinner';
+import WarningPopover from 'components/WarningPopover/WarningPopover';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { FeatureKeys } from 'constants/features';
import { QueryParams } from 'constants/query';
@@ -34,7 +35,9 @@ import { useDispatch, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { UpdateTimeInterval } from 'store/actions';
import { AppState } from 'store/reducers';
+import { Warning } from 'types/api';
import { AlertDef } from 'types/api/alerts/def';
+import APIError from 'types/api/error';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { EQueryType } from 'types/common/dashboard';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -44,7 +47,7 @@ import { getSortedSeriesData } from 'utils/getSortedSeriesData';
import { getTimeRange } from 'utils/getTimeRange';
import { AlertDetectionTypes } from '..';
-import { ChartContainer, FailedMessageContainer } from './styles';
+import { ChartContainer } from './styles';
import { getThresholdLabel } from './utils';
export interface ChartPreviewProps {
@@ -289,20 +292,23 @@ function ChartPreview({
featureFlags?.find((flag) => flag.name === FeatureKeys.ANOMALY_DETECTION)
?.active || false;
+ const isWarning = !!queryResponse.data?.warning?.message;
return (
<div className="alert-chart-container" ref={graphRef}>
<ChartContainer>
- {headline}
+ <div className="chart-preview-header">
+ {headline}
+ {isWarning && (
+ <WarningPopover warningData={queryResponse.data?.warning as Warning} />
+ )}
+ </div>
<div className="threshold-alert-uplot-chart-container">
{queryResponse.isLoading && (
<Spinner size="large" tip="Loading..." height="100%" />
)}
{(queryResponse?.isError || queryResponse?.error) && (
- <FailedMessageContainer color="red" title="Failed to refresh the chart">
- <InfoCircleOutlined />
- {queryResponse.error.message || t('preview_chart_unexpected_error')}
- </FailedMessageContainer>
+ <ErrorInPlace error={queryResponse.error as APIError} />
)}
{chartDataAvailable && !isAnomalyDetectionAlert && (
diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx
index 95a76b233d..2caa2af0a6 100644
--- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx
+++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx
@@ -45,7 +45,6 @@ import { getLocalStorageGraphVisibilityState, handleGraphClick } from './utils';
function WidgetGraphComponent({
widget,
queryResponse,
- errorMessage,
version,
threshold,
headerMenuList,
@@ -366,7 +365,6 @@ function WidgetGraphComponent({
onDelete={handleOnDelete}
onClone={onCloneHandler}
queryResponse={queryResponse}
- errorMessage={errorMessage}
threshold={threshold}
headerMenuList={headerMenuList}
isWarning={isWarning}
diff --git a/frontend/src/container/GridCardLayout/GridCard/index.tsx b/frontend/src/container/GridCardLayout/GridCard/index.tsx
index 2579463da0..35a525b536 100644
--- a/frontend/src/container/GridCardLayout/GridCard/index.tsx
+++ b/frontend/src/container/GridCardLayout/GridCard/index.tsx
@@ -267,7 +267,6 @@ function GridCardGraph({
getGraphData?.(data?.payload?.data);
setDashboardQueryRangeCalled(true);
},
- showErrorModal: false,
},
);
@@ -302,7 +301,7 @@ function GridCardGraph({
widget={widget}
queryResponse={queryResponse}
errorMessage={errorMessage}
- isWarning={false}
+ isWarning={!!queryResponse.data?.warning?.message}
version={version}
threshold={threshold}
headerMenuList={menuList}
diff --git a/frontend/src/container/GridCardLayout/WidgetHeader/index.tsx b/frontend/src/container/GridCardLayout/WidgetHeader/index.tsx
index e9feb1744b..da55eaa0ff 100644
--- a/frontend/src/container/GridCardLayout/WidgetHeader/index.tsx
+++ b/frontend/src/container/GridCardLayout/WidgetHeader/index.tsx
@@ -10,10 +10,13 @@ import {
InfoCircleOutlined,
MoreOutlined,
SearchOutlined,
- WarningOutlined,
} from '@ant-design/icons';
+import { Color } from '@signozhq/design-tokens';
import { Dropdown, Input, MenuProps, Tooltip, Typography } from 'antd';
+import ErrorContent from 'components/ErrorModal/components/ErrorContent';
+import ErrorPopover from 'components/ErrorPopover/ErrorPopover';
import Spinner from 'components/Spinner';
+import WarningPopover from 'components/WarningPopover/WarningPopover';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import useGetResolvedText from 'hooks/dashboard/useGetResolvedText';
@@ -28,11 +31,12 @@ import { unparse } from 'papaparse';
import { useAppContext } from 'providers/App/App';
import { ReactNode, useCallback, useMemo, useState } from 'react';
import { UseQueryResult } from 'react-query';
-import { ErrorResponse, SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
import { Widgets } from 'types/api/dashboard/getAll';
+import APIError from 'types/api/error';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
-import { errorTooltipPosition, WARNING_MESSAGE } from './config';
+import { errorTooltipPosition } from './config';
import { MENUITEM_KEYS_VS_LABELS, MenuItemKeys } from './contants';
import { MenuItem } from './types';
import { generateMenuList, isTWidgetOptions } from './utils';
@@ -45,9 +49,11 @@ interface IWidgetHeaderProps {
onClone?: VoidFunction;
parentHover: boolean;
queryResponse: UseQueryResult<
- SuccessResponse<MetricRangePayloadProps> | ErrorResponse
+ SuccessResponse<MetricRangePayloadProps, unknown> & {
+ warning?: Warning;
+ },
+ Error
>;
- errorMessage: string | undefined;
threshold?: ReactNode;
headerMenuList?: MenuItemKeys[];
isWarning: boolean;
@@ -64,7 +70,6 @@ function WidgetHeader({
onClone,
parentHover,
queryResponse,
- errorMessage,
threshold,
headerMenuList,
isWarning,
@@ -212,12 +217,8 @@ function WidgetHeader({
});
const renderErrorMessage = useMemo(
- () =>
- errorMessage
- ?.split('\n')
- // eslint-disable-next-line react/no-array-index-key
- .map((item, i) => <p key={i}>{item}</p>),
- [errorMessage],
+ () => <ErrorContent error={queryResponse.error as APIError} />,
+ [queryResponse.error],
);
if (widget.id === PANEL_TYPES.EMPTY_WIDGET) {
@@ -278,23 +279,23 @@ function WidgetHeader({
<Spinner style={{ paddingRight: '0.25rem' }} />
)}
{queryResponse.isError && (
- <Tooltip
- title={renderErrorMessage}
+ <ErrorPopover
+ content={renderErrorMessage}
placement={errorTooltipPosition}
- className="widget-api-actions"
+ overlayStyle={{ padding: 0, maxWidth: '600px' }}
+ overlayInnerStyle={{ padding: 0 }}
+ autoAdjustOverflow
>
- <CircleX size={20} />
- </Tooltip>
+ <CircleX
+ size={16}
+ style={{ cursor: 'pointer' }}
+ color={Color.BG_CHERRY_500}
+ />
+ </ErrorPopover>
)}
- {isWarning && (
- <Tooltip
- title={WARNING_MESSAGE}
- placement={errorTooltipPosition}
- className="widget-api-actions"
- >
- <WarningOutlined />
- </Tooltip>
+ {isWarning && queryResponse.data?.warning && (
+ <WarningPopover warningData={queryResponse.data?.warning as Warning} />
)}
{globalSearchAvailable && (
<SearchOutlined
diff --git a/frontend/src/container/LogsExplorerList/LogsExplorerList.interfaces.ts b/frontend/src/container/LogsExplorerList/LogsExplorerList.interfaces.ts
index e0e9c57353..eaae472016 100644
--- a/frontend/src/container/LogsExplorerList/LogsExplorerList.interfaces.ts
+++ b/frontend/src/container/LogsExplorerList/LogsExplorerList.interfaces.ts
@@ -1,3 +1,4 @@
+import APIError from 'types/api/error';
import { ILog } from 'types/api/logs/log';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
@@ -8,5 +9,6 @@ export type LogsExplorerListProps = {
logs: ILog[];
onEndReached: (index: number) => void;
isError: boolean;
+ error?: Error | APIError;
isFilterApplied: boolean;
};
diff --git a/frontend/src/container/LogsExplorerList/__tests__/LogsExplorerList.test.tsx b/frontend/src/container/LogsExplorerList/__tests__/LogsExplorerList.test.tsx
index 83e974734c..45557a7284 100644
--- a/frontend/src/container/LogsExplorerList/__tests__/LogsExplorerList.test.tsx
+++ b/frontend/src/container/LogsExplorerList/__tests__/LogsExplorerList.test.tsx
@@ -141,6 +141,7 @@ describe('LogsExplorerList - empty states', () => {
setIsLoadingQueries={(): void => {}}
listQueryKeyRef={{ current: {} }}
chartQueryKeyRef={{ current: {} }}
+ setWarning={(): void => {}}
/>
</PreferenceContextProvider>
</QueryBuilderContext.Provider>,
@@ -205,6 +206,7 @@ describe('LogsExplorerList - empty states', () => {
setIsLoadingQueries={(): void => {}}
listQueryKeyRef={{ current: {} }}
chartQueryKeyRef={{ current: {} }}
+ setWarning={(): void => {}}
/>
</PreferenceContextProvider>
</QueryBuilderContext.Provider>,
diff --git a/frontend/src/container/LogsExplorerList/index.tsx b/frontend/src/container/LogsExplorerList/index.tsx
index 522f97e0df..97da67458b 100644
--- a/frontend/src/container/LogsExplorerList/index.tsx
+++ b/frontend/src/container/LogsExplorerList/index.tsx
@@ -2,6 +2,7 @@ import './LogsExplorerList.style.scss';
import { Card } from 'antd';
import logEvent from 'api/common/logEvent';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import LogDetail from 'components/LogDetail';
import { VIEW_TYPES } from 'components/LogDetail/constants';
// components
@@ -12,7 +13,6 @@ import Spinner from 'components/Spinner';
import { CARD_BODY_STYLE } from 'constants/card';
import { LOCALSTORAGE } from 'constants/localStorage';
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
-import LogsError from 'container/LogsError/LogsError';
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
import { useOptionsMenu } from 'container/OptionsMenu';
import { FontSize } from 'container/OptionsMenu/types';
@@ -21,6 +21,7 @@ import { useCopyLogLink } from 'hooks/logs/useCopyLogLink';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
+import APIError from 'types/api/error';
// interfaces
import { ILog } from 'types/api/logs/log';
import { DataSource, StringOperators } from 'types/common/queryBuilder';
@@ -45,6 +46,7 @@ function LogsExplorerList({
logs,
onEndReached,
isError,
+ error,
isFilterApplied,
}: LogsExplorerListProps): JSX.Element {
const ref = useRef<VirtuosoHandle>(null);
@@ -256,7 +258,9 @@ function LogsExplorerList({
/>
)}
- {isError && !isLoading && !isFetching && <LogsError />}
+ {isError && !isLoading && !isFetching && error && (
+ <ErrorInPlace error={error as APIError} />
+ )}
{!isLoading && !isError && logs.length > 0 && (
<>
diff --git a/frontend/src/container/LogsExplorerTable/LogsExplorerTable.interfaces.ts b/frontend/src/container/LogsExplorerTable/LogsExplorerTable.interfaces.ts
index 22c1dfc00d..bdc13eb38b 100644
--- a/frontend/src/container/LogsExplorerTable/LogsExplorerTable.interfaces.ts
+++ b/frontend/src/container/LogsExplorerTable/LogsExplorerTable.interfaces.ts
@@ -1,7 +1,9 @@
+import APIError from 'types/api/error';
import { QueryDataV3 } from 'types/api/widgets/getQuery';
export type LogsExplorerTableProps = {
data: QueryDataV3[];
isLoading: boolean;
isError: boolean;
+ error?: Error | APIError;
};
diff --git a/frontend/src/container/LogsExplorerTable/index.tsx b/frontend/src/container/LogsExplorerTable/index.tsx
index e65bd61464..7ee6b7f924 100644
--- a/frontend/src/container/LogsExplorerTable/index.tsx
+++ b/frontend/src/container/LogsExplorerTable/index.tsx
@@ -1,11 +1,12 @@
import './LogsExplorerTable.styles.scss';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import { initialQueriesMap } from 'constants/queryBuilder';
-import LogsError from 'container/LogsError/LogsError';
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
import { QueryTable } from 'container/QueryTable';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { memo } from 'react';
+import APIError from 'types/api/error';
import { LogsExplorerTableProps } from './LogsExplorerTable.interfaces';
@@ -13,6 +14,7 @@ function LogsExplorerTable({
data,
isLoading,
isError,
+ error,
}: LogsExplorerTableProps): JSX.Element {
const { stagedQuery } = useQueryBuilder();
@@ -20,8 +22,8 @@ function LogsExplorerTable({
return <LogsLoading />;
}
- if (isError) {
- return <LogsError />;
+ if (isError && error) {
+ return <ErrorInPlace error={error as APIError} />;
}
return (
diff --git a/frontend/src/container/LogsExplorerViews/index.tsx b/frontend/src/container/LogsExplorerViews/index.tsx
index c7764fd1e0..ecfc80f1fe 100644
--- a/frontend/src/container/LogsExplorerViews/index.tsx
+++ b/frontend/src/container/LogsExplorerViews/index.tsx
@@ -51,8 +51,10 @@ import { ArrowUp10, Minus, Sliders } from 'lucide-react';
import { ExplorerViews } from 'pages/LogsExplorer/utils';
import { useTimezone } from 'providers/Timezone';
import {
+ Dispatch,
memo,
MutableRefObject,
+ SetStateAction,
useCallback,
useEffect,
useMemo,
@@ -62,7 +64,9 @@ import {
import { useDispatch, useSelector } from 'react-redux';
import { UpdateTimeInterval } from 'store/actions';
import { AppState } from 'store/reducers';
+import { Warning } from 'types/api';
import { Dashboard } from 'types/api/dashboard/getAll';
+import APIError from 'types/api/error';
import { ILog } from 'types/api/logs/log';
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
import {
@@ -87,6 +91,7 @@ function LogsExplorerViewsContainer({
setIsLoadingQueries,
listQueryKeyRef,
chartQueryKeyRef,
+ setWarning,
}: {
selectedView: ExplorerViews;
setIsLoadingQueries: React.Dispatch<React.SetStateAction<boolean>>;
@@ -94,6 +99,7 @@ function LogsExplorerViewsContainer({
listQueryKeyRef: MutableRefObject<any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
chartQueryKeyRef: MutableRefObject<any>;
+ setWarning: Dispatch<SetStateAction<Warning | undefined>>;
}): JSX.Element {
const { safeNavigate } = useSafeNavigate();
const dispatch = useDispatch();
@@ -269,6 +275,7 @@ function LogsExplorerViewsContainer({
isFetching,
isError,
isSuccess,
+ error,
} = useGetExplorerQueryRange(
requestData,
panelType,
@@ -372,6 +379,13 @@ function LogsExplorerViewsContainer({
[activeLogId, orderBy, listQuery, selectedView],
);
+ useEffect(() => {
+ if (data?.payload) {
+ setWarning(data?.warning);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data?.payload, data?.warning]);
+
const handleEndReached = useCallback(() => {
if (!listQuery) return;
@@ -771,6 +785,7 @@ function LogsExplorerViewsContainer({
logs={logs}
onEndReached={handleEndReached}
isError={isError}
+ error={error as APIError}
isFilterApplied={!isEmpty(listQuery?.filters?.items)}
/>
)}
@@ -780,8 +795,10 @@ function LogsExplorerViewsContainer({
isLoading={isLoading || isFetching}
data={data}
isError={isError}
+ error={error as APIError}
isFilterApplied={!isEmpty(listQuery?.filters?.items)}
dataSource={DataSource.LOGS}
+ setWarning={setWarning}
/>
)}
@@ -794,6 +811,7 @@ function LogsExplorerViewsContainer({
}
isLoading={isLoading || isFetching}
isError={isError}
+ error={error as APIError}
/>
)}
</div>
diff --git a/frontend/src/container/LogsExplorerViews/tests/LogsExplorerViews.test.tsx b/frontend/src/container/LogsExplorerViews/tests/LogsExplorerViews.test.tsx
index aa52db717c..e922ad542c 100644
--- a/frontend/src/container/LogsExplorerViews/tests/LogsExplorerViews.test.tsx
+++ b/frontend/src/container/LogsExplorerViews/tests/LogsExplorerViews.test.tsx
@@ -131,6 +131,7 @@ const renderer = (): RenderResult =>
setIsLoadingQueries={(): void => {}}
listQueryKeyRef={{ current: {} }}
chartQueryKeyRef={{ current: {} }}
+ setWarning={(): void => {}}
/>
</PreferenceContextProvider>
</VirtuosoMockContext.Provider>,
@@ -172,21 +173,6 @@ describe('LogsExplorerViews -', () => {
expect(queryByText('pending_data_placeholder')).toBeInTheDocument();
});
- it('check error state', async () => {
- lodsQueryServerRequest();
- (useGetExplorerQueryRange as jest.Mock).mockReturnValue({
- data: { payload: logsQueryRangeSuccessNewFormatResponse },
- isLoading: false,
- isFetching: false,
- isError: true,
- });
- const { queryByText } = renderer();
-
- expect(
- queryByText('Something went wrong. Please try again or contact support.'),
- ).toBeInTheDocument();
- });
-
it('should add activeLogId filter when present in URL', async () => {
// Mock useCopyLogLink to return an activeLogId
(useCopyLogLink as jest.Mock).mockReturnValue({
@@ -206,6 +192,7 @@ describe('LogsExplorerViews -', () => {
setIsLoadingQueries={(): void => {}}
listQueryKeyRef={{ current: {} }}
chartQueryKeyRef={{ current: {} }}
+ setWarning={(): void => {}}
/>
</PreferenceContextProvider>
</QueryBuilderContext.Provider>,
diff --git a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
index 8e408d43f3..a2dbf01836 100644
--- a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
+++ b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx
@@ -4,6 +4,7 @@ import * as Sentry from '@sentry/react';
import { Switch } from 'antd';
import logEvent from 'api/common/logEvent';
import { QueryBuilderV2 } from 'components/QueryBuilderV2/QueryBuilderV2';
+import WarningPopover from 'components/WarningPopover/WarningPopover';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import ExplorerOptionWrapper from 'container/ExplorerOptions/ExplorerOptionWrapper';
import RightToolbarActions from 'container/QueryBuilder/components/ToolbarActions/RightToolbarActions';
@@ -15,6 +16,7 @@ import { useSafeNavigate } from 'hooks/useSafeNavigate';
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useSearchParams } from 'react-router-dom-v5-compat';
+import { Warning } from 'types/api';
import { Dashboard } from 'types/api/dashboard/getAll';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
@@ -118,6 +120,8 @@ function Explorer(): JSX.Element {
[],
);
+ const [warning, setWarning] = useState<Warning | undefined>(undefined);
+
return (
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
<div className="metrics-explorer-explore-container">
@@ -131,6 +135,7 @@ function Explorer(): JSX.Element {
/>
</div>
<div className="explore-header-right-actions">
+ {warning?.message && <WarningPopover warningData={warning} />}
<DateTimeSelector showAutoRefresh />
<RightToolbarActions
onStageRunQuery={(): void => handleRunQuery(true, true)}
@@ -167,7 +172,10 @@ function Explorer(): JSX.Element {
</Button.Group> */}
<div className="explore-content">
{selectedTab === ExplorerTabs.TIME_SERIES && (
- <TimeSeries showOneChartPerQuery={showOneChartPerQuery} />
+ <TimeSeries
+ showOneChartPerQuery={showOneChartPerQuery}
+ setWarning={setWarning}
+ />
)}
{/* TODO: Enable once we have resolved all related metrics issues */}
{/* {selectedTab === ExplorerTabs.RELATED_METRICS && (
diff --git a/frontend/src/container/MetricsExplorer/Explorer/TimeSeries.tsx b/frontend/src/container/MetricsExplorer/Explorer/TimeSeries.tsx
index aba98281b1..551f297662 100644
--- a/frontend/src/container/MetricsExplorer/Explorer/TimeSeries.tsx
+++ b/frontend/src/container/MetricsExplorer/Explorer/TimeSeries.tsx
@@ -8,7 +8,6 @@ import TimeSeriesView from 'container/TimeSeriesView/TimeSeriesView';
import { convertDataValueToMs } from 'container/TimeSeriesView/utils';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
-import { useErrorModal } from 'providers/ErrorModalProvider';
import { useMemo, useState } from 'react';
import { useQueries } from 'react-query';
import { useSelector } from 'react-redux';
@@ -22,7 +21,10 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { TimeSeriesProps } from './types';
import { splitQueryIntoOneChartPerQuery } from './utils';
-function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
+function TimeSeries({
+ showOneChartPerQuery,
+ setWarning,
+}: TimeSeriesProps): JSX.Element {
const { stagedQuery, currentQuery } = useQueryBuilder();
const { selectedTime: globalSelectedTime, maxTime, minTime } = useSelector<
@@ -61,8 +63,6 @@ function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
const [yAxisUnit, setYAxisUnit] = useState<string>('');
- const { showErrorModal } = useErrorModal();
-
const queries = useQueries(
queryPayloads.map((payload, index) => ({
queryKey: [
@@ -104,9 +104,6 @@ function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
return failureCount < 3;
},
- onError: (error: APIError): void => {
- showErrorModal(error);
- },
})),
);
@@ -150,6 +147,8 @@ function TimeSeries({ showOneChartPerQuery }: TimeSeriesProps): JSX.Element {
data={datapoint}
yAxisUnit={yAxisUnit}
dataSource={DataSource.METRICS}
+ error={queries[index].error as APIError}
+ setWarning={setWarning}
/>
</div>
))}
diff --git a/frontend/src/container/MetricsExplorer/Explorer/types.ts b/frontend/src/container/MetricsExplorer/Explorer/types.ts
index fdcfd91422..9d8940b39b 100644
--- a/frontend/src/container/MetricsExplorer/Explorer/types.ts
+++ b/frontend/src/container/MetricsExplorer/Explorer/types.ts
@@ -1,6 +1,7 @@
import { RelatedMetric } from 'api/metricsExplorer/getRelatedMetrics';
+import { Dispatch, SetStateAction } from 'react';
import { UseQueryResult } from 'react-query';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
export enum ExplorerTabs {
@@ -10,6 +11,7 @@ export enum ExplorerTabs {
export interface TimeSeriesProps {
showOneChartPerQuery: boolean;
+ setWarning: Dispatch<SetStateAction<Warning | undefined>>;
}
export interface RelatedMetricsProps {
diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraph.styles.scss b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraph.styles.scss
index 26c99e5a37..19c743ca52 100644
--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraph.styles.scss
+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraph.styles.scss
@@ -10,6 +10,12 @@
align-items: center;
justify-content: space-between;
+ .header-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
.plot-tag {
display: inline-flex;
padding: 4px 4px 4px 6px;
diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphContainer.tsx b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphContainer.tsx
index b7abd49b17..e86a46d8f7 100644
--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphContainer.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphContainer.tsx
@@ -1,7 +1,9 @@
import { Card, Typography } from 'antd';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import Spinner from 'components/Spinner';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { WidgetGraphContainerProps } from 'container/NewWidget/types';
+import APIError from 'types/api/error';
import { getSortedSeriesData } from 'utils/getSortedSeriesData';
import { NotFoundContainer } from './styles';
@@ -36,7 +38,7 @@ function WidgetGraphContainer({
if (queryResponse?.error) {
return (
<NotFoundContainer>
- <Typography>{queryResponse.error.message}</Typography>
+ <ErrorInPlace error={queryResponse.error as APIError} />
</NotFoundContainer>
);
}
diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/index.tsx b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/index.tsx
index 8ff3fe03f7..622566a247 100644
--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/index.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/index.tsx
@@ -1,11 +1,13 @@
import './WidgetGraph.styles.scss';
import { InfoCircleOutlined } from '@ant-design/icons';
+import WarningPopover from 'components/WarningPopover/WarningPopover';
import { Card } from 'container/GridCardLayout/styles';
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { memo } from 'react';
+import { Warning } from 'types/api';
import { WidgetGraphContainerProps } from '../../types';
import PlotTag from './PlotTag';
@@ -34,7 +36,12 @@ function WidgetGraph({
return (
<Container $panelType={selectedGraph} className="widget-graph">
<div className="header">
- <PlotTag queryType={currentQuery.queryType} panelType={selectedGraph} />
+ <div className="header-left">
+ <PlotTag queryType={currentQuery.queryType} panelType={selectedGraph} />
+ {queryResponse.data?.warning?.message && (
+ <WarningPopover warningData={queryResponse.data?.warning as Warning} />
+ )}
+ </div>
<DateTimeSelectionV2 showAutoRefresh={false} hideShareModal />
</div>
{queryResponse.error && (
diff --git a/frontend/src/container/NewWidget/types.ts b/frontend/src/container/NewWidget/types.ts
index 0b9b001e7c..7dc34e1342 100644
--- a/frontend/src/container/NewWidget/types.ts
+++ b/frontend/src/container/NewWidget/types.ts
@@ -2,7 +2,7 @@ import { PANEL_TYPES } from 'constants/queryBuilder';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import { Dispatch, SetStateAction } from 'react';
import { UseQueryResult } from 'react-query';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
import { Widgets } from 'types/api/dashboard/getAll';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
@@ -36,7 +36,9 @@ export interface WidgetGraphProps {
export type WidgetGraphContainerProps = {
queryResponse: UseQueryResult<
- SuccessResponse<MetricRangePayloadProps, unknown>,
+ SuccessResponse<MetricRangePayloadProps, unknown> & {
+ warning?: Warning;
+ },
Error
>;
setRequestData: Dispatch<SetStateAction<GetQueryResultsProps>>;
diff --git a/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx b/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx
index 7ba3e12ab1..58c03f3d87 100644
--- a/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx
+++ b/frontend/src/container/TimeSeriesView/TimeSeriesView.tsx
@@ -1,10 +1,10 @@
import './TimeSeriesView.styles.scss';
import logEvent from 'api/common/logEvent';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import Uplot from 'components/Uplot';
import { QueryParams } from 'constants/query';
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
-import LogsError from 'container/LogsError/LogsError';
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
import EmptyMetricsSearch from 'container/MetricsExplorer/Explorer/EmptyMetricsSearch';
import { MetricsLoading } from 'container/MetricsExplorer/MetricsLoading/MetricsLoading';
@@ -22,12 +22,21 @@ import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
import { isEmpty } from 'lodash-es';
import { useTimezone } from 'providers/Timezone';
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import {
+ Dispatch,
+ SetStateAction,
+ useCallback,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { UpdateTimeInterval } from 'store/actions';
import { AppState } from 'store/reducers';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
+import APIError from 'types/api/error';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import { DataSource } from 'types/common/queryBuilder';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -38,9 +47,11 @@ function TimeSeriesView({
data,
isLoading,
isError,
+ error,
yAxisUnit,
isFilterApplied,
dataSource,
+ setWarning,
}: TimeSeriesViewProps): JSX.Element {
const graphRef = useRef<HTMLDivElement>(null);
@@ -53,6 +64,13 @@ function TimeSeriesView({
data?.payload,
]);
+ useEffect(() => {
+ if (data?.payload) {
+ setWarning?.(data?.warning);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data?.payload, data?.warning]);
+
const isDarkMode = useIsDarkMode();
const containerDimensions = useResizeObserver(graphRef);
@@ -165,7 +183,7 @@ function TimeSeriesView({
return (
<div className="time-series-view">
- {isError && <LogsError />}
+ {isError && error && <ErrorInPlace error={error as APIError} />}
<div
className="graph-container"
style={{ height: '100%', width: '100%' }}
@@ -211,17 +229,21 @@ function TimeSeriesView({
}
interface TimeSeriesViewProps {
- data?: SuccessResponse<MetricRangePayloadProps>;
+ data?: SuccessResponse<MetricRangePayloadProps> & { warning?: Warning };
yAxisUnit?: string;
isLoading: boolean;
isError: boolean;
+ error?: Error | APIError;
isFilterApplied: boolean;
dataSource: DataSource;
+ setWarning?: Dispatch<SetStateAction<Warning | undefined>>;
}
TimeSeriesView.defaultProps = {
data: undefined,
yAxisUnit: 'short',
+ error: undefined,
+ setWarning: undefined,
};
export default TimeSeriesView;
diff --git a/frontend/src/container/TimeSeriesView/index.tsx b/frontend/src/container/TimeSeriesView/index.tsx
index 8b27c31a92..16fcfe6f45 100644
--- a/frontend/src/container/TimeSeriesView/index.tsx
+++ b/frontend/src/container/TimeSeriesView/index.tsx
@@ -5,9 +5,11 @@ import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
-import { useMemo } from 'react';
+import { Dispatch, SetStateAction, useEffect, useMemo } from 'react';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
+import { Warning } from 'types/api';
+import APIError from 'types/api/error';
import { DataSource } from 'types/common/queryBuilder';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -17,6 +19,7 @@ import { convertDataValueToMs } from './utils';
function TimeSeriesViewContainer({
dataSource = DataSource.TRACES,
isFilterApplied,
+ setWarning,
}: TimeSeriesViewProps): JSX.Element {
const { stagedQuery, currentQuery, panelType } = useQueryBuilder();
@@ -44,7 +47,7 @@ function TimeSeriesViewContainer({
return isValid.every(Boolean);
}, [currentQuery]);
- const { data, isLoading, isError } = useGetQueryRange(
+ const { data, isLoading, isError, error } = useGetQueryRange(
{
query: stagedQuery || initialQueriesMap[dataSource],
graphType: panelType || PANEL_TYPES.TIME_SERIES,
@@ -68,6 +71,13 @@ function TimeSeriesViewContainer({
},
);
+ useEffect(() => {
+ if (data?.payload) {
+ setWarning(data?.warning);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data?.payload, data?.warning]);
+
const responseData = useMemo(
() => (isValidToConvertToMs ? convertDataValueToMs(data) : data),
[data, isValidToConvertToMs],
@@ -77,10 +87,12 @@ function TimeSeriesViewContainer({
<TimeSeriesView
isFilterApplied={isFilterApplied}
isError={isError}
+ error={error as APIError}
isLoading={isLoading}
data={responseData}
yAxisUnit={isValidToConvertToMs ? 'ms' : 'short'}
dataSource={dataSource}
+ setWarning={setWarning}
/>
);
}
@@ -88,6 +100,7 @@ function TimeSeriesViewContainer({
interface TimeSeriesViewProps {
dataSource?: DataSource;
isFilterApplied: boolean;
+ setWarning: Dispatch<SetStateAction<Warning | undefined>>;
}
TimeSeriesViewContainer.defaultProps = {
diff --git a/frontend/src/container/Toolbar/Toolbar.tsx b/frontend/src/container/Toolbar/Toolbar.tsx
index d85e383af5..87a50990e0 100644
--- a/frontend/src/container/Toolbar/Toolbar.tsx
+++ b/frontend/src/container/Toolbar/Toolbar.tsx
@@ -11,6 +11,7 @@ interface ToolbarProps {
leftActions?: JSX.Element;
rightActions?: JSX.Element;
showOldCTA?: boolean;
+ warningElement?: JSX.Element;
}
export default function Toolbar({
@@ -18,6 +19,7 @@ export default function Toolbar({
leftActions,
rightActions,
showOldCTA,
+ warningElement,
}: ToolbarProps): JSX.Element {
const { pathname } = useLocation();
@@ -35,6 +37,7 @@ export default function Toolbar({
<div className="rightActions">
<div className="timeRange">
+ {warningElement}
{showOldCTA && <NewExplorerCTA />}
<DateTimeSelectionV2
showAutoRefresh={showAutoRefresh}
@@ -53,4 +56,5 @@ Toolbar.defaultProps = {
leftActions: <div />,
rightActions: <div />,
showOldCTA: false,
+ warningElement: <div />,
};
diff --git a/frontend/src/container/TracesExplorer/ListView/index.tsx b/frontend/src/container/TracesExplorer/ListView/index.tsx
index a08953ded2..e9a416899d 100644
--- a/frontend/src/container/TracesExplorer/ListView/index.tsx
+++ b/frontend/src/container/TracesExplorer/ListView/index.tsx
@@ -1,6 +1,7 @@
import './ListView.styles.scss';
import logEvent from 'api/common/logEvent';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import ListViewOrderBy from 'components/OrderBy/ListViewOrderBy';
import { ResizeTable } from 'components/ResizeTable';
import { ENTITY_VERSION_V5 } from 'constants/app';
@@ -24,22 +25,33 @@ import { RowData } from 'lib/query/createTableColumnsFromQuery';
import { cloneDeep } from 'lodash-es';
import { ArrowUp10, Minus } from 'lucide-react';
import { useTimezone } from 'providers/Timezone';
-import { memo, useCallback, useEffect, useMemo, useState } from 'react';
+import {
+ Dispatch,
+ memo,
+ SetStateAction,
+ useCallback,
+ useEffect,
+ useMemo,
+ useState,
+} from 'react';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
+import { Warning } from 'types/api';
+import APIError from 'types/api/error';
import { DataSource } from 'types/common/queryBuilder';
import { GlobalReducer } from 'types/reducer/globalTime';
import { TracesLoading } from '../TraceLoading/TraceLoading';
import { defaultSelectedColumns, PER_PAGE_OPTIONS } from './configs';
-import { Container, ErrorText, tableStyles } from './styles';
+import { Container, tableStyles } from './styles';
import { getListColumns, transformDataWithDate } from './utils';
interface ListViewProps {
isFilterApplied: boolean;
+ setWarning: Dispatch<SetStateAction<Warning | undefined>>;
}
-function ListView({ isFilterApplied }: ListViewProps): JSX.Element {
+function ListView({ isFilterApplied, setWarning }: ListViewProps): JSX.Element {
const {
stagedQuery,
panelType: panelTypeFromQueryBuilder,
@@ -116,7 +128,7 @@ function ListView({ isFilterApplied }: ListViewProps): JSX.Element {
],
);
- const { data, isFetching, isLoading, isError } = useGetQueryRange(
+ const { data, isFetching, isLoading, isError, error } = useGetQueryRange(
{
query: requestQuery,
graphType: panelType,
@@ -143,6 +155,13 @@ function ListView({ isFilterApplied }: ListViewProps): JSX.Element {
},
);
+ useEffect(() => {
+ if (data?.payload) {
+ setWarning(data?.warning);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data?.payload, data?.warning]);
+
const dataLength =
data?.payload?.data?.newResult?.data?.result[0]?.list?.length;
const totalCount = useMemo(() => dataLength || 0, [dataLength]);
@@ -220,7 +239,7 @@ function ListView({ isFilterApplied }: ListViewProps): JSX.Element {
</div>
)}
- {isError && <ErrorText>{data?.error || 'Something went wrong'}</ErrorText>}
+ {isError && error && <ErrorInPlace error={error as APIError} />}
{(isLoading || (isFetching && transformedQueryTableData.length === 0)) && (
<TracesLoading />
diff --git a/frontend/src/container/TracesExplorer/TableView/index.tsx b/frontend/src/container/TracesExplorer/TableView/index.tsx
index a6de39409e..9c117aea13 100644
--- a/frontend/src/container/TracesExplorer/TableView/index.tsx
+++ b/frontend/src/container/TracesExplorer/TableView/index.tsx
@@ -1,17 +1,24 @@
import { Space } from 'antd';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { QueryTable } from 'container/QueryTable';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
-import { memo, useMemo } from 'react';
+import { Dispatch, memo, SetStateAction, useEffect, useMemo } from 'react';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
+import { Warning } from 'types/api';
+import APIError from 'types/api/error';
import { QueryDataV3 } from 'types/api/widgets/getQuery';
import { GlobalReducer } from 'types/reducer/globalTime';
-function TableView(): JSX.Element {
+function TableView({
+ setWarning,
+}: {
+ setWarning: Dispatch<SetStateAction<Warning | undefined>>;
+}): JSX.Element {
const { stagedQuery, panelType } = useQueryBuilder();
const { selectedTime: globalSelectedTime, maxTime, minTime } = useSelector<
@@ -19,7 +26,7 @@ function TableView(): JSX.Element {
GlobalReducer
>((state) => state.globalTime);
- const { data, isLoading } = useGetQueryRange(
+ const { data, isLoading, isError, error } = useGetQueryRange(
{
query: stagedQuery || initialQueriesMap.traces,
graphType: panelType || PANEL_TYPES.TABLE,
@@ -51,14 +58,24 @@ function TableView(): JSX.Element {
[data],
);
+ useEffect(() => {
+ if (data?.payload) {
+ setWarning(data.warning);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data?.payload, data?.warning]);
+
return (
<Space.Compact block direction="vertical">
- <QueryTable
- query={stagedQuery || initialQueriesMap.traces}
- queryTableData={queryTableData as QueryDataV3[]}
- loading={isLoading}
- sticky
- />
+ {isError && error && <ErrorInPlace error={error as APIError} />}
+ {!isError && (
+ <QueryTable
+ query={stagedQuery || initialQueriesMap.traces}
+ queryTableData={queryTableData as QueryDataV3[]}
+ loading={isLoading}
+ sticky
+ />
+ )}
</Space.Compact>
);
}
diff --git a/frontend/src/container/TracesExplorer/TracesView/index.tsx b/frontend/src/container/TracesExplorer/TracesView/index.tsx
index e9d2328cad..73bbb0c497 100644
--- a/frontend/src/container/TracesExplorer/TracesView/index.tsx
+++ b/frontend/src/container/TracesExplorer/TracesView/index.tsx
@@ -1,5 +1,6 @@
import { Typography } from 'antd';
import logEvent from 'api/common/logEvent';
+import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import ListViewOrderBy from 'components/OrderBy/ListViewOrderBy';
import { ResizeTable } from 'components/ResizeTable';
import { ENTITY_VERSION_V5 } from 'constants/app';
@@ -13,9 +14,19 @@ import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { Pagination } from 'hooks/queryPagination';
import useUrlQueryData from 'hooks/useUrlQueryData';
import { ArrowUp10, Minus } from 'lucide-react';
-import { memo, useCallback, useEffect, useMemo, useState } from 'react';
+import {
+ Dispatch,
+ memo,
+ SetStateAction,
+ useCallback,
+ useEffect,
+ useMemo,
+ useState,
+} from 'react';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
+import { Warning } from 'types/api';
+import APIError from 'types/api/error';
import { DataSource } from 'types/common/queryBuilder';
import { GlobalReducer } from 'types/reducer/globalTime';
import DOCLINKS from 'utils/docLinks';
@@ -28,9 +39,13 @@ import { ActionsContainer, Container } from './styles';
interface TracesViewProps {
isFilterApplied: boolean;
+ setWarning: Dispatch<SetStateAction<Warning | undefined>>;
}
-function TracesView({ isFilterApplied }: TracesViewProps): JSX.Element {
+function TracesView({
+ isFilterApplied,
+ setWarning,
+}: TracesViewProps): JSX.Element {
const { stagedQuery, panelType } = useQueryBuilder();
const [orderBy, setOrderBy] = useState<string>('timestamp:desc');
@@ -60,7 +75,7 @@ function TracesView({ isFilterApplied }: TracesViewProps): JSX.Element {
setOrderBy(value);
}, []);
- const { data, isLoading, isFetching, isError } = useGetQueryRange(
+ const { data, isLoading, isFetching, isError, error } = useGetQueryRange(
{
query: transformedQuery,
graphType: panelType || PANEL_TYPES.TRACE,
@@ -89,6 +104,13 @@ function TracesView({ isFilterApplied }: TracesViewProps): JSX.Element {
},
);
+ useEffect(() => {
+ if (data?.payload) {
+ setWarning(data?.warning);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data?.payload, data?.warning]);
+
const responseData = data?.payload?.data?.newResult?.data?.result[0]?.list;
const tableData = useMemo(
() => responseData?.map((listItem) => listItem.data),
@@ -137,6 +159,8 @@ function TracesView({ isFilterApplied }: TracesViewProps): JSX.Element {
</ActionsContainer>
)}
+ {isError && error && <ErrorInPlace error={error as APIError} />}
+
{(isLoading || (isFetching && (tableData || []).length === 0)) && (
<TracesLoading />
)}
diff --git a/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts b/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts
index b7d6f49443..24e28a9bf4 100644
--- a/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts
+++ b/frontend/src/hooks/queryBuilder/useGetExplorerQueryRange.ts
@@ -6,7 +6,7 @@ import { MutableRefObject, useMemo } from 'react';
import { UseQueryOptions, UseQueryResult } from 'react-query';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { GlobalReducer } from 'types/reducer/globalTime';
@@ -24,7 +24,10 @@ export const useGetExplorerQueryRange = (
keyRef?: MutableRefObject<any>,
headers?: Record<string, string>,
selectedTimeInterval?: GetQueryResultsProps['globalSelectedInterval'],
-): UseQueryResult<SuccessResponse<MetricRangePayloadProps>, Error> => {
+): UseQueryResult<
+ SuccessResponse<MetricRangePayloadProps> & { warning?: Warning },
+ Error
+> => {
const { isEnabledQuery } = useQueryBuilder();
const { selectedTime: globalSelectedInterval, minTime, maxTime } = useSelector<
AppState,
diff --git a/frontend/src/hooks/queryBuilder/useGetQueryRange.ts b/frontend/src/hooks/queryBuilder/useGetQueryRange.ts
index 39c25b9a85..6dc41bcc47 100644
--- a/frontend/src/hooks/queryBuilder/useGetQueryRange.ts
+++ b/frontend/src/hooks/queryBuilder/useGetQueryRange.ts
@@ -7,27 +7,27 @@ import {
GetQueryResultsProps,
} from 'lib/dashboard/getQueryResults';
import getStartEndRangeTime from 'lib/getStartEndRangeTime';
-import { useErrorModal } from 'providers/ErrorModalProvider';
import { useMemo } from 'react';
import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, Warning } from 'types/api';
import APIError from 'types/api/error';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import { DataSource } from 'types/common/queryBuilder';
type UseGetQueryRangeOptions = UseQueryOptions<
- SuccessResponse<MetricRangePayloadProps>,
+ SuccessResponse<MetricRangePayloadProps> & { warning?: Warning },
APIError | Error
-> & {
- showErrorModal?: boolean;
-};
+>;
type UseGetQueryRange = (
requestData: GetQueryResultsProps,
version: string,
options?: UseGetQueryRangeOptions,
headers?: Record<string, string>,
-) => UseQueryResult<SuccessResponse<MetricRangePayloadProps>, Error>;
+) => UseQueryResult<
+ SuccessResponse<MetricRangePayloadProps> & { warning?: Warning },
+ Error
+>;
export const useGetQueryRange: UseGetQueryRange = (
requestData,
@@ -35,7 +35,6 @@ export const useGetQueryRange: UseGetQueryRange = (
options,
headers,
) => {
- const { showErrorModal: showErrorModalFn } = useErrorModal();
const newRequestData: GetQueryResultsProps = useMemo(() => {
const firstQueryData = requestData.query.builder?.queryData[0];
const isListWithSingleTimestampOrder =
@@ -134,17 +133,14 @@ export const useGetQueryRange: UseGetQueryRange = (
};
}, [options?.retry]);
- return useQuery<SuccessResponse<MetricRangePayloadProps>, APIError | Error>({
+ return useQuery<
+ SuccessResponse<MetricRangePayloadProps> & { warning?: Warning },
+ APIError | Error
+ >({
queryFn: async ({ signal }) =>
GetMetricQueryRange(modifiedRequestData, version, signal, headers),
...options,
retry,
- onError: (error) => {
- if (options?.showErrorModal !== false) {
- showErrorModalFn(error as APIError);
- }
- options?.onError?.(error);
- },
queryKey,
});
};
diff --git a/frontend/src/lib/dashboard/getQueryResults.ts b/frontend/src/lib/dashboard/getQueryResults.ts
index e8b9ded5d7..664d9d958e 100644
--- a/frontend/src/lib/dashboard/getQueryResults.ts
+++ b/frontend/src/lib/dashboard/getQueryResults.ts
@@ -19,7 +19,7 @@ import {
import { Pagination } from 'hooks/queryPagination';
import { convertNewDataToOld } from 'lib/newQueryBuilder/convertNewDataToOld';
import { isEmpty } from 'lodash-es';
-import { SuccessResponse } from 'types/api';
+import { SuccessResponse, SuccessResponseV2, Warning } from 'types/api';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
@@ -114,11 +114,13 @@ export async function GetMetricQueryRange(
signal?: AbortSignal,
headers?: Record<string, string>,
isInfraMonitoring?: boolean,
-): Promise<SuccessResponse<MetricRangePayloadProps>> {
+): Promise<SuccessResponse<MetricRangePayloadProps> & { warning?: Warning }> {
let legendMap: Record<string, string>;
let response:
| SuccessResponse<MetricRangePayloadProps>
- | SuccessResponseV2<MetricRangePayloadV5>;
+ | SuccessResponseV2<MetricRangePayloadV5>
+ | (SuccessResponse<MetricRangePayloadProps> & { warning?: Warning });
+ let warning: Warning | undefined;
const panelType = props.originalGraphType || props.graphType;
@@ -146,6 +148,7 @@ export async function GetMetricQueryRange(
},
},
},
+ warning: undefined,
},
params: props,
};
@@ -173,6 +176,7 @@ export async function GetMetricQueryRange(
},
},
},
+ warning: undefined,
params: props,
};
}
@@ -193,6 +197,8 @@ export async function GetMetricQueryRange(
legendMap,
finalFormatForWeb,
);
+
+ warning = response.payload.warning || undefined;
} else {
const legacyResult = prepareQueryRangePayload(props);
legendMap = legacyResult.legendMap;
@@ -255,7 +261,10 @@ export async function GetMetricQueryRange(
);
}
- return response;
+ return {
+ ...response,
+ warning,
+ };
}
export interface GetQueryResultsProps {
diff --git a/frontend/src/pages/LogsExplorer/index.tsx b/frontend/src/pages/LogsExplorer/index.tsx
index 7c1ce541e4..9c6d82e26f 100644
--- a/frontend/src/pages/LogsExplorer/index.tsx
+++ b/frontend/src/pages/LogsExplorer/index.tsx
@@ -8,6 +8,7 @@ import cx from 'classnames';
import ExplorerCard from 'components/ExplorerCard/ExplorerCard';
import QuickFilters from 'components/QuickFilters/QuickFilters';
import { QuickFiltersSource, SignalType } from 'components/QuickFilters/types';
+import WarningPopover from 'components/WarningPopover/WarningPopover';
import { LOCALSTORAGE } from 'constants/localStorage';
import { QueryParams } from 'constants/query';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
@@ -32,6 +33,7 @@ import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFall
import { usePreferenceContext } from 'providers/preferences/context/PreferenceContextProvider';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useSearchParams } from 'react-router-dom-v5-compat';
+import { Warning } from 'types/api';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
import {
@@ -95,6 +97,8 @@ function LogsExplorer(): JSX.Element {
const [isLoadingQueries, setIsLoadingQueries] = useState<boolean>(false);
+ const [warning, setWarning] = useState<Warning | undefined>(undefined);
+
const [shouldReset, setShouldReset] = useState(false);
const [defaultQuery, setDefaultQuery] = useState<Query>(() =>
@@ -356,6 +360,9 @@ function LogsExplorer(): JSX.Element {
onChangeSelectedView={handleChangeSelectedView}
/>
}
+ warningElement={
+ warning?.message ? <WarningPopover warningData={warning} /> : <div />
+ }
rightActions={
<RightToolbarActions
onStageRunQuery={(): void => handleRunQuery(true, true)}
@@ -378,6 +385,7 @@ function LogsExplorer(): JSX.Element {
listQueryKeyRef={listQueryKeyRef}
chartQueryKeyRef={chartQueryKeyRef}
setIsLoadingQueries={setIsLoadingQueries}
+ setWarning={setWarning}
/>
</div>
</div>
diff --git a/frontend/src/pages/TracesExplorer/index.tsx b/frontend/src/pages/TracesExplorer/index.tsx
index c802914663..82d156a3e1 100644
--- a/frontend/src/pages/TracesExplorer/index.tsx
+++ b/frontend/src/pages/TracesExplorer/index.tsx
@@ -7,6 +7,7 @@ import cx from 'classnames';
import ExplorerCard from 'components/ExplorerCard/ExplorerCard';
import QuickFilters from 'components/QuickFilters/QuickFilters';
import { QuickFiltersSource, SignalType } from 'components/QuickFilters/types';
+import WarningPopover from 'components/WarningPopover/WarningPopover';
import { LOCALSTORAGE } from 'constants/localStorage';
import { AVAILABLE_EXPORT_PANEL_TYPES } from 'constants/panelTypes';
import { QueryParams } from 'constants/query';
@@ -33,6 +34,7 @@ import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFall
import { ExplorerViews } from 'pages/LogsExplorer/utils';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useSearchParams } from 'react-router-dom-v5-compat';
+import { Warning } from 'types/api';
import { Dashboard } from 'types/api/dashboard/getAll';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
@@ -283,6 +285,8 @@ function TracesExplorer(): JSX.Element {
listQuery,
]);
+ const [warning, setWarning] = useState<Warning | undefined>(undefined);
+
return (
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
<div className="trace-explorer-page">
@@ -313,6 +317,9 @@ function TracesExplorer(): JSX.Element {
onChangeSelectedView={handleChangeSelectedView}
/>
}
+ warningElement={
+ warning?.message ? <WarningPopover warningData={warning} /> : <div />
+ }
rightActions={
<RightToolbarActions
onStageRunQuery={(): void => handleRunQuery(true, true)}
@@ -337,13 +344,13 @@ function TracesExplorer(): JSX.Element {
{selectedView === ExplorerViews.LIST && (
<div className="trace-explorer-list-view">
- <ListView isFilterApplied={isFilterApplied} />
+ <ListView isFilterApplied={isFilterApplied} setWarning={setWarning} />
</div>
)}
{selectedView === ExplorerViews.TRACE && (
<div className="trace-explorer-traces-view">
- <TracesView isFilterApplied={isFilterApplied} />
+ <TracesView isFilterApplied={isFilterApplied} setWarning={setWarning} />
</div>
)}
@@ -352,13 +359,14 @@ function TracesExplorer(): JSX.Element {
<TimeSeriesView
dataSource={DataSource.TRACES}
isFilterApplied={isFilterApplied}
+ setWarning={setWarning}
/>
</div>
)}
{selectedView === ExplorerViews.TABLE && (
<div className="trace-explorer-table-view">
- <TableView />
+ <TableView setWarning={setWarning} />
</div>
)}
</div>
diff --git a/frontend/src/pages/TracesExplorer/utils.tsx b/frontend/src/pages/TracesExplorer/utils.tsx
deleted file mode 100644
index 3e0566f415..0000000000
--- a/frontend/src/pages/TracesExplorer/utils.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { TabsProps } from 'antd';
-import TabLabel from 'components/TabLabel';
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import TimeSeriesView from 'container/TimeSeriesView';
-import ListView from 'container/TracesExplorer/ListView';
-import TableView from 'container/TracesExplorer/TableView';
-import TracesView from 'container/TracesExplorer/TracesView';
-import { DataSource } from 'types/common/queryBuilder';
-
-interface GetTabsItemsProps {
- isListViewDisabled: boolean;
- isFilterApplied: boolean;
-}
-
-export const getTabsItems = ({
- isListViewDisabled,
- isFilterApplied,
-}: GetTabsItemsProps): TabsProps['items'] => [
- {
- label: (
- <TabLabel
- label="List View"
- isDisabled={isListViewDisabled}
- tooltipText="Please remove attributes from Group By filter to switch to List View tab"
- />
- ),
- key: PANEL_TYPES.LIST,
- children: <ListView isFilterApplied={isFilterApplied} />,
- disabled: isListViewDisabled,
- },
- {
- label: (
- <TabLabel
- label="Traces"
- isDisabled={isListViewDisabled}
- tooltipText="Please remove attributes from Group By filter to switch to Traces tab"
- />
- ),
- key: PANEL_TYPES.TRACE,
- children: <TracesView isFilterApplied={isFilterApplied} />,
- disabled: isListViewDisabled,
- },
- {
- label: <TabLabel label="Time Series" isDisabled={false} />,
- key: PANEL_TYPES.TIME_SERIES,
- children: (
- <TimeSeriesView
- dataSource={DataSource.TRACES}
- isFilterApplied={isFilterApplied}
- />
- ),
- },
- {
- label: 'Table View',
- key: PANEL_TYPES.TABLE,
- children: <TableView />,
- },
-];
diff --git a/frontend/src/types/api/index.ts b/frontend/src/types/api/index.ts
index 609fea3eaf..04a10444ff 100644
--- a/frontend/src/types/api/index.ts
+++ b/frontend/src/types/api/index.ts
@@ -44,3 +44,14 @@ export interface SuccessResponseV2<T> {
httpStatusCode: StatusCodes;
data: T;
}
+
+export interface AdditionalWarnings {
+ message: string;
+}
+
+export interface Warning {
+ code: string;
+ message: string;
+ url: string;
+ warnings: AdditionalWarnings[];
+}
diff --git a/frontend/src/types/api/metrics/getQueryRange.ts b/frontend/src/types/api/metrics/getQueryRange.ts
index 47c8fcba4a..cc617da5b7 100644
--- a/frontend/src/types/api/metrics/getQueryRange.ts
+++ b/frontend/src/types/api/metrics/getQueryRange.ts
@@ -1,6 +1,7 @@
import { PANEL_TYPES } from 'constants/queryBuilder';
import { EQueryType } from 'types/common/dashboard';
+import { Warning } from '..';
import {
IBuilderFormula,
IBuilderQuery,
@@ -40,4 +41,5 @@ export interface MetricRangePayloadV3 {
result: QueryDataV3[];
resultType: string;
};
+ warning?: Warning;
}
diff --git a/frontend/src/types/api/v5/queryRange.ts b/frontend/src/types/api/v5/queryRange.ts
index 958a9351ed..ea23cf415f 100644
--- a/frontend/src/types/api/v5/queryRange.ts
+++ b/frontend/src/types/api/v5/queryRange.ts
@@ -1,5 +1,7 @@
// ===================== Base Types =====================
+import { Warning } from '..';
+
export type Step = string | number; // Duration string (e.g., "30s") or seconds as number
export type RequestType =
@@ -418,6 +420,7 @@ export interface QueryRangeResponseV5 {
type: RequestType;
data: QueryRangeDataV5;
meta: ExecStats;
+ warning?: Warning;
}
// ===================== Payload Types for API Functions =====================