Compare commits
12 Commits
help-suppo
...
v0.50.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09ea7b9eb5 | ||
|
|
d3b83f5a41 | ||
|
|
77eba9a558 | ||
|
|
43e73e06fe | ||
|
|
840d8b2e49 | ||
|
|
df751c7f38 | ||
|
|
cd07c743b6 | ||
|
|
46e6c34e51 | ||
|
|
42f7905b3b | ||
|
|
a6e68c6519 | ||
|
|
c7e3e6dc4e | ||
|
|
9194ab08b6 |
@@ -146,7 +146,7 @@ services:
|
|||||||
condition: on-failure
|
condition: on-failure
|
||||||
|
|
||||||
query-service:
|
query-service:
|
||||||
image: signoz/query-service:0.49.1
|
image: signoz/query-service:0.50.0
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
"-config=/root/config/prometheus.yml",
|
"-config=/root/config/prometheus.yml",
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ services:
|
|||||||
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
|
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
|
||||||
|
|
||||||
query-service:
|
query-service:
|
||||||
image: signoz/query-service:${DOCKER_TAG:-0.49.1}
|
image: signoz/query-service:${DOCKER_TAG:-0.50.0}
|
||||||
container_name: signoz-query-service
|
container_name: signoz-query-service
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
@@ -204,7 +204,7 @@ services:
|
|||||||
<<: *db-depend
|
<<: *db-depend
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: signoz/frontend:${DOCKER_TAG:-0.49.1}
|
image: signoz/frontend:${DOCKER_TAG:-0.50.0}
|
||||||
container_name: signoz-frontend
|
container_name: signoz-frontend
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ services:
|
|||||||
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
|
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
|
||||||
|
|
||||||
query-service:
|
query-service:
|
||||||
image: signoz/query-service:${DOCKER_TAG:-0.49.1}
|
image: signoz/query-service:${DOCKER_TAG:-0.50.0}
|
||||||
container_name: signoz-query-service
|
container_name: signoz-query-service
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
@@ -203,7 +203,7 @@ services:
|
|||||||
<<: *db-depend
|
<<: *db-depend
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: signoz/frontend:${DOCKER_TAG:-0.49.1}
|
image: signoz/frontend:${DOCKER_TAG:-0.50.0}
|
||||||
container_name: signoz-frontend
|
container_name: signoz-frontend
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -110,6 +110,8 @@
|
|||||||
"react-syntax-highlighter": "15.5.0",
|
"react-syntax-highlighter": "15.5.0",
|
||||||
"react-use": "^17.3.2",
|
"react-use": "^17.3.2",
|
||||||
"react-virtuoso": "4.0.3",
|
"react-virtuoso": "4.0.3",
|
||||||
|
"overlayscrollbars-react": "^0.5.6",
|
||||||
|
"overlayscrollbars": "^2.8.1",
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.5",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"rehype-raw": "7.0.0",
|
"rehype-raw": "7.0.0",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const apiV1 = '/api/v1/';
|
|||||||
export const apiV2 = '/api/v2/';
|
export const apiV2 = '/api/v2/';
|
||||||
export const apiV3 = '/api/v3/';
|
export const apiV3 = '/api/v3/';
|
||||||
export const apiV4 = '/api/v4/';
|
export const apiV4 = '/api/v4/';
|
||||||
export const gatewayApiV1 = '/api/gateway/v1';
|
export const gatewayApiV1 = '/api/gateway/v1/';
|
||||||
export const apiAlertManager = '/api/alertmanager';
|
export const apiAlertManager = '/api/alertmanager/';
|
||||||
|
|
||||||
export default apiV1;
|
export default apiV1;
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import TypicalOverlayScrollbar from 'components/TypicalOverlayScrollbar/TypicalOverlayScrollbar';
|
||||||
|
import VirtuosoOverlayScrollbar from 'components/VirtuosoOverlayScrollbar/VirtuosoOverlayScrollbar';
|
||||||
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
|
import { PartialOptions } from 'overlayscrollbars';
|
||||||
|
import { CSSProperties, ReactElement, useMemo } from 'react';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
children: ReactElement;
|
||||||
|
isVirtuoso?: boolean;
|
||||||
|
style?: CSSProperties;
|
||||||
|
options?: PartialOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
function OverlayScrollbar({
|
||||||
|
children,
|
||||||
|
isVirtuoso,
|
||||||
|
style,
|
||||||
|
options: customOptions,
|
||||||
|
}: Props): any {
|
||||||
|
const isDarkMode = useIsDarkMode();
|
||||||
|
const options = useMemo(
|
||||||
|
() =>
|
||||||
|
({
|
||||||
|
scrollbars: {
|
||||||
|
autoHide: 'scroll',
|
||||||
|
theme: isDarkMode ? 'os-theme-light' : 'os-theme-dark',
|
||||||
|
},
|
||||||
|
...(customOptions || {}),
|
||||||
|
} as PartialOptions),
|
||||||
|
[customOptions, isDarkMode],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isVirtuoso) {
|
||||||
|
return (
|
||||||
|
<VirtuosoOverlayScrollbar style={style} options={options}>
|
||||||
|
{children}
|
||||||
|
</VirtuosoOverlayScrollbar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TypicalOverlayScrollbar style={style} options={options}>
|
||||||
|
{children}
|
||||||
|
</TypicalOverlayScrollbar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlayScrollbar.defaultProps = {
|
||||||
|
isVirtuoso: false,
|
||||||
|
style: {},
|
||||||
|
options: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default OverlayScrollbar;
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import './typicalOverlayScrollbar.scss';
|
||||||
|
|
||||||
|
import { PartialOptions } from 'overlayscrollbars';
|
||||||
|
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
|
||||||
|
import { CSSProperties, ReactElement } from 'react';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
children: ReactElement;
|
||||||
|
style?: CSSProperties;
|
||||||
|
options?: PartialOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function TypicalOverlayScrollbar({
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
options,
|
||||||
|
}: Props): ReturnType<typeof OverlayScrollbarsComponent> {
|
||||||
|
return (
|
||||||
|
<OverlayScrollbarsComponent
|
||||||
|
defer
|
||||||
|
options={options}
|
||||||
|
style={style}
|
||||||
|
className="overlay-scrollbar"
|
||||||
|
data-overlayscrollbars-initialize
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</OverlayScrollbarsComponent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TypicalOverlayScrollbar.defaultProps = { style: {}, options: {} };
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.overlay-scrollbar {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import './virtuosoOverlayScrollbar.scss';
|
||||||
|
|
||||||
|
import useInitializeOverlayScrollbar from 'hooks/useInitializeOverlayScrollbar/useInitializeOverlayScrollbar';
|
||||||
|
import { PartialOptions } from 'overlayscrollbars';
|
||||||
|
import React, { CSSProperties, ReactElement } from 'react';
|
||||||
|
|
||||||
|
interface VirtuosoOverlayScrollbarProps {
|
||||||
|
children: ReactElement;
|
||||||
|
style?: CSSProperties;
|
||||||
|
options: PartialOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function VirtuosoOverlayScrollbar({
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
options,
|
||||||
|
}: VirtuosoOverlayScrollbarProps): JSX.Element {
|
||||||
|
const { rootRef, setScroller } = useInitializeOverlayScrollbar(options);
|
||||||
|
|
||||||
|
const enhancedChild = React.cloneElement(children, {
|
||||||
|
scrollerRef: setScroller,
|
||||||
|
'data-overlayscrollbars-initialize': true,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-overlayscrollbars-initialize
|
||||||
|
ref={rootRef}
|
||||||
|
className="overlay-scroll-wrapper"
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
|
{enhancedChild}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
VirtuosoOverlayScrollbar.defaultProps = { style: {} };
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
.overlay-scroll-wrapper {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import { ColumnType, TablePaginationConfig } from 'antd/es/table';
|
|||||||
import { FilterValue, SorterResult } from 'antd/es/table/interface';
|
import { FilterValue, SorterResult } from 'antd/es/table/interface';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { FilterConfirmProps } from 'antd/lib/table/interface';
|
import { FilterConfirmProps } from 'antd/lib/table/interface';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import getAll from 'api/errors/getAll';
|
import getAll from 'api/errors/getAll';
|
||||||
import getErrorCounts from 'api/errors/getErrorCounts';
|
import getErrorCounts from 'api/errors/getErrorCounts';
|
||||||
import { ResizeTable } from 'components/ResizeTable';
|
import { ResizeTable } from 'components/ResizeTable';
|
||||||
@@ -23,7 +24,8 @@ import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute
|
|||||||
import useUrlQuery from 'hooks/useUrlQuery';
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import createQueryParams from 'lib/createQueryParams';
|
import createQueryParams from 'lib/createQueryParams';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { useCallback, useEffect, useMemo } from 'react';
|
import { isUndefined } from 'lodash-es';
|
||||||
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useQueries } from 'react-query';
|
import { useQueries } from 'react-query';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
@@ -410,6 +412,26 @@ function AllErrors(): JSX.Element {
|
|||||||
[pathname],
|
[pathname],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
!logEventCalledRef.current &&
|
||||||
|
!isUndefined(errorCountResponse.data?.payload)
|
||||||
|
) {
|
||||||
|
const selectedEnvironments = queries.find(
|
||||||
|
(val) => val.tagKey === 'resource_deployment_environment',
|
||||||
|
)?.tagValue;
|
||||||
|
|
||||||
|
logEvent('Exception: List page visited', {
|
||||||
|
numberOfExceptions: errorCountResponse.data?.payload,
|
||||||
|
selectedEnvironments,
|
||||||
|
resourceAttributeUsed: !!queries.length,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [errorCountResponse.data?.payload]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResizeTable
|
<ResizeTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
.app-content {
|
.app-content {
|
||||||
width: calc(100% - 64px);
|
width: calc(100% - 64px);
|
||||||
overflow: auto;
|
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
|
|
||||||
.content-container {
|
.content-container {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import getLocalStorageKey from 'api/browser/localstorage/get';
|
|||||||
import getUserLatestVersion from 'api/user/getLatestVersion';
|
import getUserLatestVersion from 'api/user/getLatestVersion';
|
||||||
import getUserVersion from 'api/user/getVersion';
|
import getUserVersion from 'api/user/getVersion';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { IS_SIDEBAR_COLLAPSED } from 'constants/app';
|
import { IS_SIDEBAR_COLLAPSED } from 'constants/app';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import SideNav from 'container/SideNav';
|
import SideNav from 'container/SideNav';
|
||||||
@@ -303,24 +304,29 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
|
|||||||
collapsed={collapsed}
|
collapsed={collapsed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className={cx('app-content', collapsed ? 'collapsed' : '')}>
|
<div
|
||||||
|
className={cx('app-content', collapsed ? 'collapsed' : '')}
|
||||||
|
data-overlayscrollbars-initialize
|
||||||
|
>
|
||||||
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
|
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
|
||||||
<LayoutContent>
|
<LayoutContent data-overlayscrollbars-initialize>
|
||||||
<ChildrenContainer
|
<OverlayScrollbar>
|
||||||
style={{
|
<ChildrenContainer
|
||||||
margin:
|
style={{
|
||||||
isLogsView() ||
|
margin:
|
||||||
isTracesView() ||
|
isLogsView() ||
|
||||||
isDashboardView() ||
|
isTracesView() ||
|
||||||
isDashboardWidgetView() ||
|
isDashboardView() ||
|
||||||
isDashboardListView()
|
isDashboardWidgetView() ||
|
||||||
? 0
|
isDashboardListView()
|
||||||
: '0 1rem',
|
? 0
|
||||||
}}
|
: '0 1rem',
|
||||||
>
|
}}
|
||||||
{isToDisplayLayout && !renderFullScreen && <TopNav />}
|
>
|
||||||
{children}
|
{isToDisplayLayout && !renderFullScreen && <TopNav />}
|
||||||
</ChildrenContainer>
|
{children}
|
||||||
|
</ChildrenContainer>
|
||||||
|
</OverlayScrollbar>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
</Sentry.ErrorBoundary>
|
</Sentry.ErrorBoundary>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export const Layout = styled(LayoutComponent)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const LayoutContent = styled(LayoutComponent.Content)`
|
export const LayoutContent = styled(LayoutComponent.Content)`
|
||||||
overflow-y: auto;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 0.1rem;
|
width: 0.1rem;
|
||||||
|
|||||||
@@ -1,8 +1,34 @@
|
|||||||
import './EmptyLogsSearch.styles.scss';
|
import './EmptyLogsSearch.styles.scss';
|
||||||
|
|
||||||
import { Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { DataSource, PanelTypeKeys } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
|
export default function EmptyLogsSearch({
|
||||||
|
dataSource,
|
||||||
|
panelType,
|
||||||
|
}: {
|
||||||
|
dataSource: DataSource;
|
||||||
|
panelType: PanelTypeKeys;
|
||||||
|
}): JSX.Element {
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current) {
|
||||||
|
if (dataSource === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: No results', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
} else if (dataSource === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: No results', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
export default function EmptyLogsSearch(): JSX.Element {
|
|
||||||
return (
|
return (
|
||||||
<div className="empty-logs-search-container">
|
<div className="empty-logs-search-container">
|
||||||
<div className="empty-logs-search-container-content">
|
<div className="empty-logs-search-container-content">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import './styles.scss';
|
import './styles.scss';
|
||||||
|
|
||||||
import { Button, Divider, Space, Typography } from 'antd';
|
import { Button, Divider, Space, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import getNextPrevId from 'api/errors/getNextPrevId';
|
import getNextPrevId from 'api/errors/getNextPrevId';
|
||||||
import Editor from 'components/Editor';
|
import Editor from 'components/Editor';
|
||||||
import { ResizeTable } from 'components/ResizeTable';
|
import { ResizeTable } from 'components/ResizeTable';
|
||||||
@@ -9,8 +10,9 @@ import dayjs from 'dayjs';
|
|||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import createQueryParams from 'lib/createQueryParams';
|
import createQueryParams from 'lib/createQueryParams';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
|
import { isUndefined } from 'lodash-es';
|
||||||
import { urlKey } from 'pages/ErrorDetails/utils';
|
import { urlKey } from 'pages/ErrorDetails/utils';
|
||||||
import { useMemo, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
@@ -111,9 +113,29 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const onClickTraceHandler = (): void => {
|
const onClickTraceHandler = (): void => {
|
||||||
|
logEvent('Exception: Navigate to trace detail page', {
|
||||||
|
groupId: errorDetail.groupID,
|
||||||
|
spanId: errorDetail.spanID,
|
||||||
|
traceId: errorDetail.traceID,
|
||||||
|
exceptionId: errorDetail.errorId,
|
||||||
|
});
|
||||||
history.push(`/trace/${errorDetail.traceID}?spanId=${errorDetail.spanID}`);
|
history.push(`/trace/${errorDetail.traceID}?spanId=${errorDetail.spanID}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current && !isUndefined(data)) {
|
||||||
|
logEvent('Exception: Detail page visited', {
|
||||||
|
groupId: errorDetail.groupID,
|
||||||
|
spanId: errorDetail.spanID,
|
||||||
|
traceId: errorDetail.traceID,
|
||||||
|
exceptionId: errorDetail.errorId,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Typography>{errorDetail.exceptionType}</Typography>
|
<Typography>{errorDetail.exceptionType}</Typography>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { getViewDetailsUsingViewKey } from 'components/ExplorerCard/utils';
|
import { getViewDetailsUsingViewKey } from 'components/ExplorerCard/utils';
|
||||||
@@ -93,7 +94,23 @@ function ExplorerOptions({
|
|||||||
setIsExport(value);
|
setIsExport(value);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const {
|
||||||
|
currentQuery,
|
||||||
|
panelType,
|
||||||
|
isStagedQueryUpdated,
|
||||||
|
redirectWithQueryBuilderData,
|
||||||
|
} = useQueryBuilder();
|
||||||
|
|
||||||
const handleSaveViewModalToggle = (): void => {
|
const handleSaveViewModalToggle = (): void => {
|
||||||
|
if (sourcepage === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: Save view clicked', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
} else if (sourcepage === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: Save view clicked', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
}
|
||||||
setIsSaveModalOpen(!isSaveModalOpen);
|
setIsSaveModalOpen(!isSaveModalOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,11 +121,21 @@ function ExplorerOptions({
|
|||||||
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
|
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
|
||||||
|
|
||||||
const onCreateAlertsHandler = useCallback(() => {
|
const onCreateAlertsHandler = useCallback(() => {
|
||||||
|
if (sourcepage === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: Create alert', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
} else if (sourcepage === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: Create alert', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
}
|
||||||
history.push(
|
history.push(
|
||||||
`${ROUTES.ALERTS_NEW}?${QueryParams.compositeQuery}=${encodeURIComponent(
|
`${ROUTES.ALERTS_NEW}?${QueryParams.compositeQuery}=${encodeURIComponent(
|
||||||
JSON.stringify(query),
|
JSON.stringify(query),
|
||||||
)}`,
|
)}`,
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [history, query]);
|
}, [history, query]);
|
||||||
|
|
||||||
const onCancel = (value: boolean) => (): void => {
|
const onCancel = (value: boolean) => (): void => {
|
||||||
@@ -116,6 +143,15 @@ function ExplorerOptions({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onAddToDashboard = (): void => {
|
const onAddToDashboard = (): void => {
|
||||||
|
if (sourcepage === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: Add to dashboard clicked', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
} else if (sourcepage === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: Add to dashboard clicked', {
|
||||||
|
panelType,
|
||||||
|
});
|
||||||
|
}
|
||||||
setIsExport(true);
|
setIsExport(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -127,13 +163,6 @@ function ExplorerOptions({
|
|||||||
refetch: refetchAllView,
|
refetch: refetchAllView,
|
||||||
} = useGetAllViews(sourcepage);
|
} = useGetAllViews(sourcepage);
|
||||||
|
|
||||||
const {
|
|
||||||
currentQuery,
|
|
||||||
panelType,
|
|
||||||
isStagedQueryUpdated,
|
|
||||||
redirectWithQueryBuilderData,
|
|
||||||
} = useQueryBuilder();
|
|
||||||
|
|
||||||
const compositeQuery = mapCompositeQueryFromQuery(currentQuery, panelType);
|
const compositeQuery = mapCompositeQueryFromQuery(currentQuery, panelType);
|
||||||
|
|
||||||
const viewName = useGetSearchQueryParam(QueryParams.viewName) || '';
|
const viewName = useGetSearchQueryParam(QueryParams.viewName) || '';
|
||||||
@@ -224,6 +253,17 @@ function ExplorerOptions({
|
|||||||
onMenuItemSelectHandler({
|
onMenuItemSelectHandler({
|
||||||
key: option.key,
|
key: option.key,
|
||||||
});
|
});
|
||||||
|
if (sourcepage === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: Select view', {
|
||||||
|
panelType,
|
||||||
|
viewName: option.value,
|
||||||
|
});
|
||||||
|
} else if (sourcepage === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: Select view', {
|
||||||
|
panelType,
|
||||||
|
viewName: option.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
if (ref.current) {
|
if (ref.current) {
|
||||||
ref.current.blur();
|
ref.current.blur();
|
||||||
}
|
}
|
||||||
@@ -259,6 +299,17 @@ function ExplorerOptions({
|
|||||||
viewName: newViewName,
|
viewName: newViewName,
|
||||||
setNewViewName,
|
setNewViewName,
|
||||||
});
|
});
|
||||||
|
if (sourcepage === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: Save view successful', {
|
||||||
|
panelType,
|
||||||
|
viewName: newViewName,
|
||||||
|
});
|
||||||
|
} else if (sourcepage === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: Save view successful', {
|
||||||
|
panelType,
|
||||||
|
viewName: newViewName,
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Remove this and move this to scss file
|
// TODO: Remove this and move this to scss file
|
||||||
@@ -499,7 +550,7 @@ function ExplorerOptions({
|
|||||||
|
|
||||||
export interface ExplorerOptionsProps {
|
export interface ExplorerOptionsProps {
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
onExport: (dashboard: Dashboard | null) => void;
|
onExport: (dashboard: Dashboard | null, isNewDashboard?: boolean) => void;
|
||||||
query: Query | null;
|
query: Query | null;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
sourcepage: DataSource;
|
sourcepage: DataSource;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function ExportPanelContainer({
|
|||||||
} = useMutation(createDashboard, {
|
} = useMutation(createDashboard, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
if (data.payload) {
|
if (data.payload) {
|
||||||
onExport(data?.payload);
|
onExport(data?.payload, true);
|
||||||
}
|
}
|
||||||
refetch();
|
refetch();
|
||||||
},
|
},
|
||||||
@@ -55,7 +55,7 @@ function ExportPanelContainer({
|
|||||||
({ uuid }) => uuid === selectedDashboardId,
|
({ uuid }) => uuid === selectedDashboardId,
|
||||||
);
|
);
|
||||||
|
|
||||||
onExport(currentSelectedDashboard || null);
|
onExport(currentSelectedDashboard || null, false);
|
||||||
}, [data, selectedDashboardId, onExport]);
|
}, [data, selectedDashboardId, onExport]);
|
||||||
|
|
||||||
const handleSelect = useCallback(
|
const handleSelect = useCallback(
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function ExportPanel({
|
|||||||
|
|
||||||
export interface ExportPanelProps {
|
export interface ExportPanelProps {
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
onExport: (dashboard: Dashboard | null) => void;
|
onExport: (dashboard: Dashboard | null, isNewDashboard?: boolean) => void;
|
||||||
query: Query | null;
|
query: Query | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export interface ChartPreviewProps {
|
|||||||
userQueryKey?: string;
|
userQueryKey?: string;
|
||||||
allowSelectedIntervalForStepGen?: boolean;
|
allowSelectedIntervalForStepGen?: boolean;
|
||||||
yAxisUnit: string;
|
yAxisUnit: string;
|
||||||
|
setQueryStatus?: (status: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
@@ -62,6 +63,7 @@ function ChartPreview({
|
|||||||
allowSelectedIntervalForStepGen = false,
|
allowSelectedIntervalForStepGen = false,
|
||||||
alertDef,
|
alertDef,
|
||||||
yAxisUnit,
|
yAxisUnit,
|
||||||
|
setQueryStatus,
|
||||||
}: ChartPreviewProps): JSX.Element | null {
|
}: ChartPreviewProps): JSX.Element | null {
|
||||||
const { t } = useTranslation('alerts');
|
const { t } = useTranslation('alerts');
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -149,10 +151,10 @@ function ChartPreview({
|
|||||||
|
|
||||||
useEffect((): void => {
|
useEffect((): void => {
|
||||||
const { startTime, endTime } = getTimeRange(queryResponse);
|
const { startTime, endTime } = getTimeRange(queryResponse);
|
||||||
|
if (setQueryStatus) setQueryStatus(queryResponse.status);
|
||||||
setMinTimeScale(startTime);
|
setMinTimeScale(startTime);
|
||||||
setMaxTimeScale(endTime);
|
setMaxTimeScale(endTime);
|
||||||
}, [maxTime, minTime, globalSelectedInterval, queryResponse]);
|
}, [maxTime, minTime, globalSelectedInterval, queryResponse, setQueryStatus]);
|
||||||
|
|
||||||
if (queryResponse.data && graphType === PANEL_TYPES.BAR) {
|
if (queryResponse.data && graphType === PANEL_TYPES.BAR) {
|
||||||
const sortedSeriesData = getSortedSeriesData(
|
const sortedSeriesData = getSortedSeriesData(
|
||||||
@@ -284,6 +286,7 @@ ChartPreview.defaultProps = {
|
|||||||
userQueryKey: '',
|
userQueryKey: '',
|
||||||
allowSelectedIntervalForStepGen: false,
|
allowSelectedIntervalForStepGen: false,
|
||||||
alertDef: undefined,
|
alertDef: undefined,
|
||||||
|
setQueryStatus: (): void => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChartPreview;
|
export default ChartPreview;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ function FormAlertRules({
|
|||||||
const isNewRule = ruleId === 0;
|
const isNewRule = ruleId === 0;
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [queryStatus, setQueryStatus] = useState<string>('');
|
||||||
|
|
||||||
// alertDef holds the form values to be posted
|
// alertDef holds the form values to be posted
|
||||||
const [alertDef, setAlertDef] = useState<AlertDef>(initialValue);
|
const [alertDef, setAlertDef] = useState<AlertDef>(initialValue);
|
||||||
@@ -523,6 +524,7 @@ function FormAlertRules({
|
|||||||
alertDef={alertDef}
|
alertDef={alertDef}
|
||||||
yAxisUnit={yAxisUnit || ''}
|
yAxisUnit={yAxisUnit || ''}
|
||||||
graphType={panelType || PANEL_TYPES.TIME_SERIES}
|
graphType={panelType || PANEL_TYPES.TIME_SERIES}
|
||||||
|
setQueryStatus={setQueryStatus}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -540,6 +542,7 @@ function FormAlertRules({
|
|||||||
selectedInterval={globalSelectedInterval}
|
selectedInterval={globalSelectedInterval}
|
||||||
yAxisUnit={yAxisUnit || ''}
|
yAxisUnit={yAxisUnit || ''}
|
||||||
graphType={panelType || PANEL_TYPES.TIME_SERIES}
|
graphType={panelType || PANEL_TYPES.TIME_SERIES}
|
||||||
|
setQueryStatus={setQueryStatus}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -665,7 +668,8 @@ function FormAlertRules({
|
|||||||
disabled={
|
disabled={
|
||||||
isAlertNameMissing ||
|
isAlertNameMissing ||
|
||||||
isAlertAvailableToSave ||
|
isAlertAvailableToSave ||
|
||||||
!isChannelConfigurationValid
|
!isChannelConfigurationValid ||
|
||||||
|
queryStatus === 'error'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{isNewRule ? t('button_createrule') : t('button_savechanges')}
|
{isNewRule ? t('button_createrule') : t('button_savechanges')}
|
||||||
@@ -674,7 +678,11 @@ function FormAlertRules({
|
|||||||
|
|
||||||
<ActionButton
|
<ActionButton
|
||||||
loading={loading || false}
|
loading={loading || false}
|
||||||
disabled={isAlertNameMissing || !isChannelConfigurationValid}
|
disabled={
|
||||||
|
isAlertNameMissing ||
|
||||||
|
!isChannelConfigurationValid ||
|
||||||
|
queryStatus === 'error'
|
||||||
|
}
|
||||||
type="default"
|
type="default"
|
||||||
onClick={onTestRuleHandler}
|
onClick={onTestRuleHandler}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ const getSpanWithoutChildren = (
|
|||||||
value: span.value,
|
value: span.value,
|
||||||
event: span.event,
|
event: span.event,
|
||||||
hasError: span.hasError,
|
hasError: span.hasError,
|
||||||
|
spanKind: span.spanKind,
|
||||||
|
statusCodeString: span.statusCodeString,
|
||||||
|
statusMessage: span.statusMessage,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const isSpanPresentInSearchString = (
|
export const isSpanPresentInSearchString = (
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import './DashboardEmptyState.styles.scss';
|
|||||||
|
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
import { Button, Typography } from 'antd';
|
import { Button, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import SettingsDrawer from 'container/NewDashboard/DashboardDescription/SettingsDrawer';
|
import SettingsDrawer from 'container/NewDashboard/DashboardDescription/SettingsDrawer';
|
||||||
import useComponentPermission from 'hooks/useComponentPermission';
|
import useComponentPermission from 'hooks/useComponentPermission';
|
||||||
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
||||||
@@ -36,6 +37,12 @@ export default function DashboardEmptyState(): JSX.Element {
|
|||||||
|
|
||||||
const onEmptyWidgetHandler = useCallback(() => {
|
const onEmptyWidgetHandler = useCallback(() => {
|
||||||
handleToggleDashboardSlider(true);
|
handleToggleDashboardSlider(true);
|
||||||
|
logEvent('Dashboard Detail: Add new panel clicked', {
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
dashboardName: selectedDashboard?.data.title,
|
||||||
|
numberOfPanels: selectedDashboard?.data.widgets?.length,
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [handleToggleDashboardSlider]);
|
}, [handleToggleDashboardSlider]);
|
||||||
return (
|
return (
|
||||||
<section className="dashboard-empty-state">
|
<section className="dashboard-empty-state">
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { memo, useEffect, useRef, useState } from 'react';
|
|||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { UpdateTimeInterval } from 'store/actions';
|
import { UpdateTimeInterval } from 'store/actions';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
import { getGraphType } from 'utils/getGraphType';
|
import { getGraphType } from 'utils/getGraphType';
|
||||||
import { getSortedSeriesData } from 'utils/getSortedSeriesData';
|
import { getSortedSeriesData } from 'utils/getSortedSeriesData';
|
||||||
@@ -113,6 +114,7 @@ function GridCardGraph({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
updatedQuery.builder.queryData[0].pageSize = 10;
|
updatedQuery.builder.queryData[0].pageSize = 10;
|
||||||
|
const initialDataSource = updatedQuery.builder.queryData[0].dataSource;
|
||||||
return {
|
return {
|
||||||
query: updatedQuery,
|
query: updatedQuery,
|
||||||
graphType: PANEL_TYPES.LIST,
|
graphType: PANEL_TYPES.LIST,
|
||||||
@@ -123,6 +125,10 @@ function GridCardGraph({
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
limit: updatedQuery.builder.queryData[0].limit || 0,
|
limit: updatedQuery.builder.queryData[0].limit || 0,
|
||||||
},
|
},
|
||||||
|
selectColumns:
|
||||||
|
initialDataSource === DataSource.LOGS
|
||||||
|
? widget.selectedLogFields
|
||||||
|
: widget.selectedTracesFields,
|
||||||
},
|
},
|
||||||
fillGaps: widget.fillSpans,
|
fillGaps: widget.fillSpans,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
.fullscreen-grid-container {
|
.fullscreen-grid-container {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin: 8px -8px;
|
margin: 8px -8px;
|
||||||
|
margin-right: 0;
|
||||||
|
|
||||||
.react-grid-layout {
|
.react-grid-layout {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import './GridCardLayout.styles.scss';
|
|||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import { Button, Form, Input, Modal, Typography } from 'antd';
|
import { Button, Form, Input, Modal, Typography } from 'antd';
|
||||||
import { useForm } from 'antd/es/form/Form';
|
import { useForm } from 'antd/es/form/Form';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
@@ -15,7 +16,7 @@ import { useIsDarkMode } from 'hooks/useDarkMode';
|
|||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import useUrlQuery from 'hooks/useUrlQuery';
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { defaultTo } from 'lodash-es';
|
import { defaultTo, isUndefined } from 'lodash-es';
|
||||||
import isEqual from 'lodash-es/isEqual';
|
import isEqual from 'lodash-es/isEqual';
|
||||||
import {
|
import {
|
||||||
Check,
|
Check,
|
||||||
@@ -27,7 +28,7 @@ import {
|
|||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
||||||
import { sortLayout } from 'providers/Dashboard/util';
|
import { sortLayout } from 'providers/Dashboard/util';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { FullScreen, FullScreenHandle } from 'react-full-screen';
|
import { FullScreen, FullScreenHandle } from 'react-full-screen';
|
||||||
import { ItemCallback, Layout } from 'react-grid-layout';
|
import { ItemCallback, Layout } from 'react-grid-layout';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
@@ -126,6 +127,18 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
|
|||||||
setDashboardLayout(sortLayout(layouts));
|
setDashboardLayout(sortLayout(layouts));
|
||||||
}, [layouts]);
|
}, [layouts]);
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current && !isUndefined(data)) {
|
||||||
|
logEvent('Dashboard Detail: Opened', {
|
||||||
|
dashboardId: data.uuid,
|
||||||
|
dashboardName: data.title,
|
||||||
|
numberOfPanels: data.widgets?.length,
|
||||||
|
numberOfVariables: Object.keys(data?.variables || {}).length || 0,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
}, [data]);
|
||||||
const onSaveHandler = (): void => {
|
const onSaveHandler = (): void => {
|
||||||
if (!selectedDashboard) return;
|
if (!selectedDashboard) return;
|
||||||
|
|
||||||
@@ -428,7 +441,11 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
|
|||||||
return isDashboardEmpty ? (
|
return isDashboardEmpty ? (
|
||||||
<DashboardEmptyState />
|
<DashboardEmptyState />
|
||||||
) : (
|
) : (
|
||||||
<FullScreen handle={handle} className="fullscreen-grid-container">
|
<FullScreen
|
||||||
|
handle={handle}
|
||||||
|
className="fullscreen-grid-container"
|
||||||
|
data-overlayscrollbars-initialize
|
||||||
|
>
|
||||||
<ReactGridLayout
|
<ReactGridLayout
|
||||||
cols={12}
|
cols={12}
|
||||||
rowHeight={45}
|
rowHeight={45}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function WidgetHeader({
|
|||||||
);
|
);
|
||||||
}, [widget.id, widget.panelTypes, widget.query]);
|
}, [widget.id, widget.panelTypes, widget.query]);
|
||||||
|
|
||||||
const onCreateAlertsHandler = useCreateAlerts(widget);
|
const onCreateAlertsHandler = useCreateAlerts(widget, 'dashboardView');
|
||||||
|
|
||||||
const onDownloadHandler = useCallback((): void => {
|
const onDownloadHandler = useCallback((): void => {
|
||||||
const csv = unparse(tableProcessedDataRef.current);
|
const csv = unparse(tableProcessedDataRef.current);
|
||||||
@@ -234,6 +234,7 @@ function WidgetHeader({
|
|||||||
)}
|
)}
|
||||||
<Dropdown menu={menu} trigger={['hover']} placement="bottomRight">
|
<Dropdown menu={menu} trigger={['hover']} placement="bottomRight">
|
||||||
<MoreOutlined
|
<MoreOutlined
|
||||||
|
data-testid="widget-header-options"
|
||||||
className={`widget-header-more-options ${
|
className={`widget-header-more-options ${
|
||||||
parentHover ? 'widget-header-hover' : ''
|
parentHover ? 'widget-header-hover' : ''
|
||||||
}`}
|
}`}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
|
|
||||||
import { createColumnsAndDataSource, getQueryLegend } from '../utils';
|
import {
|
||||||
|
createColumnsAndDataSource,
|
||||||
|
getQueryLegend,
|
||||||
|
sortFunction,
|
||||||
|
} from '../utils';
|
||||||
import {
|
import {
|
||||||
expectedOutputWithLegends,
|
expectedOutputWithLegends,
|
||||||
tableDataMultipleQueriesSuccessResponse,
|
tableDataMultipleQueriesSuccessResponse,
|
||||||
@@ -39,4 +43,88 @@ describe('Table Panel utils', () => {
|
|||||||
// should return undefined when legend not present
|
// should return undefined when legend not present
|
||||||
expect(getQueryLegend(query, 'B')).toBe(undefined);
|
expect(getQueryLegend(query, 'B')).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sorter function for table sorting', () => {
|
||||||
|
let rowA: {
|
||||||
|
A: string | number;
|
||||||
|
timestamp: number;
|
||||||
|
key: string;
|
||||||
|
} = {
|
||||||
|
A: 22.4,
|
||||||
|
timestamp: 111111,
|
||||||
|
key: '1111',
|
||||||
|
};
|
||||||
|
let rowB: {
|
||||||
|
A: string | number;
|
||||||
|
timestamp: number;
|
||||||
|
key: string;
|
||||||
|
} = {
|
||||||
|
A: 'n/a',
|
||||||
|
timestamp: 111112,
|
||||||
|
key: '1112',
|
||||||
|
};
|
||||||
|
const item = {
|
||||||
|
isValueColumn: true,
|
||||||
|
name: 'A',
|
||||||
|
queryName: 'A',
|
||||||
|
};
|
||||||
|
// A has value and value is considered bigger than n/a hence 1
|
||||||
|
expect(sortFunction(rowA, rowB, item)).toBe(1);
|
||||||
|
|
||||||
|
rowA = {
|
||||||
|
A: 'n/a',
|
||||||
|
timestamp: 111111,
|
||||||
|
key: '1111',
|
||||||
|
};
|
||||||
|
rowB = {
|
||||||
|
A: 22.4,
|
||||||
|
timestamp: 111112,
|
||||||
|
key: '1112',
|
||||||
|
};
|
||||||
|
|
||||||
|
// B has value and value is considered bigger than n/a hence -1
|
||||||
|
expect(sortFunction(rowA, rowB, item)).toBe(-1);
|
||||||
|
|
||||||
|
rowA = {
|
||||||
|
A: 11,
|
||||||
|
timestamp: 111111,
|
||||||
|
key: '1111',
|
||||||
|
};
|
||||||
|
rowB = {
|
||||||
|
A: 22,
|
||||||
|
timestamp: 111112,
|
||||||
|
key: '1112',
|
||||||
|
};
|
||||||
|
|
||||||
|
// A and B has value , since B > A hence A-B
|
||||||
|
expect(sortFunction(rowA, rowB, item)).toBe(-11);
|
||||||
|
|
||||||
|
rowA = {
|
||||||
|
A: 'read',
|
||||||
|
timestamp: 111111,
|
||||||
|
key: '1111',
|
||||||
|
};
|
||||||
|
rowB = {
|
||||||
|
A: 'write',
|
||||||
|
timestamp: 111112,
|
||||||
|
key: '1112',
|
||||||
|
};
|
||||||
|
|
||||||
|
// A and B are strings so A is smaller than B because r comes before w hence -1
|
||||||
|
expect(sortFunction(rowA, rowB, item)).toBe(-1);
|
||||||
|
|
||||||
|
rowA = {
|
||||||
|
A: 'n/a',
|
||||||
|
timestamp: 111111,
|
||||||
|
key: '1111',
|
||||||
|
};
|
||||||
|
rowB = {
|
||||||
|
A: 'n/a',
|
||||||
|
timestamp: 111112,
|
||||||
|
key: '1112',
|
||||||
|
};
|
||||||
|
|
||||||
|
// A and B are strings n/a , since both of them are same hence 0
|
||||||
|
expect(sortFunction(rowA, rowB, item)).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable sonarjs/cognitive-complexity */
|
||||||
import { ColumnsType, ColumnType } from 'antd/es/table';
|
import { ColumnsType, ColumnType } from 'antd/es/table';
|
||||||
import { ThresholdProps } from 'container/NewWidget/RightContainer/Threshold/types';
|
import { ThresholdProps } from 'container/NewWidget/RightContainer/Threshold/types';
|
||||||
import { QUERY_TABLE_CONFIG } from 'container/QueryTable/config';
|
import { QUERY_TABLE_CONFIG } from 'container/QueryTable/config';
|
||||||
@@ -105,6 +106,39 @@ export function getQueryLegend(
|
|||||||
return legend;
|
return legend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sortFunction(
|
||||||
|
a: RowData,
|
||||||
|
b: RowData,
|
||||||
|
item: {
|
||||||
|
name: string;
|
||||||
|
queryName: string;
|
||||||
|
isValueColumn: boolean;
|
||||||
|
},
|
||||||
|
): number {
|
||||||
|
// assumption :- number values is bigger than 'n/a'
|
||||||
|
const valueA = Number(a[`${item.name}_without_unit`] ?? a[item.name]);
|
||||||
|
const valueB = Number(b[`${item.name}_without_unit`] ?? b[item.name]);
|
||||||
|
|
||||||
|
// if both the values are numbers then return the difference here
|
||||||
|
if (!isNaN(valueA) && !isNaN(valueB)) {
|
||||||
|
return valueA - valueB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if valueB is a number then make it bigger value
|
||||||
|
if (isNaN(valueA) && !isNaN(valueB)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if valueA is number make it the bigger value
|
||||||
|
if (!isNaN(valueA) && isNaN(valueB)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if both of them are strings do the localecompare
|
||||||
|
return ((a[item.name] as string) || '').localeCompare(
|
||||||
|
(b[item.name] as string) || '',
|
||||||
|
);
|
||||||
|
}
|
||||||
export function createColumnsAndDataSource(
|
export function createColumnsAndDataSource(
|
||||||
data: TableData,
|
data: TableData,
|
||||||
currentQuery: Query,
|
currentQuery: Query,
|
||||||
@@ -123,18 +157,7 @@ export function createColumnsAndDataSource(
|
|||||||
title: !isEmpty(legend) ? legend : item.name,
|
title: !isEmpty(legend) ? legend : item.name,
|
||||||
width: QUERY_TABLE_CONFIG.width,
|
width: QUERY_TABLE_CONFIG.width,
|
||||||
render: renderColumnCell && renderColumnCell[item.name],
|
render: renderColumnCell && renderColumnCell[item.name],
|
||||||
sorter: (a: RowData, b: RowData): number => {
|
sorter: (a: RowData, b: RowData): number => sortFunction(a, b, item),
|
||||||
const valueA = Number(a[`${item.name}_without_unit`] ?? a[item.name]);
|
|
||||||
const valueB = Number(b[`${item.name}_without_unit`] ?? b[item.name]);
|
|
||||||
|
|
||||||
if (!isNaN(valueA) && !isNaN(valueB)) {
|
|
||||||
return valueA - valueB;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((a[item.name] as string) || '').localeCompare(
|
|
||||||
(b[item.name] as string) || '',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return [...acc, column];
|
return [...acc, column];
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { TableProps } from 'antd/lib';
|
import { TableProps } from 'antd/lib';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import createDashboard from 'api/dashboard/create';
|
import createDashboard from 'api/dashboard/create';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
@@ -34,7 +35,7 @@ import { useGetAllDashboard } from 'hooks/dashboard/useGetAllDashboard';
|
|||||||
import useComponentPermission from 'hooks/useComponentPermission';
|
import useComponentPermission from 'hooks/useComponentPermission';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { get, isEmpty } from 'lodash-es';
|
import { get, isEmpty, isUndefined } from 'lodash-es';
|
||||||
import {
|
import {
|
||||||
ArrowDownWideNarrow,
|
ArrowDownWideNarrow,
|
||||||
ArrowUpRight,
|
ArrowUpRight,
|
||||||
@@ -60,6 +61,7 @@ import {
|
|||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -269,6 +271,7 @@ function DashboardsList(): JSX.Element {
|
|||||||
|
|
||||||
const onNewDashboardHandler = useCallback(async () => {
|
const onNewDashboardHandler = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
|
logEvent('Dashboard List: Create dashboard clicked', {});
|
||||||
setNewDashboardState({
|
setNewDashboardState({
|
||||||
...newDashboardState,
|
...newDashboardState,
|
||||||
loading: true,
|
loading: true,
|
||||||
@@ -305,6 +308,8 @@ function DashboardsList(): JSX.Element {
|
|||||||
}, [newDashboardState, t]);
|
}, [newDashboardState, t]);
|
||||||
|
|
||||||
const onModalHandler = (uploadedGrafana: boolean): void => {
|
const onModalHandler = (uploadedGrafana: boolean): void => {
|
||||||
|
logEvent('Dashboard List: Import JSON clicked', {});
|
||||||
|
|
||||||
setIsImportJSONModalVisible((state) => !state);
|
setIsImportJSONModalVisible((state) => !state);
|
||||||
setUploadedGrafana(uploadedGrafana);
|
setUploadedGrafana(uploadedGrafana);
|
||||||
};
|
};
|
||||||
@@ -441,6 +446,10 @@ function DashboardsList(): JSX.Element {
|
|||||||
} else {
|
} else {
|
||||||
history.push(getLink());
|
history.push(getLink());
|
||||||
}
|
}
|
||||||
|
logEvent('Dashboard List: Clicked on dashboard', {
|
||||||
|
dashboardId: dashboard.id,
|
||||||
|
dashboardName: dashboard.name,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -619,6 +628,21 @@ function DashboardsList(): JSX.Element {
|
|||||||
hideOnSinglePage: true,
|
hideOnSinglePage: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
!logEventCalledRef.current &&
|
||||||
|
!isDashboardListLoading &&
|
||||||
|
!isUndefined(dashboardListResponse)
|
||||||
|
) {
|
||||||
|
logEvent('Dashboard List: Page visited', {
|
||||||
|
number: dashboardListResponse?.length,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [isDashboardListLoading]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dashboards-list-container">
|
<div className="dashboards-list-container">
|
||||||
<div className="dashboards-list-view-content">
|
<div className="dashboards-list-view-content">
|
||||||
@@ -705,6 +729,9 @@ function DashboardsList(): JSX.Element {
|
|||||||
type="text"
|
type="text"
|
||||||
className="new-dashboard"
|
className="new-dashboard"
|
||||||
icon={<Plus size={14} />}
|
icon={<Plus size={14} />}
|
||||||
|
onClick={(): void => {
|
||||||
|
logEvent('Dashboard List: New dashboard clicked', {});
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
New Dashboard
|
New Dashboard
|
||||||
</Button>
|
</Button>
|
||||||
@@ -745,6 +772,9 @@ function DashboardsList(): JSX.Element {
|
|||||||
type="primary"
|
type="primary"
|
||||||
className="periscope-btn primary btn"
|
className="periscope-btn primary btn"
|
||||||
icon={<Plus size={14} />}
|
icon={<Plus size={14} />}
|
||||||
|
onClick={(): void => {
|
||||||
|
logEvent('Dashboard List: New dashboard clicked', {});
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
New dashboard
|
New dashboard
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ExclamationCircleTwoTone } from '@ant-design/icons';
|
|||||||
import MEditor, { Monaco } from '@monaco-editor/react';
|
import MEditor, { Monaco } from '@monaco-editor/react';
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import { Button, Modal, Space, Typography, Upload, UploadProps } from 'antd';
|
import { Button, Modal, Space, Typography, Upload, UploadProps } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import createDashboard from 'api/dashboard/create';
|
import createDashboard from 'api/dashboard/create';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
@@ -67,6 +68,8 @@ function ImportJSON({
|
|||||||
const onClickLoadJsonHandler = async (): Promise<void> => {
|
const onClickLoadJsonHandler = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
setDashboardCreating(true);
|
setDashboardCreating(true);
|
||||||
|
logEvent('Dashboard List: Import and next clicked', {});
|
||||||
|
|
||||||
const dashboardData = JSON.parse(editorValue) as DashboardData;
|
const dashboardData = JSON.parse(editorValue) as DashboardData;
|
||||||
|
|
||||||
if (dashboardData?.layout) {
|
if (dashboardData?.layout) {
|
||||||
@@ -86,6 +89,10 @@ function ImportJSON({
|
|||||||
dashboardId: response.payload.uuid,
|
dashboardId: response.payload.uuid,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
logEvent('Dashboard List: New dashboard imported successfully', {
|
||||||
|
dashboardId: response.payload?.uuid,
|
||||||
|
dashboardName: response.payload?.data?.title,
|
||||||
|
});
|
||||||
} else if (response.error === 'feature usage exceeded') {
|
} else if (response.error === 'feature usage exceeded') {
|
||||||
setIsFeatureAlert(true);
|
setIsFeatureAlert(true);
|
||||||
notifications.error({
|
notifications.error({
|
||||||
@@ -180,6 +187,9 @@ function ImportJSON({
|
|||||||
type="default"
|
type="default"
|
||||||
className="periscope-btn"
|
className="periscope-btn"
|
||||||
icon={<MonitorDot size={14} />}
|
icon={<MonitorDot size={14} />}
|
||||||
|
onClick={(): void => {
|
||||||
|
logEvent('Dashboard List: Upload JSON file clicked', {});
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
{t('upload_json_file')}
|
{t('upload_json_file')}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import LogDetail from 'components/LogDetail';
|
|||||||
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
||||||
import ListLogView from 'components/Logs/ListLogView';
|
import ListLogView from 'components/Logs/ListLogView';
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
import { CARD_BODY_STYLE } from 'constants/card';
|
import { CARD_BODY_STYLE } from 'constants/card';
|
||||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
@@ -128,13 +129,15 @@ function LiveLogsList({ logs }: LiveLogsListProps): JSX.Element {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Card style={{ width: '100%' }} bodyStyle={CARD_BODY_STYLE}>
|
<Card style={{ width: '100%' }} bodyStyle={CARD_BODY_STYLE}>
|
||||||
<Virtuoso
|
<OverlayScrollbar isVirtuoso>
|
||||||
ref={ref}
|
<Virtuoso
|
||||||
initialTopMostItemIndex={activeLogIndex !== -1 ? activeLogIndex : 0}
|
ref={ref}
|
||||||
data={logs}
|
initialTopMostItemIndex={activeLogIndex !== -1 ? activeLogIndex : 0}
|
||||||
totalCount={logs.length}
|
data={logs}
|
||||||
itemContent={getItemContent}
|
totalCount={logs.length}
|
||||||
/>
|
itemContent={getItemContent}
|
||||||
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
</InfinityWrapperStyled>
|
</InfinityWrapperStyled>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import './ContextLogRenderer.styles.scss';
|
|||||||
|
|
||||||
import { Skeleton } from 'antd';
|
import { Skeleton } from 'antd';
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import ShowButton from 'container/LogsContextList/ShowButton';
|
import ShowButton from 'container/LogsContextList/ShowButton';
|
||||||
import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
@@ -94,13 +95,15 @@ function ContextLogRenderer({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Virtuoso
|
<OverlayScrollbar isVirtuoso>
|
||||||
className="virtuoso-list"
|
<Virtuoso
|
||||||
initialTopMostItemIndex={0}
|
className="virtuoso-list"
|
||||||
data={logs}
|
initialTopMostItemIndex={0}
|
||||||
itemContent={getItemContent}
|
data={logs}
|
||||||
style={{ height: `calc(${logs.length} * 32px)` }}
|
itemContent={getItemContent}
|
||||||
/>
|
style={{ height: `calc(${logs.length} * 32px)` }}
|
||||||
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
{isAfterLogsFetching && (
|
{isAfterLogsFetching && (
|
||||||
<Skeleton
|
<Skeleton
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import './LogsContextList.styles.scss';
|
import './LogsContextList.styles.scss';
|
||||||
|
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
@@ -187,14 +188,15 @@ function LogsContextList({
|
|||||||
<EmptyText>No Data</EmptyText>
|
<EmptyText>No Data</EmptyText>
|
||||||
)}
|
)}
|
||||||
{isFetching && <Spinner size="large" height="10rem" />}
|
{isFetching && <Spinner size="large" height="10rem" />}
|
||||||
|
<OverlayScrollbar isVirtuoso>
|
||||||
<Virtuoso
|
<Virtuoso
|
||||||
className="virtuoso-list"
|
className="virtuoso-list"
|
||||||
initialTopMostItemIndex={0}
|
initialTopMostItemIndex={0}
|
||||||
data={logs}
|
data={logs}
|
||||||
itemContent={getItemContent}
|
itemContent={getItemContent}
|
||||||
followOutput={order === ORDERBY_FILTERS.DESC}
|
followOutput={order === ORDERBY_FILTERS.DESC}
|
||||||
/>
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
</ListContainer>
|
</ListContainer>
|
||||||
|
|
||||||
{order === ORDERBY_FILTERS.DESC && (
|
{order === ORDERBY_FILTERS.DESC && (
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { VIEW_TYPES } from 'components/LogDetail/constants';
|
|||||||
// components
|
// components
|
||||||
import ListLogView from 'components/Logs/ListLogView';
|
import ListLogView from 'components/Logs/ListLogView';
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
import { CARD_BODY_STYLE } from 'constants/card';
|
import { CARD_BODY_STYLE } from 'constants/card';
|
||||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
@@ -133,15 +134,17 @@ function LogsExplorerList({
|
|||||||
style={{ width: '100%', marginTop: '20px' }}
|
style={{ width: '100%', marginTop: '20px' }}
|
||||||
bodyStyle={CARD_BODY_STYLE}
|
bodyStyle={CARD_BODY_STYLE}
|
||||||
>
|
>
|
||||||
<Virtuoso
|
<OverlayScrollbar isVirtuoso>
|
||||||
ref={ref}
|
<Virtuoso
|
||||||
initialTopMostItemIndex={activeLogIndex !== -1 ? activeLogIndex : 0}
|
ref={ref}
|
||||||
data={logs}
|
initialTopMostItemIndex={activeLogIndex !== -1 ? activeLogIndex : 0}
|
||||||
endReached={onEndReached}
|
data={logs}
|
||||||
totalCount={logs.length}
|
endReached={onEndReached}
|
||||||
itemContent={getItemContent}
|
totalCount={logs.length}
|
||||||
components={components}
|
itemContent={getItemContent}
|
||||||
/>
|
components={components}
|
||||||
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}, [
|
}, [
|
||||||
@@ -169,7 +172,9 @@ function LogsExplorerList({
|
|||||||
!isFetching &&
|
!isFetching &&
|
||||||
logs.length === 0 &&
|
logs.length === 0 &&
|
||||||
!isError &&
|
!isError &&
|
||||||
isFilterApplied && <EmptyLogsSearch />}
|
isFilterApplied && (
|
||||||
|
<EmptyLogsSearch dataSource={DataSource.LOGS} panelType="LIST" />
|
||||||
|
)}
|
||||||
|
|
||||||
{isError && !isLoading && !isFetching && <LogsError />}
|
{isError && !isLoading && !isFetching && <LogsError />}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import './LogsExplorerViews.styles.scss';
|
import './LogsExplorerViews.styles.scss';
|
||||||
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import LogsFormatOptionsMenu from 'components/LogsFormatOptionsMenu/LogsFormatOptionsMenu';
|
import LogsFormatOptionsMenu from 'components/LogsFormatOptionsMenu/LogsFormatOptionsMenu';
|
||||||
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
||||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
@@ -37,7 +38,14 @@ import { useNotifications } from 'hooks/useNotifications';
|
|||||||
import useUrlQueryData from 'hooks/useUrlQueryData';
|
import useUrlQueryData from 'hooks/useUrlQueryData';
|
||||||
import { FlatLogData } from 'lib/logs/flatLogData';
|
import { FlatLogData } from 'lib/logs/flatLogData';
|
||||||
import { getPaginationQueryData } from 'lib/newQueryBuilder/getPaginationQueryData';
|
import { getPaginationQueryData } from 'lib/newQueryBuilder/getPaginationQueryData';
|
||||||
import { cloneDeep, defaultTo, isEmpty, omit, set } from 'lodash-es';
|
import {
|
||||||
|
cloneDeep,
|
||||||
|
defaultTo,
|
||||||
|
isEmpty,
|
||||||
|
isUndefined,
|
||||||
|
omit,
|
||||||
|
set,
|
||||||
|
} from 'lodash-es';
|
||||||
import { Sliders } from 'lucide-react';
|
import { Sliders } from 'lucide-react';
|
||||||
import { SELECTED_VIEWS } from 'pages/LogsExplorer/utils';
|
import { SELECTED_VIEWS } from 'pages/LogsExplorer/utils';
|
||||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
@@ -310,6 +318,19 @@ function LogsExplorerViews({
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current && !isUndefined(data?.payload)) {
|
||||||
|
const currentData = data?.payload?.data?.newResult?.data?.result || [];
|
||||||
|
logEvent('Logs Explorer: Page visited', {
|
||||||
|
panelType,
|
||||||
|
isEmpty: !currentData?.[0]?.list,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [data?.payload]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
mutate: updateDashboard,
|
mutate: updateDashboard,
|
||||||
isLoading: isUpdateDashboardLoading,
|
isLoading: isUpdateDashboardLoading,
|
||||||
@@ -324,7 +345,7 @@ function LogsExplorerViews({
|
|||||||
}, [currentQuery]);
|
}, [currentQuery]);
|
||||||
|
|
||||||
const handleExport = useCallback(
|
const handleExport = useCallback(
|
||||||
(dashboard: Dashboard | null): void => {
|
(dashboard: Dashboard | null, isNewDashboard?: boolean): void => {
|
||||||
if (!dashboard || !panelType) return;
|
if (!dashboard || !panelType) return;
|
||||||
|
|
||||||
const panelTypeParam = AVAILABLE_EXPORT_PANEL_TYPES.includes(panelType)
|
const panelTypeParam = AVAILABLE_EXPORT_PANEL_TYPES.includes(panelType)
|
||||||
@@ -346,6 +367,12 @@ function LogsExplorerViews({
|
|||||||
options.selectColumns,
|
options.selectColumns,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
logEvent('Logs Explorer: Add to dashboard successful', {
|
||||||
|
panelType,
|
||||||
|
isNewDashboard,
|
||||||
|
dashboardName: dashboard?.data?.title,
|
||||||
|
});
|
||||||
|
|
||||||
updateDashboard(updatedDashboard, {
|
updateDashboard(updatedDashboard, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import './LogsPanelComponent.styles.scss';
|
|||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
import LogDetail from 'components/LogDetail';
|
import LogDetail from 'components/LogDetail';
|
||||||
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
import { VIEW_TYPES } from 'components/LogDetail/constants';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import Controls from 'container/Controls';
|
import Controls from 'container/Controls';
|
||||||
@@ -207,17 +208,19 @@ function LogsPanelComponent({
|
|||||||
<>
|
<>
|
||||||
<div className="logs-table">
|
<div className="logs-table">
|
||||||
<div className="resize-table">
|
<div className="resize-table">
|
||||||
<Table
|
<OverlayScrollbar>
|
||||||
pagination={false}
|
<Table
|
||||||
tableLayout="fixed"
|
pagination={false}
|
||||||
scroll={{ x: `calc(50vw - 10px)` }}
|
tableLayout="fixed"
|
||||||
sticky
|
scroll={{ x: `calc(50vw - 10px)` }}
|
||||||
loading={queryResponse.isFetching}
|
sticky
|
||||||
style={tableStyles}
|
loading={queryResponse.isFetching}
|
||||||
dataSource={flattenLogData}
|
style={tableStyles}
|
||||||
columns={columns}
|
dataSource={flattenLogData}
|
||||||
onRow={handleRow}
|
columns={columns}
|
||||||
/>
|
onRow={handleRow}
|
||||||
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
</div>
|
</div>
|
||||||
{!widget.query.builder.queryData[0].limit && (
|
{!widget.query.builder.queryData[0].limit && (
|
||||||
<div className="controller">
|
<div className="controller">
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { VIEW_TYPES } from 'components/LogDetail/constants';
|
|||||||
import ListLogView from 'components/Logs/ListLogView';
|
import ListLogView from 'components/Logs/ListLogView';
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
import LogsTableView from 'components/Logs/TableView';
|
import LogsTableView from 'components/Logs/TableView';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
import { CARD_BODY_STYLE } from 'constants/card';
|
import { CARD_BODY_STYLE } from 'constants/card';
|
||||||
import { useActiveLog } from 'hooks/logs/useActiveLog';
|
import { useActiveLog } from 'hooks/logs/useActiveLog';
|
||||||
@@ -97,7 +98,9 @@ function LogsTable(props: LogsTableProps): JSX.Element {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="logs-card" bodyStyle={CARD_BODY_STYLE}>
|
<Card className="logs-card" bodyStyle={CARD_BODY_STYLE}>
|
||||||
<Virtuoso totalCount={logs.length} itemContent={getItemContent} />
|
<OverlayScrollbar isVirtuoso>
|
||||||
|
<Virtuoso totalCount={logs.length} itemContent={getItemContent} />
|
||||||
|
</OverlayScrollbar>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}, [getItemContent, linesPerRow, logs, onSetActiveLog, selected, viewMode]);
|
}, [getItemContent, linesPerRow, logs, onSetActiveLog, selected, viewMode]);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Col } from 'antd';
|
import { Col } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { ENTITY_VERSION_V4 } from 'constants/app';
|
import { ENTITY_VERSION_V4 } from 'constants/app';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import Graph from 'container/GridCardLayout/GridCard';
|
import Graph from 'container/GridCardLayout/GridCard';
|
||||||
@@ -11,7 +12,7 @@ import {
|
|||||||
convertRawQueriesToTraceSelectedTags,
|
convertRawQueriesToTraceSelectedTags,
|
||||||
resourceAttributesToTagFilterItems,
|
resourceAttributesToTagFilterItems,
|
||||||
} from 'hooks/useResourceAttribute/utils';
|
} from 'hooks/useResourceAttribute/utils';
|
||||||
import { useMemo, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { EQueryType } from 'types/common/dashboard';
|
import { EQueryType } from 'types/common/dashboard';
|
||||||
@@ -97,6 +98,24 @@ function DBCall(): JSX.Element {
|
|||||||
[servicename, tagFilterItems],
|
[servicename, tagFilterItems],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current) {
|
||||||
|
const selectedEnvironments = queries.find(
|
||||||
|
(val) => val.tagKey === 'resource_deployment_environment',
|
||||||
|
)?.tagValue;
|
||||||
|
|
||||||
|
logEvent('APM: Service detail page visited', {
|
||||||
|
selectedEnvironments,
|
||||||
|
resourceAttributeUsed: !!queries.length,
|
||||||
|
section: 'dbMetrics',
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
const apmToTraceQuery = useGetAPMToTracesQueries({
|
const apmToTraceQuery = useGetAPMToTracesQueries({
|
||||||
servicename,
|
servicename,
|
||||||
isDBCall: true,
|
isDBCall: true,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Col } from 'antd';
|
import { Col } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { ENTITY_VERSION_V4 } from 'constants/app';
|
import { ENTITY_VERSION_V4 } from 'constants/app';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import Graph from 'container/GridCardLayout/GridCard';
|
import Graph from 'container/GridCardLayout/GridCard';
|
||||||
@@ -13,7 +14,7 @@ import {
|
|||||||
convertRawQueriesToTraceSelectedTags,
|
convertRawQueriesToTraceSelectedTags,
|
||||||
resourceAttributesToTagFilterItems,
|
resourceAttributesToTagFilterItems,
|
||||||
} from 'hooks/useResourceAttribute/utils';
|
} from 'hooks/useResourceAttribute/utils';
|
||||||
import { useMemo, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { EQueryType } from 'types/common/dashboard';
|
import { EQueryType } from 'types/common/dashboard';
|
||||||
@@ -114,6 +115,23 @@ function External(): JSX.Element {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current) {
|
||||||
|
const selectedEnvironments = queries.find(
|
||||||
|
(val) => val.tagKey === 'resource_deployment_environment',
|
||||||
|
)?.tagValue;
|
||||||
|
|
||||||
|
logEvent('APM: Service detail page visited', {
|
||||||
|
selectedEnvironments,
|
||||||
|
resourceAttributeUsed: !!queries.length,
|
||||||
|
section: 'externalMetrics',
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
const externalCallRPSWidget = useMemo(
|
const externalCallRPSWidget = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getWidgetQueryBuilder({
|
getWidgetQueryBuilder({
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import getTopLevelOperations, {
|
import getTopLevelOperations, {
|
||||||
ServiceDataProps,
|
ServiceDataProps,
|
||||||
} from 'api/metrics/getTopLevelOperations';
|
} from 'api/metrics/getTopLevelOperations';
|
||||||
@@ -17,7 +18,7 @@ import useUrlQuery from 'hooks/useUrlQuery';
|
|||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { OnClickPluginOpts } from 'lib/uPlotLib/plugins/onClickPlugin';
|
import { OnClickPluginOpts } from 'lib/uPlotLib/plugins/onClickPlugin';
|
||||||
import { defaultTo } from 'lodash-es';
|
import { defaultTo } from 'lodash-es';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { useLocation, useParams } from 'react-router-dom';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
@@ -81,6 +82,23 @@ function Application(): JSX.Element {
|
|||||||
[handleSetTimeStamp],
|
[handleSetTimeStamp],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current) {
|
||||||
|
const selectedEnvironments = queries.find(
|
||||||
|
(val) => val.tagKey === 'resource_deployment_environment',
|
||||||
|
)?.tagValue;
|
||||||
|
|
||||||
|
logEvent('APM: Service detail page visited', {
|
||||||
|
selectedEnvironments,
|
||||||
|
resourceAttributeUsed: !!queries.length,
|
||||||
|
section: 'overview',
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: topLevelOperations,
|
data: topLevelOperations,
|
||||||
error: topLevelOperationsError,
|
error: topLevelOperationsError,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import './ComponentSlider.styles.scss';
|
import './ComponentSlider.styles.scss';
|
||||||
|
|
||||||
import { Card, Modal } from 'antd';
|
import { Card, Modal } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import createQueryParams from 'lib/createQueryParams';
|
import createQueryParams from 'lib/createQueryParams';
|
||||||
@@ -20,6 +21,13 @@ function DashboardGraphSlider(): JSX.Element {
|
|||||||
const onClickHandler = (name: PANEL_TYPES) => (): void => {
|
const onClickHandler = (name: PANEL_TYPES) => (): void => {
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
handleToggleDashboardSlider(false);
|
handleToggleDashboardSlider(false);
|
||||||
|
logEvent('Dashboard Detail: New panel type selected', {
|
||||||
|
// dashboardId: '',
|
||||||
|
// dashboardName: '',
|
||||||
|
// numberOfPanels: 0, // todo - at this point we don't know these attributes
|
||||||
|
panelType: name,
|
||||||
|
widgetId: id,
|
||||||
|
});
|
||||||
const queryParamsLog = {
|
const queryParamsLog = {
|
||||||
graphType: name,
|
graphType: name,
|
||||||
widgetId: id,
|
widgetId: id,
|
||||||
@@ -47,7 +55,6 @@ function DashboardGraphSlider(): JSX.Element {
|
|||||||
PANEL_TYPES_INITIAL_QUERY[name],
|
PANEL_TYPES_INITIAL_QUERY[name],
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (name === PANEL_TYPES.LIST) {
|
if (name === PANEL_TYPES.LIST) {
|
||||||
history.push(
|
history.push(
|
||||||
`${history.location.pathname}/new?${createQueryParams(queryParamsLog)}`,
|
`${history.location.pathname}/new?${createQueryParams(queryParamsLog)}`,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import './Description.styles.scss';
|
|||||||
|
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
import ConfigureIcon from 'assets/Integrations/ConfigureIcon';
|
import ConfigureIcon from 'assets/Integrations/ConfigureIcon';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
|
|
||||||
import DashboardSettingsContent from '../DashboardSettings';
|
import DashboardSettingsContent from '../DashboardSettings';
|
||||||
@@ -41,7 +42,9 @@ function SettingsDrawer({ drawerTitle }: { drawerTitle: string }): JSX.Element {
|
|||||||
open={visible}
|
open={visible}
|
||||||
rootClassName="settings-container-root"
|
rootClassName="settings-container-root"
|
||||||
>
|
>
|
||||||
<DashboardSettingsContent variableViewModeRef={variableViewModeRef} />
|
<OverlayScrollbar>
|
||||||
|
<DashboardSettingsContent variableViewModeRef={variableViewModeRef} />
|
||||||
|
</OverlayScrollbar>
|
||||||
</DrawerContainer>
|
</DrawerContainer>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import './Description.styles.scss';
|
|||||||
|
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
import { Button, Card, Input, Modal, Popover, Tag, Typography } from 'antd';
|
import { Button, Card, Input, Modal, Popover, Tag, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import FacingIssueBtn from 'components/facingIssueBtn/FacingIssueBtn';
|
import FacingIssueBtn from 'components/facingIssueBtn/FacingIssueBtn';
|
||||||
import { dashboardHelpMessage } from 'components/facingIssueBtn/util';
|
import { dashboardHelpMessage } from 'components/facingIssueBtn/util';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
@@ -126,6 +127,12 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
|
|||||||
|
|
||||||
const onEmptyWidgetHandler = useCallback(() => {
|
const onEmptyWidgetHandler = useCallback(() => {
|
||||||
handleToggleDashboardSlider(true);
|
handleToggleDashboardSlider(true);
|
||||||
|
logEvent('Dashboard Detail: Add new panel clicked', {
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
dashboardName: selectedDashboard?.data.title,
|
||||||
|
numberOfPanels: selectedDashboard?.data.widgets?.length,
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [handleToggleDashboardSlider]);
|
}, [handleToggleDashboardSlider]);
|
||||||
|
|
||||||
const handleLockDashboardToggle = (): void => {
|
const handleLockDashboardToggle = (): void => {
|
||||||
@@ -404,7 +411,12 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
|
|||||||
trigger="click"
|
trigger="click"
|
||||||
placement="bottomRight"
|
placement="bottomRight"
|
||||||
>
|
>
|
||||||
<Button icon={<Ellipsis size={14} />} type="text" className="icons" />
|
<Button
|
||||||
|
icon={<Ellipsis size={14} />}
|
||||||
|
type="text"
|
||||||
|
className="icons"
|
||||||
|
data-testid="options"
|
||||||
|
/>
|
||||||
</Popover>
|
</Popover>
|
||||||
{!isDashboardLocked && editDashboard && (
|
{!isDashboardLocked && editDashboard && (
|
||||||
<SettingsDrawer drawerTitle="Dashboard Configuration" />
|
<SettingsDrawer drawerTitle="Dashboard Configuration" />
|
||||||
@@ -415,7 +427,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element {
|
|||||||
onClick={onEmptyWidgetHandler}
|
onClick={onEmptyWidgetHandler}
|
||||||
icon={<PlusOutlined />}
|
icon={<PlusOutlined />}
|
||||||
type="primary"
|
type="primary"
|
||||||
data-testid="add-panel"
|
data-testid="add-panel-header"
|
||||||
>
|
>
|
||||||
New Panel
|
New Panel
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import GridGraphs from './GridGraphs';
|
|||||||
function NewDashboard(): JSX.Element {
|
function NewDashboard(): JSX.Element {
|
||||||
const handle = useFullScreenHandle();
|
const handle = useFullScreenHandle();
|
||||||
return (
|
return (
|
||||||
<div style={{ overflowX: 'hidden' }}>
|
<div>
|
||||||
<Description handle={handle} />
|
<Description handle={handle} />
|
||||||
<GridGraphs handle={handle} />
|
<GridGraphs handle={handle} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import './QuerySection.styles.scss';
|
|||||||
|
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import { Button, Tabs, Tooltip, Typography } from 'antd';
|
import { Button, Tabs, Tooltip, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import PromQLIcon from 'assets/Dashboard/PromQl';
|
import PromQLIcon from 'assets/Dashboard/PromQl';
|
||||||
import TextToolTip from 'components/TextToolTip';
|
import TextToolTip from 'components/TextToolTip';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
@@ -14,7 +15,7 @@ import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
|||||||
import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl';
|
import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl';
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
import useUrlQuery from 'hooks/useUrlQuery';
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import { defaultTo } from 'lodash-es';
|
import { defaultTo, isUndefined } from 'lodash-es';
|
||||||
import { Atom, Play, Terminal } from 'lucide-react';
|
import { Atom, Play, Terminal } from 'lucide-react';
|
||||||
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
||||||
import {
|
import {
|
||||||
@@ -122,6 +123,18 @@ function QuerySection({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleRunQuery = (): void => {
|
const handleRunQuery = (): void => {
|
||||||
|
const widgetId = urlQuery.get('widgetId');
|
||||||
|
const isNewPanel = isUndefined(widgets?.find((e) => e.id === widgetId));
|
||||||
|
|
||||||
|
logEvent('Panel Edit: Stage and run query', {
|
||||||
|
dataSource: currentQuery.builder?.queryData?.[0]?.dataSource,
|
||||||
|
panelType: selectedWidget.panelTypes,
|
||||||
|
queryType: currentQuery.queryType,
|
||||||
|
widgetId: selectedWidget.id,
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
dashboardName: selectedDashboard?.data.title,
|
||||||
|
isNewPanel,
|
||||||
|
});
|
||||||
handleStageQuery(currentQuery);
|
handleStageQuery(currentQuery);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function RightContainer({
|
|||||||
const selectedGraphType =
|
const selectedGraphType =
|
||||||
GraphTypes.find((e) => e.name === selectedGraph)?.display || '';
|
GraphTypes.find((e) => e.name === selectedGraph)?.display || '';
|
||||||
|
|
||||||
const onCreateAlertsHandler = useCreateAlerts(selectedWidget);
|
const onCreateAlertsHandler = useCreateAlerts(selectedWidget, 'panelView');
|
||||||
|
|
||||||
const allowThreshold = panelTypeVsThreshold[selectedGraph];
|
const allowThreshold = panelTypeVsThreshold[selectedGraph];
|
||||||
const allowSoftMinMax = panelTypeVsSoftMinMax[selectedGraph];
|
const allowSoftMinMax = panelTypeVsSoftMinMax[selectedGraph];
|
||||||
@@ -163,6 +163,7 @@ function RightContainer({
|
|||||||
value={selectedGraph}
|
value={selectedGraph}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
className="panel-type-select"
|
className="panel-type-select"
|
||||||
|
data-testid="panel-change-select"
|
||||||
>
|
>
|
||||||
{graphTypes.map((item) => (
|
{graphTypes.map((item) => (
|
||||||
<Option key={item.name} value={item.name}>
|
<Option key={item.name} value={item.name}>
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import './NewWidget.styles.scss';
|
|||||||
|
|
||||||
import { WarningOutlined } from '@ant-design/icons';
|
import { WarningOutlined } from '@ant-design/icons';
|
||||||
import { Button, Flex, Modal, Space, Tooltip, Typography } from 'antd';
|
import { Button, Flex, Modal, Space, Tooltip, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import FacingIssueBtn from 'components/facingIssueBtn/FacingIssueBtn';
|
import FacingIssueBtn from 'components/facingIssueBtn/FacingIssueBtn';
|
||||||
import { chartHelpMessage } from 'components/facingIssueBtn/util';
|
import { chartHelpMessage } from 'components/facingIssueBtn/util';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { FeatureKeys } from 'constants/features';
|
import { FeatureKeys } from 'constants/features';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
@@ -30,7 +32,7 @@ import {
|
|||||||
getPreviousWidgets,
|
getPreviousWidgets,
|
||||||
getSelectedWidgetIndex,
|
getSelectedWidgetIndex,
|
||||||
} from 'providers/Dashboard/util';
|
} from 'providers/Dashboard/util';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { generatePath, useParams } from 'react-router-dom';
|
import { generatePath, useParams } from 'react-router-dom';
|
||||||
@@ -100,6 +102,8 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
|
|||||||
|
|
||||||
const [isNewDashboard, setIsNewDashboard] = useState<boolean>(false);
|
const [isNewDashboard, setIsNewDashboard] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const widgetId = query.get('widgetId');
|
const widgetId = query.get('widgetId');
|
||||||
const selectedWidget = widgets?.find((e) => e.id === widgetId);
|
const selectedWidget = widgets?.find((e) => e.id === widgetId);
|
||||||
@@ -107,6 +111,18 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
|
|||||||
if (isWidgetNotPresent) {
|
if (isWidgetNotPresent) {
|
||||||
setIsNewDashboard(true);
|
setIsNewDashboard(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!logEventCalledRef.current) {
|
||||||
|
logEvent('Panel Edit: Page visited', {
|
||||||
|
panelType: selectedWidget?.panelTypes,
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
widgetId: selectedWidget?.id,
|
||||||
|
dashboardName: selectedDashboard?.data.title,
|
||||||
|
isNewPanel: !!isWidgetNotPresent,
|
||||||
|
dataSource: currentQuery.builder.queryData?.[0]?.dataSource,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -481,7 +497,20 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onSaveDashboard = useCallback((): void => {
|
const onSaveDashboard = useCallback((): void => {
|
||||||
|
const widgetId = query.get('widgetId');
|
||||||
|
const selectWidget = widgets?.find((e) => e.id === widgetId);
|
||||||
|
|
||||||
|
logEvent('Panel Edit: Save changes', {
|
||||||
|
panelType: selectedWidget.panelTypes,
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
widgetId: selectedWidget.id,
|
||||||
|
dashboardName: selectedDashboard?.data.title,
|
||||||
|
queryType: currentQuery.queryType,
|
||||||
|
isNewPanel: isUndefined(selectWidget),
|
||||||
|
dataSource: currentQuery.builder.queryData?.[0]?.dataSource,
|
||||||
|
});
|
||||||
setSaveModal(true);
|
setSaveModal(true);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const isQueryBuilderActive = useIsFeatureDisabled(
|
const isQueryBuilderActive = useIsFeatureDisabled(
|
||||||
@@ -530,11 +559,39 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [onSaveDashboard]);
|
}, [onSaveDashboard]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedGraph === PANEL_TYPES.LIST) {
|
||||||
|
const initialDataSource = currentQuery.builder.queryData[0].dataSource;
|
||||||
|
if (initialDataSource === DataSource.LOGS) {
|
||||||
|
setRequestData((prev) => ({
|
||||||
|
...prev,
|
||||||
|
tableParams: {
|
||||||
|
...prev.tableParams,
|
||||||
|
selectColumns: selectedLogFields,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
} else if (initialDataSource === DataSource.TRACES) {
|
||||||
|
setRequestData((prev) => ({
|
||||||
|
...prev,
|
||||||
|
tableParams: {
|
||||||
|
...prev.tableParams,
|
||||||
|
selectColumns: selectedTracesFields,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [selectedLogFields, selectedTracesFields, currentQuery, selectedGraph]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<div className="edit-header">
|
<div className="edit-header">
|
||||||
<div className="left-header">
|
<div className="left-header">
|
||||||
<X size={14} onClick={onClickDiscardHandler} className="discard-icon" />
|
<X
|
||||||
|
size={14}
|
||||||
|
onClick={onClickDiscardHandler}
|
||||||
|
className="discard-icon"
|
||||||
|
data-testid="discard-button"
|
||||||
|
/>
|
||||||
<Flex align="center" gap={24}>
|
<Flex align="center" gap={24}>
|
||||||
<Typography.Text className="configure-panel">
|
<Typography.Text className="configure-panel">
|
||||||
Configure panel
|
Configure panel
|
||||||
@@ -586,60 +643,64 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
|
|||||||
|
|
||||||
<PanelContainer>
|
<PanelContainer>
|
||||||
<LeftContainerWrapper isDarkMode={useIsDarkMode()}>
|
<LeftContainerWrapper isDarkMode={useIsDarkMode()}>
|
||||||
{selectedWidget && (
|
<OverlayScrollbar>
|
||||||
<LeftContainer
|
{selectedWidget && (
|
||||||
selectedGraph={graphType}
|
<LeftContainer
|
||||||
selectedLogFields={selectedLogFields}
|
selectedGraph={graphType}
|
||||||
setSelectedLogFields={setSelectedLogFields}
|
selectedLogFields={selectedLogFields}
|
||||||
selectedTracesFields={selectedTracesFields}
|
setSelectedLogFields={setSelectedLogFields}
|
||||||
setSelectedTracesFields={setSelectedTracesFields}
|
selectedTracesFields={selectedTracesFields}
|
||||||
selectedWidget={selectedWidget}
|
setSelectedTracesFields={setSelectedTracesFields}
|
||||||
selectedTime={selectedTime}
|
selectedWidget={selectedWidget}
|
||||||
requestData={requestData}
|
selectedTime={selectedTime}
|
||||||
setRequestData={setRequestData}
|
requestData={requestData}
|
||||||
isLoadingPanelData={isLoadingPanelData}
|
setRequestData={setRequestData}
|
||||||
/>
|
isLoadingPanelData={isLoadingPanelData}
|
||||||
)}
|
/>
|
||||||
|
)}
|
||||||
|
</OverlayScrollbar>
|
||||||
</LeftContainerWrapper>
|
</LeftContainerWrapper>
|
||||||
|
|
||||||
<RightContainerWrapper>
|
<RightContainerWrapper>
|
||||||
<RightContainer
|
<OverlayScrollbar>
|
||||||
setGraphHandler={setGraphHandler}
|
<RightContainer
|
||||||
title={title}
|
setGraphHandler={setGraphHandler}
|
||||||
setTitle={setTitle}
|
title={title}
|
||||||
description={description}
|
setTitle={setTitle}
|
||||||
setDescription={setDescription}
|
description={description}
|
||||||
stacked={stacked}
|
setDescription={setDescription}
|
||||||
setStacked={setStacked}
|
stacked={stacked}
|
||||||
stackedBarChart={stackedBarChart}
|
setStacked={setStacked}
|
||||||
setStackedBarChart={setStackedBarChart}
|
stackedBarChart={stackedBarChart}
|
||||||
opacity={opacity}
|
setStackedBarChart={setStackedBarChart}
|
||||||
yAxisUnit={yAxisUnit}
|
opacity={opacity}
|
||||||
columnUnits={columnUnits}
|
yAxisUnit={yAxisUnit}
|
||||||
setColumnUnits={setColumnUnits}
|
columnUnits={columnUnits}
|
||||||
bucketCount={bucketCount}
|
setColumnUnits={setColumnUnits}
|
||||||
bucketWidth={bucketWidth}
|
bucketCount={bucketCount}
|
||||||
combineHistogram={combineHistogram}
|
bucketWidth={bucketWidth}
|
||||||
setCombineHistogram={setCombineHistogram}
|
combineHistogram={combineHistogram}
|
||||||
setBucketWidth={setBucketWidth}
|
setCombineHistogram={setCombineHistogram}
|
||||||
setBucketCount={setBucketCount}
|
setBucketWidth={setBucketWidth}
|
||||||
setOpacity={setOpacity}
|
setBucketCount={setBucketCount}
|
||||||
selectedNullZeroValue={selectedNullZeroValue}
|
setOpacity={setOpacity}
|
||||||
setSelectedNullZeroValue={setSelectedNullZeroValue}
|
selectedNullZeroValue={selectedNullZeroValue}
|
||||||
selectedGraph={graphType}
|
setSelectedNullZeroValue={setSelectedNullZeroValue}
|
||||||
setSelectedTime={setSelectedTime}
|
selectedGraph={graphType}
|
||||||
selectedTime={selectedTime}
|
setSelectedTime={setSelectedTime}
|
||||||
setYAxisUnit={setYAxisUnit}
|
selectedTime={selectedTime}
|
||||||
thresholds={thresholds}
|
setYAxisUnit={setYAxisUnit}
|
||||||
setThresholds={setThresholds}
|
thresholds={thresholds}
|
||||||
selectedWidget={selectedWidget}
|
setThresholds={setThresholds}
|
||||||
isFillSpans={isFillSpans}
|
selectedWidget={selectedWidget}
|
||||||
setIsFillSpans={setIsFillSpans}
|
isFillSpans={isFillSpans}
|
||||||
softMin={softMin}
|
setIsFillSpans={setIsFillSpans}
|
||||||
setSoftMin={setSoftMin}
|
softMin={softMin}
|
||||||
softMax={softMax}
|
setSoftMin={setSoftMin}
|
||||||
setSoftMax={setSoftMax}
|
softMax={softMax}
|
||||||
/>
|
setSoftMax={setSoftMax}
|
||||||
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
</RightContainerWrapper>
|
</RightContainerWrapper>
|
||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -72,6 +73,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -88,6 +90,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -107,6 +110,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -125,6 +129,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -141,6 +146,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -157,6 +163,8 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'having',
|
'having',
|
||||||
'orderBy',
|
'orderBy',
|
||||||
'functions',
|
'functions',
|
||||||
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -172,6 +180,8 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'orderBy',
|
'orderBy',
|
||||||
'functions',
|
'functions',
|
||||||
'spaceAggregation',
|
'spaceAggregation',
|
||||||
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -185,6 +195,8 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'limit',
|
'limit',
|
||||||
'having',
|
'having',
|
||||||
'orderBy',
|
'orderBy',
|
||||||
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -204,6 +216,8 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'reduceTo',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -222,6 +236,8 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'reduceTo',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -238,6 +254,8 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'reduceTo',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -257,6 +275,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -275,6 +294,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -291,6 +311,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -325,6 +346,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -341,6 +363,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -357,6 +380,7 @@ export const panelTypeDataSourceFormValuesMap: Record<
|
|||||||
'queryName',
|
'queryName',
|
||||||
'expression',
|
'expression',
|
||||||
'disabled',
|
'disabled',
|
||||||
|
'legend',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import './NoLogs.styles.scss';
|
import './NoLogs.styles.scss';
|
||||||
|
|
||||||
import { Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { ArrowUpRight } from 'lucide-react';
|
import { ArrowUpRight } from 'lucide-react';
|
||||||
@@ -21,6 +22,11 @@ export default function NoLogs({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
if (cloudUser) {
|
if (cloudUser) {
|
||||||
|
if (dataSource === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Explorer: Navigate to onboarding', {});
|
||||||
|
} else if (dataSource === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Explorer: Navigate to onboarding', {});
|
||||||
|
}
|
||||||
history.push(
|
history.push(
|
||||||
dataSource === 'traces'
|
dataSource === 'traces'
|
||||||
? ROUTES.GET_STARTED_APPLICATION_MONITORING
|
? ROUTES.GET_STARTED_APPLICATION_MONITORING
|
||||||
|
|||||||
@@ -3,11 +3,19 @@ import './styles.scss';
|
|||||||
import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
||||||
import { Card, Modal, Table, Typography } from 'antd';
|
import { Card, Modal, Table, Typography } from 'antd';
|
||||||
import { ExpandableConfig } from 'antd/es/table/interface';
|
import { ExpandableConfig } from 'antd/es/table/interface';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import savePipeline from 'api/pipeline/post';
|
import savePipeline from 'api/pipeline/post';
|
||||||
import useAnalytics from 'hooks/analytics/useAnalytics';
|
import useAnalytics from 'hooks/analytics/useAnalytics';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
|
import { isUndefined } from 'lodash-es';
|
||||||
import cloneDeep from 'lodash-es/cloneDeep';
|
import cloneDeep from 'lodash-es/cloneDeep';
|
||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
import { DndProvider } from 'react-dnd';
|
import { DndProvider } from 'react-dnd';
|
||||||
import { HTML5Backend } from 'react-dnd-html5-backend';
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -466,6 +474,16 @@ function PipelineListsView({
|
|||||||
getExpandIcon(expanded, onExpand, record),
|
getExpandIcon(expanded, onExpand, record),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current && !isUndefined(currPipelineData)) {
|
||||||
|
logEvent('Logs Pipelines: List page visited', {
|
||||||
|
number: currPipelineData?.length,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
}, [currPipelineData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
{contextHolder}
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ export const GroupByFilter = memo(function GroupByFilter({
|
|||||||
labelInValue
|
labelInValue
|
||||||
notFoundContent={isFetching ? <Spin size="small" /> : null}
|
notFoundContent={isFetching ? <Spin size="small" /> : null}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
data-testid="group-by"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export const ReduceToFilter = memo(function ReduceToFilter({
|
|||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
options={REDUCE_TO_VALUES}
|
options={REDUCE_TO_VALUES}
|
||||||
value={currentValue}
|
value={currentValue}
|
||||||
|
data-testid="reduce-to"
|
||||||
labelInValue
|
labelInValue
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import localStorageGet from 'api/browser/localstorage/get';
|
import localStorageGet from 'api/browser/localstorage/get';
|
||||||
import localStorageSet from 'api/browser/localstorage/set';
|
import localStorageSet from 'api/browser/localstorage/set';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { SKIP_ONBOARDING } from 'constants/onboarding';
|
import { SKIP_ONBOARDING } from 'constants/onboarding';
|
||||||
import useErrorNotification from 'hooks/useErrorNotification';
|
import useErrorNotification from 'hooks/useErrorNotification';
|
||||||
import { useQueryService } from 'hooks/useQueryService';
|
import { useQueryService } from 'hooks/useQueryService';
|
||||||
import useResourceAttribute from 'hooks/useResourceAttribute';
|
import useResourceAttribute from 'hooks/useResourceAttribute';
|
||||||
import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils';
|
import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils';
|
||||||
import { useMemo, useState } from 'react';
|
import { isUndefined } from 'lodash-es';
|
||||||
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
@@ -45,6 +47,26 @@ function ServiceTraces(): JSX.Element {
|
|||||||
setSkipOnboarding(true);
|
setSkipOnboarding(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current && !isUndefined(data)) {
|
||||||
|
const selectedEnvironments = queries.find(
|
||||||
|
(val) => val.tagKey === 'resource_deployment_environment',
|
||||||
|
)?.tagValue;
|
||||||
|
|
||||||
|
const rps = data.reduce((total, service) => total + service.callRate, 0);
|
||||||
|
|
||||||
|
logEvent('APM: List page visited', {
|
||||||
|
numberOfServices: data?.length,
|
||||||
|
selectedEnvironments,
|
||||||
|
resourceAttributeUsed: !!queries.length,
|
||||||
|
rps,
|
||||||
|
});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
services.length === 0 &&
|
services.length === 0 &&
|
||||||
isLoading === false &&
|
isLoading === false &&
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import './SideNav.styles.scss';
|
|||||||
|
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import { Button, Tooltip } from 'antd';
|
import { Button, Tooltip } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { FeatureKeys } from 'constants/features';
|
import { FeatureKeys } from 'constants/features';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
@@ -179,6 +180,11 @@ function SideNav({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClickShortcuts = (e: MouseEvent): void => {
|
const onClickShortcuts = (e: MouseEvent): void => {
|
||||||
|
// eslint-disable-next-line sonarjs/no-duplicate-string
|
||||||
|
logEvent('Sidebar: Menu clicked', {
|
||||||
|
menuRoute: '/shortcuts',
|
||||||
|
menuLabel: 'Keyboard Shortcuts',
|
||||||
|
});
|
||||||
if (isCtrlMetaKey(e)) {
|
if (isCtrlMetaKey(e)) {
|
||||||
openInNewTab('/shortcuts');
|
openInNewTab('/shortcuts');
|
||||||
} else {
|
} else {
|
||||||
@@ -187,6 +193,10 @@ function SideNav({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClickGetStarted = (event: MouseEvent): void => {
|
const onClickGetStarted = (event: MouseEvent): void => {
|
||||||
|
logEvent('Sidebar: Menu clicked', {
|
||||||
|
menuRoute: '/get-started',
|
||||||
|
menuLabel: 'Get Started',
|
||||||
|
});
|
||||||
if (isCtrlMetaKey(event)) {
|
if (isCtrlMetaKey(event)) {
|
||||||
openInNewTab('/get-started');
|
openInNewTab('/get-started');
|
||||||
} else {
|
} else {
|
||||||
@@ -313,6 +323,10 @@ function SideNav({
|
|||||||
} else if (item) {
|
} else if (item) {
|
||||||
onClickHandler(item?.key as string, event);
|
onClickHandler(item?.key as string, event);
|
||||||
}
|
}
|
||||||
|
logEvent('Sidebar: Menu clicked', {
|
||||||
|
menuRoute: item.key,
|
||||||
|
menuLabel: item.label,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -440,6 +454,10 @@ function SideNav({
|
|||||||
isActive={activeMenuKey === item?.key}
|
isActive={activeMenuKey === item?.key}
|
||||||
onClick={(event: MouseEvent): void => {
|
onClick={(event: MouseEvent): void => {
|
||||||
handleUserManagentMenuItemClick(item?.key as string, event);
|
handleUserManagentMenuItemClick(item?.key as string, event);
|
||||||
|
logEvent('Sidebar: Menu clicked', {
|
||||||
|
menuRoute: item.key,
|
||||||
|
menuLabel: item.label,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -456,6 +474,10 @@ function SideNav({
|
|||||||
} else {
|
} else {
|
||||||
history.push(`${inviteMemberMenuItem.key}`);
|
history.push(`${inviteMemberMenuItem.key}`);
|
||||||
}
|
}
|
||||||
|
logEvent('Sidebar: Menu clicked', {
|
||||||
|
menuRoute: inviteMemberMenuItem.key,
|
||||||
|
menuLabel: inviteMemberMenuItem.label,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -470,6 +492,10 @@ function SideNav({
|
|||||||
userSettingsMenuItem?.key as string,
|
userSettingsMenuItem?.key as string,
|
||||||
event,
|
event,
|
||||||
);
|
);
|
||||||
|
logEvent('Sidebar: Menu clicked', {
|
||||||
|
menuRoute: userSettingsMenuItem.key,
|
||||||
|
menuLabel: 'User',
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -155,7 +155,9 @@ function TimeSeriesView({
|
|||||||
chartData[0]?.length === 0 &&
|
chartData[0]?.length === 0 &&
|
||||||
!isLoading &&
|
!isLoading &&
|
||||||
!isError &&
|
!isError &&
|
||||||
isFilterApplied && <EmptyLogsSearch />}
|
isFilterApplied && (
|
||||||
|
<EmptyLogsSearch dataSource={dataSource} panelType="TIME_SERIES" />
|
||||||
|
)}
|
||||||
|
|
||||||
{chartData &&
|
{chartData &&
|
||||||
chartData[0] &&
|
chartData[0] &&
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Modal, Tabs, Typography } from 'antd';
|
import { Button, Modal, Tabs, Tooltip, Typography } from 'antd';
|
||||||
import Editor from 'components/Editor';
|
import Editor from 'components/Editor';
|
||||||
import { StyledSpace } from 'components/Styled';
|
import { StyledSpace } from 'components/Styled';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
@@ -102,8 +102,7 @@ function SelectedSpanDetails(props: SelectedSpanDetailsProps): JSX.Element {
|
|||||||
marginTop: '16px',
|
marginTop: '16px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{' '}
|
Details for selected Span
|
||||||
Details for selected Span{' '}
|
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
|
|
||||||
<Typography.Text style={{ fontWeight: 700 }}>Service</Typography.Text>
|
<Typography.Text style={{ fontWeight: 700 }}>Service</Typography.Text>
|
||||||
@@ -114,6 +113,30 @@ function SelectedSpanDetails(props: SelectedSpanDetailsProps): JSX.Element {
|
|||||||
|
|
||||||
<Typography>{tree.name}</Typography>
|
<Typography>{tree.name}</Typography>
|
||||||
|
|
||||||
|
<Typography.Text style={{ fontWeight: 700 }}>SpanKind</Typography.Text>
|
||||||
|
|
||||||
|
<Typography>{tree.spanKind}</Typography>
|
||||||
|
|
||||||
|
<Typography.Text style={{ fontWeight: 700 }}>
|
||||||
|
StatusCodeString
|
||||||
|
</Typography.Text>
|
||||||
|
|
||||||
|
<Tooltip placement="left" title={tree.statusCodeString}>
|
||||||
|
<Typography>{tree.statusCodeString}</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
{tree.statusMessage && (
|
||||||
|
<>
|
||||||
|
<Typography.Text style={{ fontWeight: 700 }}>
|
||||||
|
StatusMessage
|
||||||
|
</Typography.Text>
|
||||||
|
|
||||||
|
<Tooltip placement="left" title={tree.statusMessage}>
|
||||||
|
<Typography>{tree.statusMessage}</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<Button size="small" style={{ marginTop: '8px' }} onClick={onLogsHandler}>
|
<Button size="small" style={{ marginTop: '8px' }} onClick={onLogsHandler}>
|
||||||
Go to Related logs
|
Go to Related logs
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ describe('traces/getTreeLevelsCount', () => {
|
|||||||
children,
|
children,
|
||||||
serviceName: '',
|
serviceName: '',
|
||||||
serviceColour: '',
|
serviceColour: '',
|
||||||
|
spanKind: '',
|
||||||
|
statusCodeString: '',
|
||||||
|
statusMessage: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return 0 for empty tree', () => {
|
test('should return 0 for empty tree', () => {
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ test('loads and displays greeting', () => {
|
|||||||
event: [],
|
event: [],
|
||||||
hasError: false,
|
hasError: false,
|
||||||
parent: undefined,
|
parent: undefined,
|
||||||
|
spanKind: '',
|
||||||
|
statusCodeString: '',
|
||||||
|
statusMessage: '',
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -156,7 +156,9 @@ function ListView({ isFilterApplied }: ListViewProps): JSX.Element {
|
|||||||
<NoLogs dataSource={DataSource.TRACES} />
|
<NoLogs dataSource={DataSource.TRACES} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isDataPresent && isFilterApplied && <EmptyLogsSearch />}
|
{isDataPresent && isFilterApplied && (
|
||||||
|
<EmptyLogsSearch dataSource={DataSource.TRACES} panelType="LIST" />
|
||||||
|
)}
|
||||||
|
|
||||||
{!isError && transformedQueryTableData.length !== 0 && (
|
{!isError && transformedQueryTableData.length !== 0 && (
|
||||||
<ResizeTable
|
<ResizeTable
|
||||||
|
|||||||
@@ -105,7 +105,9 @@ function TracesView({ isFilterApplied }: TracesViewProps): JSX.Element {
|
|||||||
!isFetching &&
|
!isFetching &&
|
||||||
(tableData || []).length === 0 &&
|
(tableData || []).length === 0 &&
|
||||||
!isError &&
|
!isError &&
|
||||||
isFilterApplied && <EmptyLogsSearch />}
|
isFilterApplied && (
|
||||||
|
<EmptyLogsSearch dataSource={DataSource.TRACES} panelType="TRACE" />
|
||||||
|
)}
|
||||||
|
|
||||||
{(tableData || []).length !== 0 && (
|
{(tableData || []).length !== 0 && (
|
||||||
<ResizeTable
|
<ResizeTable
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import './TracesTableComponent.styles.scss';
|
import './TracesTableComponent.styles.scss';
|
||||||
|
|
||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
|
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import Controls from 'container/Controls';
|
import Controls from 'container/Controls';
|
||||||
import { PER_PAGE_OPTIONS } from 'container/TracesExplorer/ListView/configs';
|
import { PER_PAGE_OPTIONS } from 'container/TracesExplorer/ListView/configs';
|
||||||
@@ -42,6 +43,7 @@ function TracesTableComponent({
|
|||||||
setRequestData((prev) => ({
|
setRequestData((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
tableParams: {
|
tableParams: {
|
||||||
|
...prev.tableParams,
|
||||||
pagination,
|
pagination,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
@@ -86,17 +88,19 @@ function TracesTableComponent({
|
|||||||
return (
|
return (
|
||||||
<div className="traces-table">
|
<div className="traces-table">
|
||||||
<div className="resize-table">
|
<div className="resize-table">
|
||||||
<Table
|
<OverlayScrollbar>
|
||||||
pagination={false}
|
<Table
|
||||||
tableLayout="fixed"
|
pagination={false}
|
||||||
scroll={{ x: true }}
|
tableLayout="fixed"
|
||||||
loading={queryResponse.isFetching}
|
scroll={{ x: true }}
|
||||||
style={tableStyles}
|
loading={queryResponse.isFetching}
|
||||||
dataSource={transformedQueryTableData}
|
style={tableStyles}
|
||||||
columns={columns}
|
dataSource={transformedQueryTableData}
|
||||||
onRow={handleRow}
|
columns={columns}
|
||||||
sticky
|
onRow={handleRow}
|
||||||
/>
|
sticky
|
||||||
|
/>
|
||||||
|
</OverlayScrollbar>
|
||||||
</div>
|
</div>
|
||||||
<div className="controller">
|
<div className="controller">
|
||||||
<Controls
|
<Controls
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { getQueryRangeFormat } from 'api/dashboard/queryRangeFormat';
|
import { getQueryRangeFormat } from 'api/dashboard/queryRangeFormat';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
import { MenuItemKeys } from 'container/GridCardLayout/WidgetHeader/contants';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import { getDashboardVariables } from 'lib/dashbaordVariables/getDashboardVariables';
|
import { getDashboardVariables } from 'lib/dashbaordVariables/getDashboardVariables';
|
||||||
import { prepareQueryRangePayload } from 'lib/dashboard/prepareQueryRangePayload';
|
import { prepareQueryRangePayload } from 'lib/dashboard/prepareQueryRangePayload';
|
||||||
@@ -17,7 +19,7 @@ import { Widgets } from 'types/api/dashboard/getAll';
|
|||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
import { getGraphType } from 'utils/getGraphType';
|
import { getGraphType } from 'utils/getGraphType';
|
||||||
|
|
||||||
const useCreateAlerts = (widget?: Widgets): VoidFunction => {
|
const useCreateAlerts = (widget?: Widgets, caller?: string): VoidFunction => {
|
||||||
const queryRangeMutation = useMutation(getQueryRangeFormat);
|
const queryRangeMutation = useMutation(getQueryRangeFormat);
|
||||||
|
|
||||||
const { selectedTime: globalSelectedInterval } = useSelector<
|
const { selectedTime: globalSelectedInterval } = useSelector<
|
||||||
@@ -32,6 +34,24 @@ const useCreateAlerts = (widget?: Widgets): VoidFunction => {
|
|||||||
return useCallback(() => {
|
return useCallback(() => {
|
||||||
if (!widget) return;
|
if (!widget) return;
|
||||||
|
|
||||||
|
if (caller === 'panelView') {
|
||||||
|
logEvent('Panel Edit: Create alert', {
|
||||||
|
panelType: widget.panelTypes,
|
||||||
|
dashboardName: selectedDashboard?.data?.title,
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
widgetId: widget.id,
|
||||||
|
queryType: widget.query.queryType,
|
||||||
|
});
|
||||||
|
} else if (caller === 'dashboardView') {
|
||||||
|
logEvent('Dashboard Detail: Panel action', {
|
||||||
|
action: MenuItemKeys.CreateAlerts,
|
||||||
|
panelType: widget.panelTypes,
|
||||||
|
dashboardName: selectedDashboard?.data?.title,
|
||||||
|
dashboardId: selectedDashboard?.uuid,
|
||||||
|
widgetId: widget.id,
|
||||||
|
queryType: widget.query.queryType,
|
||||||
|
});
|
||||||
|
}
|
||||||
const { queryPayload } = prepareQueryRangePayload({
|
const { queryPayload } = prepareQueryRangePayload({
|
||||||
query: widget.query,
|
query: widget.query,
|
||||||
globalSelectedInterval,
|
globalSelectedInterval,
|
||||||
@@ -57,6 +77,7 @@ const useCreateAlerts = (widget?: Widgets): VoidFunction => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [
|
}, [
|
||||||
globalSelectedInterval,
|
globalSelectedInterval,
|
||||||
notifications,
|
notifications,
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { PartialOptions } from 'overlayscrollbars';
|
||||||
|
import { useOverlayScrollbars } from 'overlayscrollbars-react';
|
||||||
|
import {
|
||||||
|
Dispatch,
|
||||||
|
RefObject,
|
||||||
|
SetStateAction,
|
||||||
|
useEffect,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
|
|
||||||
|
const useInitializeOverlayScrollbar = (
|
||||||
|
options: PartialOptions,
|
||||||
|
): {
|
||||||
|
setScroller: Dispatch<SetStateAction<null>>;
|
||||||
|
rootRef: RefObject<HTMLDivElement>;
|
||||||
|
} => {
|
||||||
|
const rootRef = useRef(null);
|
||||||
|
const [scroller, setScroller] = useState(null);
|
||||||
|
const [initialize, osInstance] = useOverlayScrollbars({
|
||||||
|
defer: true,
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const { current: root } = rootRef;
|
||||||
|
|
||||||
|
if (scroller && root) {
|
||||||
|
initialize({
|
||||||
|
target: root,
|
||||||
|
elements: {
|
||||||
|
viewport: scroller,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (): void => osInstance()?.destroy();
|
||||||
|
}, [scroller, initialize, osInstance]);
|
||||||
|
|
||||||
|
return { setScroller, rootRef };
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useInitializeOverlayScrollbar;
|
||||||
@@ -16,6 +16,9 @@ const spans: Span[] = [
|
|||||||
[''],
|
[''],
|
||||||
[''],
|
[''],
|
||||||
false,
|
false,
|
||||||
|
'Server',
|
||||||
|
'Unset',
|
||||||
|
'Lorem Ipsum',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
2,
|
2,
|
||||||
@@ -30,6 +33,9 @@ const spans: Span[] = [
|
|||||||
[''],
|
[''],
|
||||||
[''],
|
[''],
|
||||||
false,
|
false,
|
||||||
|
'Server2',
|
||||||
|
'Unset2',
|
||||||
|
'Lorem Ipsum2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
3,
|
3,
|
||||||
@@ -44,6 +50,9 @@ const spans: Span[] = [
|
|||||||
[''],
|
[''],
|
||||||
[''],
|
[''],
|
||||||
false,
|
false,
|
||||||
|
'Server3',
|
||||||
|
'Unset3',
|
||||||
|
'Lorem Ipsum3',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
TableProps,
|
TableProps,
|
||||||
Typography,
|
Typography,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import {
|
import {
|
||||||
getViewDetailsUsingViewKey,
|
getViewDetailsUsingViewKey,
|
||||||
showErrorNotification,
|
showErrorNotification,
|
||||||
@@ -30,7 +31,7 @@ import {
|
|||||||
Trash2,
|
Trash2,
|
||||||
X,
|
X,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { ChangeEvent, useEffect, useState } from 'react';
|
import { ChangeEvent, useEffect, useRef, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
@@ -143,6 +144,22 @@ function SaveView(): JSX.Element {
|
|||||||
viewName: newViewName,
|
viewName: newViewName,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current && !isLoading) {
|
||||||
|
if (sourcepage === DataSource.TRACES) {
|
||||||
|
logEvent('Traces Views: Views visited', {
|
||||||
|
number: viewsData?.data.data.length,
|
||||||
|
});
|
||||||
|
} else if (sourcepage === DataSource.LOGS) {
|
||||||
|
logEvent('Logs Views: Views visited', {
|
||||||
|
number: viewsData?.data.data.length,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [viewsData?.data.data, isLoading]);
|
||||||
const onUpdateQueryHandler = (): void => {
|
const onUpdateQueryHandler = (): void => {
|
||||||
updateViewAsync(
|
updateViewAsync(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
VerticalAlignTopOutlined,
|
VerticalAlignTopOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { Button, Flex, Tooltip, Typography } from 'antd';
|
import { Button, Flex, Tooltip, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { getMs } from 'container/Trace/Filters/Panel/PanelBody/Duration/util';
|
import { getMs } from 'container/Trace/Filters/Panel/PanelBody/Duration/util';
|
||||||
import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam';
|
import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam';
|
||||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||||
@@ -197,6 +198,11 @@ export function Filter(props: FilterProps): JSX.Element {
|
|||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if (selectedFilters) {
|
||||||
|
logEvent('Traces Explorer: Sidebar filter used', {
|
||||||
|
selectedFilters,
|
||||||
|
});
|
||||||
|
}
|
||||||
redirectWithQueryBuilderData(preparedQuery);
|
redirectWithQueryBuilderData(preparedQuery);
|
||||||
},
|
},
|
||||||
[currentQuery, redirectWithQueryBuilderData, selectedFilters],
|
[currentQuery, redirectWithQueryBuilderData, selectedFilters],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import './TracesExplorer.styles.scss';
|
|||||||
import { FilterOutlined } from '@ant-design/icons';
|
import { FilterOutlined } from '@ant-design/icons';
|
||||||
import * as Sentry from '@sentry/react';
|
import * as Sentry from '@sentry/react';
|
||||||
import { Button, Card, Tabs, Tooltip } from 'antd';
|
import { Button, Card, Tabs, Tooltip } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import ExplorerCard from 'components/ExplorerCard/ExplorerCard';
|
import ExplorerCard from 'components/ExplorerCard/ExplorerCard';
|
||||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
@@ -25,7 +26,7 @@ import { useNotifications } from 'hooks/useNotifications';
|
|||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { cloneDeep, isEmpty, set } from 'lodash-es';
|
import { cloneDeep, isEmpty, set } from 'lodash-es';
|
||||||
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
|
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Dashboard } from 'types/api/dashboard/getAll';
|
import { Dashboard } from 'types/api/dashboard/getAll';
|
||||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { DataSource } from 'types/common/queryBuilder';
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
@@ -135,7 +136,7 @@ function TracesExplorer(): JSX.Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleExport = useCallback(
|
const handleExport = useCallback(
|
||||||
(dashboard: Dashboard | null): void => {
|
(dashboard: Dashboard | null, isNewDashboard?: boolean): void => {
|
||||||
if (!dashboard || !panelType) return;
|
if (!dashboard || !panelType) return;
|
||||||
|
|
||||||
const panelTypeParam = AVAILABLE_EXPORT_PANEL_TYPES.includes(panelType)
|
const panelTypeParam = AVAILABLE_EXPORT_PANEL_TYPES.includes(panelType)
|
||||||
@@ -157,6 +158,12 @@ function TracesExplorer(): JSX.Element {
|
|||||||
options.selectColumns,
|
options.selectColumns,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
logEvent('Traces Explorer: Add to dashboard successful', {
|
||||||
|
panelType,
|
||||||
|
isNewDashboard,
|
||||||
|
dashboardName: dashboard?.data?.title,
|
||||||
|
});
|
||||||
|
|
||||||
updateDashboard(updatedDashboard, {
|
updateDashboard(updatedDashboard, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
@@ -223,6 +230,13 @@ function TracesExplorer(): JSX.Element {
|
|||||||
currentPanelType,
|
currentPanelType,
|
||||||
]);
|
]);
|
||||||
const [isOpen, setOpen] = useState<boolean>(true);
|
const [isOpen, setOpen] = useState<boolean>(true);
|
||||||
|
const logEventCalledRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!logEventCalledRef.current) {
|
||||||
|
logEvent('Traces Explorer: Page visited', {});
|
||||||
|
logEventCalledRef.current = true;
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
|
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@import '@signozhq/design-tokens/dist/style.css';
|
@import '@signozhq/design-tokens/dist/style.css';
|
||||||
|
@import 'overlayscrollbars/overlayscrollbars.css';
|
||||||
|
|
||||||
@import './periscope.scss';
|
@import './periscope.scss';
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export type Span = [
|
|||||||
string[],
|
string[],
|
||||||
string[],
|
string[],
|
||||||
boolean,
|
boolean,
|
||||||
|
string,
|
||||||
|
string,
|
||||||
|
string,
|
||||||
];
|
];
|
||||||
|
|
||||||
export interface ITraceTree {
|
export interface ITraceTree {
|
||||||
@@ -49,6 +52,9 @@ export interface ITraceTree {
|
|||||||
hasError?: boolean;
|
hasError?: boolean;
|
||||||
event?: ITraceEvents[];
|
event?: ITraceEvents[];
|
||||||
isMissing?: boolean;
|
isMissing?: boolean;
|
||||||
|
spanKind: string;
|
||||||
|
statusCodeString: string;
|
||||||
|
statusMessage: string;
|
||||||
childReferences?: Record<string, string>[];
|
childReferences?: Record<string, string>[];
|
||||||
nonChildReferences?: Record<string, string>[];
|
nonChildReferences?: Record<string, string>[];
|
||||||
// For internal use
|
// For internal use
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ Object {
|
|||||||
"nonChildReferences": Array [],
|
"nonChildReferences": Array [],
|
||||||
"serviceColour": "",
|
"serviceColour": "",
|
||||||
"serviceName": "frontend",
|
"serviceName": "frontend",
|
||||||
|
"spanKind": "Lorem Ipsum2",
|
||||||
"startTime": 1657275433246,
|
"startTime": 1657275433246,
|
||||||
|
"statusCodeString": "Unset2",
|
||||||
|
"statusMessage": "Server2",
|
||||||
"tags": Array [
|
"tags": Array [
|
||||||
Object {
|
Object {
|
||||||
"key": "host.name.span3",
|
"key": "host.name.span3",
|
||||||
@@ -78,7 +81,10 @@ Object {
|
|||||||
"nonChildReferences": Array [],
|
"nonChildReferences": Array [],
|
||||||
"serviceColour": "",
|
"serviceColour": "",
|
||||||
"serviceName": "frontend",
|
"serviceName": "frontend",
|
||||||
|
"spanKind": "Lorem Ipsum1",
|
||||||
"startTime": 1657275433246,
|
"startTime": 1657275433246,
|
||||||
|
"statusCodeString": "Unset1",
|
||||||
|
"statusMessage": "Server1",
|
||||||
"tags": Array [
|
"tags": Array [
|
||||||
Object {
|
Object {
|
||||||
"key": "host.name.span2",
|
"key": "host.name.span2",
|
||||||
@@ -106,7 +112,10 @@ Object {
|
|||||||
"nonChildReferences": Array [],
|
"nonChildReferences": Array [],
|
||||||
"serviceColour": "",
|
"serviceColour": "",
|
||||||
"serviceName": "frontend",
|
"serviceName": "frontend",
|
||||||
|
"spanKind": "Lorem Ipsum",
|
||||||
"startTime": 1657275433246,
|
"startTime": 1657275433246,
|
||||||
|
"statusCodeString": "Unset",
|
||||||
|
"statusMessage": "Server",
|
||||||
"tags": Array [
|
"tags": Array [
|
||||||
Object {
|
Object {
|
||||||
"key": "host.name.span1",
|
"key": "host.name.span1",
|
||||||
@@ -152,7 +161,10 @@ Object {
|
|||||||
"nonChildReferences": Array [],
|
"nonChildReferences": Array [],
|
||||||
"serviceColour": "",
|
"serviceColour": "",
|
||||||
"serviceName": "frontend",
|
"serviceName": "frontend",
|
||||||
|
"spanKind": "Lorem Ipsum2",
|
||||||
"startTime": 1657275433246,
|
"startTime": 1657275433246,
|
||||||
|
"statusCodeString": "Unset2",
|
||||||
|
"statusMessage": "Server2",
|
||||||
"tags": Array [
|
"tags": Array [
|
||||||
Object {
|
Object {
|
||||||
"key": "host.name.span3",
|
"key": "host.name.span3",
|
||||||
@@ -168,7 +180,10 @@ Object {
|
|||||||
"name": "Missing Span (span_2)",
|
"name": "Missing Span (span_2)",
|
||||||
"serviceColour": "",
|
"serviceColour": "",
|
||||||
"serviceName": "",
|
"serviceName": "",
|
||||||
|
"spanKind": "",
|
||||||
"startTime": null,
|
"startTime": null,
|
||||||
|
"statusCodeString": "",
|
||||||
|
"statusMessage": "",
|
||||||
"tags": Array [],
|
"tags": Array [],
|
||||||
"time": null,
|
"time": null,
|
||||||
"value": null,
|
"value": null,
|
||||||
@@ -201,7 +216,10 @@ Object {
|
|||||||
"nonChildReferences": Array [],
|
"nonChildReferences": Array [],
|
||||||
"serviceColour": "",
|
"serviceColour": "",
|
||||||
"serviceName": "frontend",
|
"serviceName": "frontend",
|
||||||
|
"spanKind": "Lorem Ipsum",
|
||||||
"startTime": 1657275433246,
|
"startTime": 1657275433246,
|
||||||
|
"statusCodeString": "Unset",
|
||||||
|
"statusMessage": "Server",
|
||||||
"tags": Array [
|
"tags": Array [
|
||||||
Object {
|
Object {
|
||||||
"key": "host.name.span1",
|
"key": "host.name.span1",
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ export const TraceData: Span[] = [
|
|||||||
'{"timeUnixNano":1657275433246142000,"attributeMap":{"event":"HTTP request received S1","level":"info","method":"GET","url":"/dispatch?customer=392\\u0026nonse=0.015296363321630757"}}',
|
'{"timeUnixNano":1657275433246142000,"attributeMap":{"event":"HTTP request received S1","level":"info","method":"GET","url":"/dispatch?customer=392\\u0026nonse=0.015296363321630757"}}',
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
|
'Server',
|
||||||
|
'Unset',
|
||||||
|
'Lorem Ipsum',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1657275433246,
|
1657275433246,
|
||||||
@@ -32,6 +35,9 @@ export const TraceData: Span[] = [
|
|||||||
'{"timeUnixNano":1657275433246142000,"attributeMap":{"event":"HTTP request received S2","level":"info","method":"GET","url":"/dispatch?customer=392\\u0026nonse=0.015296363321630757"}}',
|
'{"timeUnixNano":1657275433246142000,"attributeMap":{"event":"HTTP request received S2","level":"info","method":"GET","url":"/dispatch?customer=392\\u0026nonse=0.015296363321630757"}}',
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
|
'Server1',
|
||||||
|
'Unset1',
|
||||||
|
'Lorem Ipsum1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1657275433246,
|
1657275433246,
|
||||||
@@ -48,5 +54,8 @@ export const TraceData: Span[] = [
|
|||||||
'{"timeUnixNano":1657275433246142000,"attributeMap":{"event":"HTTP request received S3","level":"info","method":"GET","url":"/dispatch?customer=392\\u0026nonse=0.015296363321630757"}}',
|
'{"timeUnixNano":1657275433246142000,"attributeMap":{"event":"HTTP request received S3","level":"info","method":"GET","url":"/dispatch?customer=392\\u0026nonse=0.015296363321630757"}}',
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
|
'Server2',
|
||||||
|
'Unset2',
|
||||||
|
'Lorem Ipsum2',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ export const spanToTreeUtil = (inputSpanList: Span[]): ITraceForest => {
|
|||||||
time: null as never,
|
time: null as never,
|
||||||
value: null as never,
|
value: null as never,
|
||||||
isMissing: true,
|
isMissing: true,
|
||||||
|
statusMessage: '',
|
||||||
|
statusCodeString: '',
|
||||||
|
spanKind: '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -93,6 +96,9 @@ export const spanToTreeUtil = (inputSpanList: Span[]): ITraceForest => {
|
|||||||
event: span[10]?.map((e) => JSON.parse(e || '{}') || {}),
|
event: span[10]?.map((e) => JSON.parse(e || '{}') || {}),
|
||||||
childReferences,
|
childReferences,
|
||||||
nonChildReferences,
|
nonChildReferences,
|
||||||
|
statusMessage: span[12],
|
||||||
|
statusCodeString: span[13],
|
||||||
|
spanKind: span[14],
|
||||||
};
|
};
|
||||||
spanMap[span[1]] = spanObject;
|
spanMap[span[1]] = spanObject;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13028,6 +13028,16 @@ outvariant@^1.2.1, outvariant@^1.4.0:
|
|||||||
resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.0.tgz#e742e4bda77692da3eca698ef5bfac62d9fba06e"
|
resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.0.tgz#e742e4bda77692da3eca698ef5bfac62d9fba06e"
|
||||||
integrity sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==
|
integrity sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==
|
||||||
|
|
||||||
|
overlayscrollbars-react@^0.5.6:
|
||||||
|
version "0.5.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/overlayscrollbars-react/-/overlayscrollbars-react-0.5.6.tgz#e9779f9fc2c1a3288570a45c83f8e42518bfb8c1"
|
||||||
|
integrity sha512-E5To04bL5brn9GVCZ36SnfGanxa2I2MDkWoa4Cjo5wol7l+diAgi4DBc983V7l2nOk/OLJ6Feg4kySspQEGDBw==
|
||||||
|
|
||||||
|
overlayscrollbars@^2.8.1:
|
||||||
|
version "2.9.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/overlayscrollbars/-/overlayscrollbars-2.9.2.tgz#056020a3811742b58b754fab6f775d49bd109be9"
|
||||||
|
integrity sha512-iDT84r39i7oWP72diZN2mbJUsn/taCq568aQaIrc84S87PunBT7qtsVltAF2esk7ORTRjQDnfjVYoqqTzgs8QA==
|
||||||
|
|
||||||
p-limit@^2.2.0:
|
p-limit@^2.2.0:
|
||||||
version "2.3.0"
|
version "2.3.0"
|
||||||
resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz"
|
resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz"
|
||||||
@@ -14678,7 +14688,7 @@ react-use@17.4.0, react-use@^17.3.2:
|
|||||||
|
|
||||||
react-virtuoso@4.0.3:
|
react-virtuoso@4.0.3:
|
||||||
version "4.0.3"
|
version "4.0.3"
|
||||||
resolved "https://registry.npmjs.org/react-virtuoso/-/react-virtuoso-4.0.3.tgz"
|
resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-4.0.3.tgz#0dc8b10978095852d985b064157639b9fb9d9b1e"
|
||||||
integrity sha512-tyqt8FBWxO+smve/kUgJbhCI2MEOvH2hHgFYPKWBMA2cJmV+cHIDDh1BL/6w4pg/dcCdlHCNVwi6aiztPxWttw==
|
integrity sha512-tyqt8FBWxO+smve/kUgJbhCI2MEOvH2hHgFYPKWBMA2cJmV+cHIDDh1BL/6w4pg/dcCdlHCNVwi6aiztPxWttw==
|
||||||
|
|
||||||
react@18.2.0:
|
react@18.2.0:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func prepareLogsQuery(ctx context.Context,
|
func prepareLogsQuery(_ context.Context,
|
||||||
start,
|
start,
|
||||||
end int64,
|
end int64,
|
||||||
builderQuery *v3.BuilderQuery,
|
builderQuery *v3.BuilderQuery,
|
||||||
|
|||||||
@@ -50,8 +50,10 @@ type querier struct {
|
|||||||
// TODO(srikanthccv): remove this once we have a proper mock
|
// TODO(srikanthccv): remove this once we have a proper mock
|
||||||
testingMode bool
|
testingMode bool
|
||||||
queriesExecuted []string
|
queriesExecuted []string
|
||||||
returnedSeries []*v3.Series
|
// tuple of start and end time in milliseconds
|
||||||
returnedErr error
|
timeRanges [][]int
|
||||||
|
returnedSeries []*v3.Series
|
||||||
|
returnedErr error
|
||||||
}
|
}
|
||||||
|
|
||||||
type QuerierOptions struct {
|
type QuerierOptions struct {
|
||||||
@@ -117,6 +119,7 @@ func (q *querier) execClickHouseQuery(ctx context.Context, query string) ([]*v3.
|
|||||||
func (q *querier) execPromQuery(ctx context.Context, params *model.QueryRangeParams) ([]*v3.Series, error) {
|
func (q *querier) execPromQuery(ctx context.Context, params *model.QueryRangeParams) ([]*v3.Series, error) {
|
||||||
q.queriesExecuted = append(q.queriesExecuted, params.Query)
|
q.queriesExecuted = append(q.queriesExecuted, params.Query)
|
||||||
if q.testingMode && q.reader == nil {
|
if q.testingMode && q.reader == nil {
|
||||||
|
q.timeRanges = append(q.timeRanges, []int{int(params.Start.UnixMilli()), int(params.End.UnixMilli())})
|
||||||
return q.returnedSeries, q.returnedErr
|
return q.returnedSeries, q.returnedErr
|
||||||
}
|
}
|
||||||
promResult, _, err := q.reader.GetQueryRangeResult(ctx, params)
|
promResult, _, err := q.reader.GetQueryRangeResult(ctx, params)
|
||||||
@@ -342,10 +345,10 @@ func (q *querier) runPromQueries(ctx context.Context, params *v3.QueryRangeParam
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(queryName string, promQuery *v3.PromQuery) {
|
go func(queryName string, promQuery *v3.PromQuery) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
cacheKey := cacheKeys[queryName]
|
cacheKey, ok := cacheKeys[queryName]
|
||||||
var cachedData []byte
|
var cachedData []byte
|
||||||
// Ensure NoCache is not set and cache is not nil
|
// Ensure NoCache is not set and cache is not nil
|
||||||
if !params.NoCache && q.cache != nil {
|
if !params.NoCache && q.cache != nil && ok {
|
||||||
data, retrieveStatus, err := q.cache.Retrieve(cacheKey, true)
|
data, retrieveStatus, err := q.cache.Retrieve(cacheKey, true)
|
||||||
zap.L().Info("cache retrieve status", zap.String("status", retrieveStatus.String()))
|
zap.L().Info("cache retrieve status", zap.String("status", retrieveStatus.String()))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -373,7 +376,7 @@ func (q *querier) runPromQueries(ctx context.Context, params *v3.QueryRangeParam
|
|||||||
channelResults <- channelResult{Err: nil, Name: queryName, Query: promQuery.Query, Series: mergedSeries}
|
channelResults <- channelResult{Err: nil, Name: queryName, Query: promQuery.Query, Series: mergedSeries}
|
||||||
|
|
||||||
// Cache the seriesList for future queries
|
// Cache the seriesList for future queries
|
||||||
if len(missedSeries) > 0 && !params.NoCache && q.cache != nil {
|
if len(missedSeries) > 0 && !params.NoCache && q.cache != nil && ok {
|
||||||
mergedSeriesData, err := json.Marshal(mergedSeries)
|
mergedSeriesData, err := json.Marshal(mergedSeries)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
zap.L().Error("error marshalling merged series", zap.Error(err))
|
zap.L().Error("error marshalling merged series", zap.Error(err))
|
||||||
@@ -546,3 +549,7 @@ func (q *querier) QueryRange(ctx context.Context, params *v3.QueryRangeParamsV3,
|
|||||||
func (q *querier) QueriesExecuted() []string {
|
func (q *querier) QueriesExecuted() []string {
|
||||||
return q.queriesExecuted
|
return q.queriesExecuted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (q *querier) TimeRanges() [][]int {
|
||||||
|
return q.timeRanges
|
||||||
|
}
|
||||||
|
|||||||
@@ -951,3 +951,102 @@ func TestQueryRangeTimeShiftWithLimitAndCache(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestQueryRangeValueTypePromQL(t *testing.T) {
|
||||||
|
// There shouldn't be any caching for value panel type
|
||||||
|
params := []*v3.QueryRangeParamsV3{
|
||||||
|
{
|
||||||
|
Start: 1675115596722,
|
||||||
|
End: 1675115596722 + 120*60*1000,
|
||||||
|
Step: 5 * time.Minute.Milliseconds(),
|
||||||
|
CompositeQuery: &v3.CompositeQuery{
|
||||||
|
QueryType: v3.QueryTypePromQL,
|
||||||
|
PanelType: v3.PanelTypeValue,
|
||||||
|
PromQueries: map[string]*v3.PromQuery{
|
||||||
|
"A": {
|
||||||
|
Query: "signoz_calls_total",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Start: 1675115596722 + 60*60*1000,
|
||||||
|
End: 1675115596722 + 180*60*1000,
|
||||||
|
Step: 5 * time.Minute.Milliseconds(),
|
||||||
|
CompositeQuery: &v3.CompositeQuery{
|
||||||
|
QueryType: v3.QueryTypePromQL,
|
||||||
|
PanelType: v3.PanelTypeValue,
|
||||||
|
PromQueries: map[string]*v3.PromQuery{
|
||||||
|
"A": {
|
||||||
|
Query: "signoz_latency_bucket",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cache := inmemory.New(&inmemory.Options{TTL: 60 * time.Minute, CleanupInterval: 10 * time.Minute})
|
||||||
|
opts := QuerierOptions{
|
||||||
|
Cache: cache,
|
||||||
|
Reader: nil,
|
||||||
|
FluxInterval: 5 * time.Minute,
|
||||||
|
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
||||||
|
|
||||||
|
TestingMode: true,
|
||||||
|
ReturnedSeries: []*v3.Series{
|
||||||
|
{
|
||||||
|
Labels: map[string]string{
|
||||||
|
"method": "GET",
|
||||||
|
"service_name": "test",
|
||||||
|
"__name__": "doesn't matter",
|
||||||
|
},
|
||||||
|
Points: []v3.Point{
|
||||||
|
{Timestamp: 1675115596722, Value: 1},
|
||||||
|
{Timestamp: 1675115596722 + 60*60*1000, Value: 2},
|
||||||
|
{Timestamp: 1675115596722 + 120*60*1000, Value: 3},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
q := NewQuerier(opts)
|
||||||
|
|
||||||
|
expectedQueryAndTimeRanges := []struct {
|
||||||
|
query string
|
||||||
|
ranges []missInterval
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
query: "signoz_calls_total",
|
||||||
|
ranges: []missInterval{
|
||||||
|
{start: 1675115596722, end: 1675115596722 + 120*60*1000},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
query: "signoz_latency_bucket",
|
||||||
|
ranges: []missInterval{
|
||||||
|
{start: 1675115596722 + 60*60*1000, end: 1675115596722 + 180*60*1000},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, param := range params {
|
||||||
|
_, errByName, err := q.QueryRange(context.Background(), param, nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("expected no error, got %s", err)
|
||||||
|
}
|
||||||
|
if len(errByName) > 0 {
|
||||||
|
t.Errorf("expected no error, got %v", errByName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.Contains(q.QueriesExecuted()[i], expectedQueryAndTimeRanges[i].query) {
|
||||||
|
t.Errorf("expected query to contain %s, got %s", expectedQueryAndTimeRanges[i].query, q.QueriesExecuted()[i])
|
||||||
|
}
|
||||||
|
if len(q.TimeRanges()[i]) != 2 {
|
||||||
|
t.Errorf("expected time ranges to be %v, got %v", expectedQueryAndTimeRanges[i].ranges, q.TimeRanges()[i])
|
||||||
|
}
|
||||||
|
if q.TimeRanges()[i][0] != int(expectedQueryAndTimeRanges[i].ranges[0].start) {
|
||||||
|
t.Errorf("expected time ranges to be %v, got %v", expectedQueryAndTimeRanges[i].ranges, q.TimeRanges()[i])
|
||||||
|
}
|
||||||
|
if q.TimeRanges()[i][1] != int(expectedQueryAndTimeRanges[i].ranges[0].end) {
|
||||||
|
t.Errorf("expected time ranges to be %v, got %v", expectedQueryAndTimeRanges[i].ranges, q.TimeRanges()[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func prepareLogsQuery(ctx context.Context,
|
func prepareLogsQuery(_ context.Context,
|
||||||
start,
|
start,
|
||||||
end int64,
|
end int64,
|
||||||
builderQuery *v3.BuilderQuery,
|
builderQuery *v3.BuilderQuery,
|
||||||
|
|||||||
@@ -50,8 +50,10 @@ type querier struct {
|
|||||||
// TODO(srikanthccv): remove this once we have a proper mock
|
// TODO(srikanthccv): remove this once we have a proper mock
|
||||||
testingMode bool
|
testingMode bool
|
||||||
queriesExecuted []string
|
queriesExecuted []string
|
||||||
returnedSeries []*v3.Series
|
// tuple of start and end time in milliseconds
|
||||||
returnedErr error
|
timeRanges [][]int
|
||||||
|
returnedSeries []*v3.Series
|
||||||
|
returnedErr error
|
||||||
}
|
}
|
||||||
|
|
||||||
type QuerierOptions struct {
|
type QuerierOptions struct {
|
||||||
@@ -117,6 +119,7 @@ func (q *querier) execClickHouseQuery(ctx context.Context, query string) ([]*v3.
|
|||||||
func (q *querier) execPromQuery(ctx context.Context, params *model.QueryRangeParams) ([]*v3.Series, error) {
|
func (q *querier) execPromQuery(ctx context.Context, params *model.QueryRangeParams) ([]*v3.Series, error) {
|
||||||
q.queriesExecuted = append(q.queriesExecuted, params.Query)
|
q.queriesExecuted = append(q.queriesExecuted, params.Query)
|
||||||
if q.testingMode && q.reader == nil {
|
if q.testingMode && q.reader == nil {
|
||||||
|
q.timeRanges = append(q.timeRanges, []int{int(params.Start.UnixMilli()), int(params.End.UnixMilli())})
|
||||||
return q.returnedSeries, q.returnedErr
|
return q.returnedSeries, q.returnedErr
|
||||||
}
|
}
|
||||||
promResult, _, err := q.reader.GetQueryRangeResult(ctx, params)
|
promResult, _, err := q.reader.GetQueryRangeResult(ctx, params)
|
||||||
@@ -335,10 +338,10 @@ func (q *querier) runPromQueries(ctx context.Context, params *v3.QueryRangeParam
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(queryName string, promQuery *v3.PromQuery) {
|
go func(queryName string, promQuery *v3.PromQuery) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
cacheKey := cacheKeys[queryName]
|
cacheKey, ok := cacheKeys[queryName]
|
||||||
var cachedData []byte
|
var cachedData []byte
|
||||||
// Ensure NoCache is not set and cache is not nil
|
// Ensure NoCache is not set and cache is not nil
|
||||||
if !params.NoCache && q.cache != nil {
|
if !params.NoCache && q.cache != nil && ok {
|
||||||
data, retrieveStatus, err := q.cache.Retrieve(cacheKey, true)
|
data, retrieveStatus, err := q.cache.Retrieve(cacheKey, true)
|
||||||
zap.L().Info("cache retrieve status", zap.String("status", retrieveStatus.String()))
|
zap.L().Info("cache retrieve status", zap.String("status", retrieveStatus.String()))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -366,7 +369,7 @@ func (q *querier) runPromQueries(ctx context.Context, params *v3.QueryRangeParam
|
|||||||
channelResults <- channelResult{Err: nil, Name: queryName, Query: promQuery.Query, Series: mergedSeries}
|
channelResults <- channelResult{Err: nil, Name: queryName, Query: promQuery.Query, Series: mergedSeries}
|
||||||
|
|
||||||
// Cache the seriesList for future queries
|
// Cache the seriesList for future queries
|
||||||
if len(missedSeries) > 0 && !params.NoCache && q.cache != nil {
|
if len(missedSeries) > 0 && !params.NoCache && q.cache != nil && ok {
|
||||||
mergedSeriesData, err := json.Marshal(mergedSeries)
|
mergedSeriesData, err := json.Marshal(mergedSeries)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
zap.L().Error("error marshalling merged series", zap.Error(err))
|
zap.L().Error("error marshalling merged series", zap.Error(err))
|
||||||
@@ -539,3 +542,7 @@ func (q *querier) QueryRange(ctx context.Context, params *v3.QueryRangeParamsV3,
|
|||||||
func (q *querier) QueriesExecuted() []string {
|
func (q *querier) QueriesExecuted() []string {
|
||||||
return q.queriesExecuted
|
return q.queriesExecuted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (q *querier) TimeRanges() [][]int {
|
||||||
|
return q.timeRanges
|
||||||
|
}
|
||||||
|
|||||||
1060
pkg/query-service/app/querier/v2/querier_test.go
Normal file
1060
pkg/query-service/app/querier/v2/querier_test.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -55,6 +55,10 @@ func GetAlertManagerApiPrefix() string {
|
|||||||
return "http://alertmanager:9093/api/"
|
return "http://alertmanager:9093/api/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var TELEMETRY_HEART_BEAT_DURATION_MINUTES = GetOrDefaultEnvInt("TELEMETRY_HEART_BEAT_DURATION_MINUTES", 720)
|
||||||
|
|
||||||
|
var TELEMETRY_ACTIVE_USER_DURATION_MINUTES = GetOrDefaultEnvInt("TELEMETRY_ACTIVE_USER_DURATION_MINUTES", 360)
|
||||||
|
|
||||||
var InviteEmailTemplate = GetOrDefaultEnv("INVITE_EMAIL_TEMPLATE", "/root/templates/invitation_email_template.html")
|
var InviteEmailTemplate = GetOrDefaultEnv("INVITE_EMAIL_TEMPLATE", "/root/templates/invitation_email_template.html")
|
||||||
|
|
||||||
// Alert manager channel subpath
|
// Alert manager channel subpath
|
||||||
@@ -232,6 +236,18 @@ func GetOrDefaultEnv(key string, fallback string) string {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetOrDefaultEnvInt(key string, fallback int) int {
|
||||||
|
v := os.Getenv(key)
|
||||||
|
if len(v) == 0 {
|
||||||
|
return fallback
|
||||||
|
}
|
||||||
|
intVal, err := strconv.Atoi(v)
|
||||||
|
if err != nil {
|
||||||
|
return fallback
|
||||||
|
}
|
||||||
|
return intVal
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
STRING = "String"
|
STRING = "String"
|
||||||
UINT32 = "UInt32"
|
UINT32 = "UInt32"
|
||||||
|
|||||||
@@ -110,4 +110,5 @@ type Querier interface {
|
|||||||
|
|
||||||
// test helpers
|
// test helpers
|
||||||
QueriesExecuted() []string
|
QueriesExecuted() []string
|
||||||
|
TimeRanges() [][]int
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-co-op/gocron"
|
||||||
"gopkg.in/segmentio/analytics-go.v3"
|
"gopkg.in/segmentio/analytics-go.v3"
|
||||||
|
|
||||||
"go.signoz.io/signoz/pkg/query-service/constants"
|
"go.signoz.io/signoz/pkg/query-service/constants"
|
||||||
@@ -85,19 +86,11 @@ const api_key = "9kRrJ7oPCGPEJLF6QjMPLt5bljFhRQBr"
|
|||||||
const IP_NOT_FOUND_PLACEHOLDER = "NA"
|
const IP_NOT_FOUND_PLACEHOLDER = "NA"
|
||||||
const DEFAULT_NUMBER_OF_SERVICES = 6
|
const DEFAULT_NUMBER_OF_SERVICES = 6
|
||||||
|
|
||||||
const HEART_BEAT_DURATION = 12 * time.Hour
|
const SCHEDULE_START_TIME = "04:00" // 4 AM UTC
|
||||||
|
|
||||||
const ACTIVE_USER_DURATION = 6 * time.Hour
|
|
||||||
|
|
||||||
// const HEART_BEAT_DURATION = 30 * time.Second
|
|
||||||
// const ACTIVE_USER_DURATION = 30 * time.Second
|
|
||||||
|
|
||||||
const RATE_LIMIT_CHECK_DURATION = 1 * time.Minute
|
const RATE_LIMIT_CHECK_DURATION = 1 * time.Minute
|
||||||
const RATE_LIMIT_VALUE = 1
|
const RATE_LIMIT_VALUE = 1
|
||||||
|
|
||||||
// const RATE_LIMIT_CHECK_DURATION = 20 * time.Second
|
|
||||||
// const RATE_LIMIT_VALUE = 5
|
|
||||||
|
|
||||||
var telemetry *Telemetry
|
var telemetry *Telemetry
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
|
||||||
@@ -213,8 +206,11 @@ func createTelemetry() {
|
|||||||
|
|
||||||
telemetry.SetTelemetryEnabled(constants.IsTelemetryEnabled())
|
telemetry.SetTelemetryEnabled(constants.IsTelemetryEnabled())
|
||||||
|
|
||||||
ticker := time.NewTicker(HEART_BEAT_DURATION)
|
// Create a new scheduler
|
||||||
activeUserTicker := time.NewTicker(ACTIVE_USER_DURATION)
|
s := gocron.NewScheduler(time.UTC)
|
||||||
|
|
||||||
|
HEART_BEAT_DURATION := time.Duration(constants.TELEMETRY_HEART_BEAT_DURATION_MINUTES) * time.Minute
|
||||||
|
ACTIVE_USER_DURATION := time.Duration(constants.TELEMETRY_ACTIVE_USER_DURATION_MINUTES) * time.Minute
|
||||||
|
|
||||||
rateLimitTicker := time.NewTicker(RATE_LIMIT_CHECK_DURATION)
|
rateLimitTicker := time.NewTicker(RATE_LIMIT_CHECK_DURATION)
|
||||||
|
|
||||||
@@ -227,141 +223,171 @@ func createTelemetry() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
go func() {
|
ctx := context.Background()
|
||||||
for {
|
// Define heartbeat function
|
||||||
select {
|
heartbeatFunc := func() {
|
||||||
case <-activeUserTicker.C:
|
tagsInfo, _ := telemetry.reader.GetTagsInfoInLastHeartBeatInterval(ctx, HEART_BEAT_DURATION)
|
||||||
if telemetry.activeUser["logs"] != 0 {
|
|
||||||
getLogsInfoInLastHeartBeatInterval, err := telemetry.reader.GetLogsInfoInLastHeartBeatInterval(context.Background(), ACTIVE_USER_DURATION)
|
|
||||||
if err != nil && getLogsInfoInLastHeartBeatInterval == 0 {
|
|
||||||
telemetry.activeUser["logs"] = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if telemetry.activeUser["metrics"] != 0 {
|
|
||||||
getSamplesInfoInLastHeartBeatInterval, err := telemetry.reader.GetSamplesInfoInLastHeartBeatInterval(context.Background(), ACTIVE_USER_DURATION)
|
|
||||||
if err != nil && getSamplesInfoInLastHeartBeatInterval == 0 {
|
|
||||||
telemetry.activeUser["metrics"] = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (telemetry.activeUser["traces"] != 0) || (telemetry.activeUser["metrics"] != 0) || (telemetry.activeUser["logs"] != 0) {
|
|
||||||
telemetry.activeUser["any"] = 1
|
|
||||||
}
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_ACTIVE_USER, map[string]interface{}{
|
|
||||||
"traces": telemetry.activeUser["traces"],
|
|
||||||
"metrics": telemetry.activeUser["metrics"],
|
|
||||||
"logs": telemetry.activeUser["logs"],
|
|
||||||
"any": telemetry.activeUser["any"]},
|
|
||||||
"", true, false)
|
|
||||||
telemetry.activeUser = map[string]int8{"traces": 0, "metrics": 0, "logs": 0, "any": 0}
|
|
||||||
|
|
||||||
case <-ticker.C:
|
if len(tagsInfo.Env) != 0 {
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_ENVIRONMENT, map[string]interface{}{"value": tagsInfo.Env}, "", true, false)
|
||||||
|
}
|
||||||
|
|
||||||
tagsInfo, _ := telemetry.reader.GetTagsInfoInLastHeartBeatInterval(context.Background(), HEART_BEAT_DURATION)
|
languages := []string{}
|
||||||
|
for language := range tagsInfo.Languages {
|
||||||
|
languages = append(languages, language)
|
||||||
|
}
|
||||||
|
if len(languages) > 0 {
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_LANGUAGE, map[string]interface{}{"language": languages}, "", true, false)
|
||||||
|
}
|
||||||
|
services := []string{}
|
||||||
|
for service := range tagsInfo.Services {
|
||||||
|
services = append(services, service)
|
||||||
|
}
|
||||||
|
if len(services) > 0 {
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_SERVICE, map[string]interface{}{"serviceName": services}, "", true, false)
|
||||||
|
}
|
||||||
|
totalSpans, _ := telemetry.reader.GetTotalSpans(ctx)
|
||||||
|
totalLogs, _ := telemetry.reader.GetTotalLogs(ctx)
|
||||||
|
spansInLastHeartBeatInterval, _ := telemetry.reader.GetSpansInLastHeartBeatInterval(ctx, HEART_BEAT_DURATION)
|
||||||
|
getSamplesInfoInLastHeartBeatInterval, _ := telemetry.reader.GetSamplesInfoInLastHeartBeatInterval(ctx, HEART_BEAT_DURATION)
|
||||||
|
totalSamples, _ := telemetry.reader.GetTotalSamples(ctx)
|
||||||
|
tsInfo, _ := telemetry.reader.GetTimeSeriesInfo(ctx)
|
||||||
|
|
||||||
if len(tagsInfo.Env) != 0 {
|
getLogsInfoInLastHeartBeatInterval, _ := telemetry.reader.GetLogsInfoInLastHeartBeatInterval(ctx, HEART_BEAT_DURATION)
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_ENVIRONMENT, map[string]interface{}{"value": tagsInfo.Env}, "", true, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
languages := []string{}
|
traceTTL, _ := telemetry.reader.GetTTL(ctx, &model.GetTTLParams{Type: constants.TraceTTL})
|
||||||
for language := range tagsInfo.Languages {
|
metricsTTL, _ := telemetry.reader.GetTTL(ctx, &model.GetTTLParams{Type: constants.MetricsTTL})
|
||||||
languages = append(languages, language)
|
logsTTL, _ := telemetry.reader.GetTTL(ctx, &model.GetTTLParams{Type: constants.LogsTTL})
|
||||||
}
|
|
||||||
if len(languages) > 0 {
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_LANGUAGE, map[string]interface{}{"language": languages}, "", true, false)
|
|
||||||
}
|
|
||||||
services := []string{}
|
|
||||||
for service := range tagsInfo.Services {
|
|
||||||
services = append(services, service)
|
|
||||||
}
|
|
||||||
if len(services) > 0 {
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_SERVICE, map[string]interface{}{"serviceName": services}, "", true, false)
|
|
||||||
}
|
|
||||||
totalSpans, _ := telemetry.reader.GetTotalSpans(context.Background())
|
|
||||||
totalLogs, _ := telemetry.reader.GetTotalLogs(context.Background())
|
|
||||||
spansInLastHeartBeatInterval, _ := telemetry.reader.GetSpansInLastHeartBeatInterval(context.Background(), HEART_BEAT_DURATION)
|
|
||||||
getSamplesInfoInLastHeartBeatInterval, _ := telemetry.reader.GetSamplesInfoInLastHeartBeatInterval(context.Background(), HEART_BEAT_DURATION)
|
|
||||||
totalSamples, _ := telemetry.reader.GetTotalSamples(context.Background())
|
|
||||||
tsInfo, _ := telemetry.reader.GetTimeSeriesInfo(context.Background())
|
|
||||||
|
|
||||||
getLogsInfoInLastHeartBeatInterval, _ := telemetry.reader.GetLogsInfoInLastHeartBeatInterval(context.Background(), HEART_BEAT_DURATION)
|
data := map[string]interface{}{
|
||||||
|
"totalSpans": totalSpans,
|
||||||
|
"spansInLastHeartBeatInterval": spansInLastHeartBeatInterval,
|
||||||
|
"totalSamples": totalSamples,
|
||||||
|
"getSamplesInfoInLastHeartBeatInterval": getSamplesInfoInLastHeartBeatInterval,
|
||||||
|
"totalLogs": totalLogs,
|
||||||
|
"getLogsInfoInLastHeartBeatInterval": getLogsInfoInLastHeartBeatInterval,
|
||||||
|
"countUsers": telemetry.countUsers,
|
||||||
|
"metricsTTLStatus": metricsTTL.Status,
|
||||||
|
"tracesTTLStatus": traceTTL.Status,
|
||||||
|
"logsTTLStatus": logsTTL.Status,
|
||||||
|
"patUser": telemetry.patTokenUser,
|
||||||
|
}
|
||||||
|
telemetry.patTokenUser = false
|
||||||
|
for key, value := range tsInfo {
|
||||||
|
data[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
traceTTL, _ := telemetry.reader.GetTTL(context.Background(), &model.GetTTLParams{Type: constants.TraceTTL})
|
users, apiErr := telemetry.reader.GetUsers(ctx)
|
||||||
metricsTTL, _ := telemetry.reader.GetTTL(context.Background(), &model.GetTTLParams{Type: constants.MetricsTTL})
|
if apiErr == nil {
|
||||||
logsTTL, _ := telemetry.reader.GetTTL(context.Background(), &model.GetTTLParams{Type: constants.LogsTTL})
|
for _, user := range users {
|
||||||
|
if user.Email == DEFAULT_CLOUD_EMAIL {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_HEART_BEAT, data, user.Email, false, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data := map[string]interface{}{
|
alertsInfo, err := telemetry.alertsInfoCallback(ctx)
|
||||||
"totalSpans": totalSpans,
|
if err == nil {
|
||||||
"spansInLastHeartBeatInterval": spansInLastHeartBeatInterval,
|
dashboardsInfo, err := telemetry.reader.GetDashboardsInfo(ctx)
|
||||||
"totalSamples": totalSamples,
|
if err == nil {
|
||||||
"getSamplesInfoInLastHeartBeatInterval": getSamplesInfoInLastHeartBeatInterval,
|
channels, err := telemetry.reader.GetChannels()
|
||||||
"totalLogs": totalLogs,
|
|
||||||
"getLogsInfoInLastHeartBeatInterval": getLogsInfoInLastHeartBeatInterval,
|
|
||||||
"countUsers": telemetry.countUsers,
|
|
||||||
"metricsTTLStatus": metricsTTL.Status,
|
|
||||||
"tracesTTLStatus": traceTTL.Status,
|
|
||||||
"logsTTLStatus": logsTTL.Status,
|
|
||||||
"patUser": telemetry.patTokenUser,
|
|
||||||
}
|
|
||||||
telemetry.patTokenUser = false
|
|
||||||
for key, value := range tsInfo {
|
|
||||||
data[key] = value
|
|
||||||
}
|
|
||||||
|
|
||||||
users, apiErr := telemetry.reader.GetUsers(context.Background())
|
|
||||||
if apiErr == nil {
|
|
||||||
for _, user := range users {
|
|
||||||
if user.Email == DEFAULT_CLOUD_EMAIL {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_HEART_BEAT, data, user.Email, false, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
alertsInfo, err := telemetry.alertsInfoCallback(context.Background())
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dashboardsInfo, err := telemetry.reader.GetDashboardsInfo(context.Background())
|
savedViewsInfo, err := telemetry.reader.GetSavedViewsInfo(ctx)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
channels, err := telemetry.reader.GetChannels()
|
dashboardsAlertsData := map[string]interface{}{
|
||||||
if err == nil {
|
"totalDashboards": dashboardsInfo.TotalDashboards,
|
||||||
savedViewsInfo, err := telemetry.reader.GetSavedViewsInfo(context.Background())
|
"totalDashboardsWithPanelAndName": dashboardsInfo.TotalDashboardsWithPanelAndName,
|
||||||
if err == nil {
|
"logsBasedPanels": dashboardsInfo.LogsBasedPanels,
|
||||||
dashboardsAlertsData := map[string]interface{}{
|
"metricBasedPanels": dashboardsInfo.MetricBasedPanels,
|
||||||
"totalDashboards": dashboardsInfo.TotalDashboards,
|
"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,
|
||||||
"totalDashboardsWithPanelAndName": dashboardsInfo.TotalDashboardsWithPanelAndName,
|
"totalAlerts": alertsInfo.TotalAlerts,
|
||||||
"logsBasedPanels": dashboardsInfo.LogsBasedPanels,
|
"logsBasedAlerts": alertsInfo.LogsBasedAlerts,
|
||||||
"metricBasedPanels": dashboardsInfo.MetricBasedPanels,
|
"metricBasedAlerts": alertsInfo.MetricBasedAlerts,
|
||||||
"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,
|
"tracesBasedAlerts": alertsInfo.TracesBasedAlerts,
|
||||||
"totalAlerts": alertsInfo.TotalAlerts,
|
"totalChannels": len(*channels),
|
||||||
"logsBasedAlerts": alertsInfo.LogsBasedAlerts,
|
"totalSavedViews": savedViewsInfo.TotalSavedViews,
|
||||||
"metricBasedAlerts": alertsInfo.MetricBasedAlerts,
|
"logsSavedViews": savedViewsInfo.LogsSavedViews,
|
||||||
"tracesBasedAlerts": alertsInfo.TracesBasedAlerts,
|
"tracesSavedViews": savedViewsInfo.TracesSavedViews,
|
||||||
"totalChannels": len(*channels),
|
}
|
||||||
"totalSavedViews": savedViewsInfo.TotalSavedViews,
|
// send event only if there are dashboards or alerts or channels
|
||||||
"logsSavedViews": savedViewsInfo.LogsSavedViews,
|
if (dashboardsInfo.TotalDashboards > 0 || alertsInfo.TotalAlerts > 0 || len(*channels) > 0 || savedViewsInfo.TotalSavedViews > 0) && apiErr == nil {
|
||||||
"tracesSavedViews": savedViewsInfo.TracesSavedViews,
|
for _, user := range users {
|
||||||
}
|
if user.Email == DEFAULT_CLOUD_EMAIL {
|
||||||
// send event only if there are dashboards or alerts or channels
|
continue
|
||||||
if (dashboardsInfo.TotalDashboards > 0 || alertsInfo.TotalAlerts > 0 || len(*channels) > 0 || savedViewsInfo.TotalSavedViews > 0) && apiErr == nil {
|
|
||||||
for _, user := range users {
|
|
||||||
if user.Email == DEFAULT_CLOUD_EMAIL {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_DASHBOARDS_ALERTS, dashboardsAlertsData, user.Email, false, false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_DASHBOARDS_ALERTS, dashboardsAlertsData, user.Email, false, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil || apiErr != nil {
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_DASHBOARDS_ALERTS, map[string]interface{}{"error": err.Error()}, "", true, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
getDistributedInfoInLastHeartBeatInterval, _ := telemetry.reader.GetDistributedInfoInLastHeartBeatInterval(context.Background())
|
|
||||||
telemetry.SendEvent(TELEMETRY_EVENT_DISTRIBUTED, getDistributedInfoInLastHeartBeatInterval, "", true, false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
if err != nil || apiErr != nil {
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_DASHBOARDS_ALERTS, map[string]interface{}{"error": err.Error()}, "", true, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
getDistributedInfoInLastHeartBeatInterval, _ := telemetry.reader.GetDistributedInfoInLastHeartBeatInterval(ctx)
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_DISTRIBUTED, getDistributedInfoInLastHeartBeatInterval, "", true, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define active user function
|
||||||
|
activeUserFunc := func() {
|
||||||
|
if telemetry.activeUser["logs"] != 0 {
|
||||||
|
getLogsInfoInLastHeartBeatInterval, err := telemetry.reader.GetLogsInfoInLastHeartBeatInterval(ctx, ACTIVE_USER_DURATION)
|
||||||
|
if err != nil && getLogsInfoInLastHeartBeatInterval == 0 {
|
||||||
|
telemetry.activeUser["logs"] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if telemetry.activeUser["metrics"] != 0 {
|
||||||
|
getSamplesInfoInLastHeartBeatInterval, err := telemetry.reader.GetSamplesInfoInLastHeartBeatInterval(ctx, ACTIVE_USER_DURATION)
|
||||||
|
if err != nil && getSamplesInfoInLastHeartBeatInterval == 0 {
|
||||||
|
telemetry.activeUser["metrics"] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (telemetry.activeUser["traces"] != 0) || (telemetry.activeUser["metrics"] != 0) || (telemetry.activeUser["logs"] != 0) {
|
||||||
|
telemetry.activeUser["any"] = 1
|
||||||
|
}
|
||||||
|
telemetry.SendEvent(TELEMETRY_EVENT_ACTIVE_USER, map[string]interface{}{
|
||||||
|
"traces": telemetry.activeUser["traces"],
|
||||||
|
"metrics": telemetry.activeUser["metrics"],
|
||||||
|
"logs": telemetry.activeUser["logs"],
|
||||||
|
"any": telemetry.activeUser["any"]},
|
||||||
|
"", true, false)
|
||||||
|
telemetry.activeUser = map[string]int8{"traces": 0, "metrics": 0, "logs": 0, "any": 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate next run time based on duration and start time
|
||||||
|
calculateNextRun := func(duration time.Duration, startTimeStr string) time.Time {
|
||||||
|
now := time.Now().UTC()
|
||||||
|
startTime, _ := time.Parse("15:04", startTimeStr)
|
||||||
|
todayStartTime := time.Date(now.Year(), now.Month(), now.Day(), startTime.Hour(), startTime.Minute(), 0, 0, time.UTC)
|
||||||
|
|
||||||
|
if now.Before(todayStartTime) {
|
||||||
|
todayStartTime = todayStartTime.Add(-24 * time.Hour)
|
||||||
|
}
|
||||||
|
|
||||||
|
diff := now.Sub(todayStartTime)
|
||||||
|
intervalsPassed := int(diff / duration)
|
||||||
|
nextRun := todayStartTime.Add(time.Duration(intervalsPassed+1) * duration)
|
||||||
|
|
||||||
|
return nextRun
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schedule next runs
|
||||||
|
scheduleNextRuns := func() {
|
||||||
|
nextHeartbeat := calculateNextRun(HEART_BEAT_DURATION, SCHEDULE_START_TIME)
|
||||||
|
nextActiveUser := calculateNextRun(ACTIVE_USER_DURATION, SCHEDULE_START_TIME)
|
||||||
|
|
||||||
|
s.Every(HEART_BEAT_DURATION).StartAt(nextHeartbeat).Do(heartbeatFunc)
|
||||||
|
s.Every(ACTIVE_USER_DURATION).StartAt(nextActiveUser).Do(activeUserFunc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schedule immediate execution and subsequent runs
|
||||||
|
scheduleNextRuns()
|
||||||
|
|
||||||
|
// Start the scheduler in a separate goroutine
|
||||||
|
go s.StartBlocking()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get preferred outbound ip of this machine
|
// Get preferred outbound ip of this machine
|
||||||
|
|||||||
Reference in New Issue
Block a user