SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: improve metrics explorer empty state (#8711)
Amlan Kumar Nandy2901e052ae3d
diff --git a/frontend/src/container/MetricsExplorer/Summary/Summary.tsx b/frontend/src/container/MetricsExplorer/Summary/Summary.tsxindex a7db508552..c41dcc7202 100644--- a/frontend/src/container/MetricsExplorer/Summary/Summary.tsx+++ b/frontend/src/container/MetricsExplorer/Summary/Summary.tsx@@ -1,9 +1,11 @@+/* eslint-disable no-nested-ternary */import './Summary.styles.scss';import * as Sentry from '@sentry/react';import logEvent from 'api/common/logEvent';import { initialQueriesMap } from 'constants/queryBuilder';import { usePageSize } from 'container/InfraMonitoringK8s/utils';+import NoLogs from 'container/NoLogs/NoLogs';import { useGetMetricsList } from 'hooks/metricsExplorer/useGetMetricsList';import { useGetMetricsTreeMap } from 'hooks/metricsExplorer/useGetMetricsTreeMap';import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';@@ -12,11 +14,13 @@ import { useSelector } from 'react-redux';import { useSearchParams } from 'react-router-dom-v5-compat';import { AppState } from 'store/reducers';import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';+import { DataSource } from 'types/common/queryBuilder';import { GlobalReducer } from 'types/reducer/globalTime';import { MetricsExplorerEventKeys, MetricsExplorerEvents } from '../events';import InspectModal from '../Inspect';import MetricDetails from '../MetricDetails';+import { MetricsLoading } from '../MetricsLoading/MetricsLoading';import {IS_INSPECT_MODAL_OPEN_KEY,IS_METRIC_DETAILS_OPEN_KEY,@@ -267,30 +271,64 @@ function Summary(): JSX.Element {});};+ const isMetricsListDataEmpty = useMemo(+ () =>+ formattedMetricsData.length === 0 && !isMetricsLoading && !isMetricsFetching,+ [formattedMetricsData, isMetricsLoading, isMetricsFetching],+ );++ const isMetricsTreeMapDataEmpty = useMemo(+ () =>+ !treeMapData?.payload?.data[heatmapView]?.length &&+ !isTreeMapLoading &&+ !isTreeMapFetching,+ [+ treeMapData?.payload?.data,+ heatmapView,+ isTreeMapLoading,+ isTreeMapFetching,+ ],+ );++ console.log({+ isMetricsListDataEmpty,+ isMetricsTreeMapDataEmpty,+ treeMapData,+ sec: treeMapData?.payload?.data[heatmapView],+ });+return (<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}><div className="metrics-explorer-summary-tab"><MetricsSearch query={searchQuery} onChange={handleFilterChange} />- <MetricsTreemap- data={treeMapData?.payload}- isLoading={isTreeMapLoading || isTreeMapFetching}- isError={isProportionViewError}- viewType={heatmapView}- openMetricDetails={openMetricDetails}- setHeatmapView={handleSetHeatmapView}- />- <MetricsTable- isLoading={isMetricsLoading || isMetricsFetching}- isError={isListViewError}- data={formattedMetricsData}- pageSize={pageSize}- currentPage={currentPage}- onPaginationChange={onPaginationChange}- setOrderBy={handleSetOrderBy}- totalCount={metricsData?.payload?.data?.total || 0}- openMetricDetails={openMetricDetails}- queryFilters={queryFilters}- />+ {isMetricsLoading || isTreeMapLoading ? (+ <MetricsLoading />+ ) : isMetricsListDataEmpty && isMetricsTreeMapDataEmpty ? (+ <NoLogs dataSource={DataSource.METRICS} />+ ) : (+ <>+ <MetricsTreemap+ data={treeMapData?.payload}+ isLoading={isTreeMapLoading || isTreeMapFetching}+ isError={isProportionViewError}+ viewType={heatmapView}+ openMetricDetails={openMetricDetails}+ setHeatmapView={handleSetHeatmapView}+ />+ <MetricsTable+ isLoading={isMetricsLoading || isMetricsFetching}+ isError={isListViewError}+ data={formattedMetricsData}+ pageSize={pageSize}+ currentPage={currentPage}+ onPaginationChange={onPaginationChange}+ setOrderBy={handleSetOrderBy}+ totalCount={metricsData?.payload?.data?.total || 0}+ openMetricDetails={openMetricDetails}+ queryFilters={queryFilters}+ />+ </>+ )}</div>{isMetricDetailsOpen && (<MetricDetailsdiff --git a/frontend/src/container/NoLogs/NoLogs.tsx b/frontend/src/container/NoLogs/NoLogs.tsxindex 09fd93f939..8ba612bc18 100644--- a/frontend/src/container/NoLogs/NoLogs.tsx+++ b/frontend/src/container/NoLogs/NoLogs.tsx@@ -27,14 +27,22 @@ export default function NoLogs({logEvent('Traces Explorer: Navigate to onboarding', {});} else if (dataSource === DataSource.LOGS) {logEvent('Logs Explorer: Navigate to onboarding', {});+ } else if (dataSource === DataSource.METRICS) {+ logEvent('Metrics Explorer: Navigate to onboarding', {});}- history.push(- dataSource === 'traces'- ? ROUTES.GET_STARTED_APPLICATION_MONITORING- : ROUTES.GET_STARTED_LOGS_MANAGEMENT,- );+ let link;+ if (dataSource === DataSource.TRACES) {+ link = ROUTES.GET_STARTED_APPLICATION_MONITORING;+ } else if (dataSource === DataSource.METRICS) {+ link = ROUTES.GET_STARTED_WITH_CLOUD;+ } else {+ link = ROUTES.GET_STARTED_LOGS_MANAGEMENT;+ }+ history.push(link);} else if (dataSource === 'traces') {window.open(DOCLINKS.TRACES_EXPLORER_EMPTY_STATE, '_blank');+ } else if (dataSource === DataSource.METRICS) {+ window.open(DOCLINKS.METRICS_EXPLORER_EMPTY_STATE, '_blank');} else {window.open(`${DOCLINKS.USER_GUIDE}${dataSource}/`, '_blank');}diff --git a/frontend/src/utils/docLinks.ts b/frontend/src/utils/docLinks.tsindex 0a4be20a00..71c3399f4f 100644--- a/frontend/src/utils/docLinks.ts+++ b/frontend/src/utils/docLinks.ts@@ -4,6 +4,8 @@ const DOCLINKS = {USER_GUIDE: 'https://signoz.io/docs/userguide/',TRACES_DETAILS_LINK:'https://signoz.io/docs/product-features/trace-explorer/?utm_source=product&utm_medium=traces-explorer-trace-tab#traces-view',+ METRICS_EXPLORER_EMPTY_STATE:+ 'https://signoz.io/docs/userguide/send-metrics-cloud/',};export default DOCLINKS;