mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 01:15:52 +08:00
fix: resolve typescript issues in metrics explorer (#7878)
This commit is contained in:
parent
39f07e7477
commit
27830742f9
@ -1,6 +1,10 @@
|
|||||||
# Ignore artifacts:
|
# Ignore artifacts:
|
||||||
build
|
build
|
||||||
coverage
|
coverage
|
||||||
|
public/
|
||||||
|
|
||||||
# Ignore all MD files:
|
# Ignore all MD files:
|
||||||
**/*.md
|
**/*.md
|
||||||
|
|
||||||
|
# Ignore all JSON files:
|
||||||
|
**/*.json
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 18px; /* 128.571% */
|
line-height: 18px; /* 128.571% */
|
||||||
letter-spacing: -0.07px;
|
letter-spacing: -0.07px;
|
||||||
&,&:hover {
|
&,
|
||||||
|
&:hover {
|
||||||
color: var(--bg-robin-400) !important;
|
color: var(--bg-robin-400) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
.label-column {
|
.label-column {
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
@ -45,4 +45,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
.explorer-show-btn {
|
.explorer-show-btn {
|
||||||
border-radius: 10px 10px 0px 0px;
|
border-radius: 10px 10px 0px 0px;
|
||||||
border: 1px solid var(--bg-slate-400);
|
border: 1px solid var(--bg-slate-400);
|
||||||
background: rgba(22, 24, 29, 0.40);
|
background: rgba(22, 24, 29, 0.4);
|
||||||
box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.25);
|
box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.25);
|
||||||
backdrop-filter: blur(20px);
|
backdrop-filter: blur(20px);
|
||||||
align-self: center;
|
align-self: center;
|
||||||
@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
.lightMode {
|
.lightMode {
|
||||||
.explorer-option-droppable-container {
|
.explorer-option-droppable-container {
|
||||||
|
|
||||||
.explorer-show-btn {
|
.explorer-show-btn {
|
||||||
background: var(--bg-vanilla-200);
|
background: var(--bg-vanilla-200);
|
||||||
}
|
}
|
||||||
|
@ -2,30 +2,33 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QueryTypes, ConditionalOperators, ValidTypeSequence, ValidTypeValue } from 'lib/logql/tokens';
|
import {
|
||||||
|
QueryTypes,
|
||||||
|
ConditionalOperators,
|
||||||
|
ValidTypeSequence,
|
||||||
|
ValidTypeValue,
|
||||||
|
} from 'lib/logql/tokens';
|
||||||
|
|
||||||
export interface QueryFields {
|
export interface QueryFields {
|
||||||
type: keyof typeof QueryTypes;
|
type: keyof typeof QueryTypes;
|
||||||
value: string | string[];
|
value: string | string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function fieldsQueryIsvalid(queryFields: QueryFields[]): boolean {
|
export function fieldsQueryIsvalid(queryFields: QueryFields[]): boolean {
|
||||||
let lastOp: string;
|
let lastOp: string;
|
||||||
let result = true;
|
let result = true;
|
||||||
queryFields.forEach((q, idx) => {
|
queryFields.forEach((q, idx) => {
|
||||||
|
|
||||||
if (!q.value || q.value === null || q.value === '') result = false;
|
if (!q.value || q.value === null || q.value === '') result = false;
|
||||||
|
|
||||||
if (Array.isArray(q.value) && q.value.length === 0) result = false;
|
if (Array.isArray(q.value) && q.value.length === 0) result = false;
|
||||||
|
|
||||||
const nextOp = idx < queryFields.length ? queryFields[idx + 1] : undefined;
|
const nextOp = idx < queryFields.length ? queryFields[idx + 1] : undefined;
|
||||||
if (!ValidTypeSequence(lastOp?.type, q?.type, nextOp?.type)) result = false
|
if (!ValidTypeSequence(lastOp?.type, q?.type, nextOp?.type)) result = false;
|
||||||
|
|
||||||
if (!ValidTypeValue(lastOp?.value, q.value)) result = false;
|
if (!ValidTypeValue(lastOp?.value, q.value)) result = false;
|
||||||
lastOp = q;
|
lastOp = q;
|
||||||
});
|
});
|
||||||
return result
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const queryKOVPair = (): QueryFields[] => [
|
export const queryKOVPair = (): QueryFields[] => [
|
||||||
@ -43,7 +46,11 @@ export const queryKOVPair = (): QueryFields[] => [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const initQueryKOVPair = (name?: string = null, op?: string = null , value?: string | string[] = null ): QueryFields[] => [
|
export const initQueryKOVPair = (
|
||||||
|
name?: string = null,
|
||||||
|
op?: string = null,
|
||||||
|
value?: string | string[] = null,
|
||||||
|
): QueryFields[] => [
|
||||||
{
|
{
|
||||||
type: QueryTypes.QUERY_KEY,
|
type: QueryTypes.QUERY_KEY,
|
||||||
value: name,
|
value: name,
|
||||||
@ -58,12 +65,14 @@ export const initQueryKOVPair = (name?: string = null, op?: string = null , val
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const prepareConditionOperator = (op?: string = ConditionalOperators.AND): QueryFields => {
|
export const prepareConditionOperator = (
|
||||||
|
op?: string = ConditionalOperators.AND,
|
||||||
|
): QueryFields => {
|
||||||
return {
|
return {
|
||||||
type: QueryTypes.CONDITIONAL_OPERATOR,
|
type: QueryTypes.CONDITIONAL_OPERATOR,
|
||||||
value: op,
|
value: op,
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export const createParsedQueryStructure = (parsedQuery = []) => {
|
export const createParsedQueryStructure = (parsedQuery = []) => {
|
||||||
if (!parsedQuery.length) {
|
if (!parsedQuery.length) {
|
||||||
|
@ -5,11 +5,11 @@ import { DataType } from 'container/LogDetailedView/TableView';
|
|||||||
import { Search } from 'lucide-react';
|
import { Search } from 'lucide-react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { AllAttributesProps } from './types';
|
|
||||||
import { useHandleExplorerTabChange } from '../../../hooks/useHandleExplorerTabChange';
|
|
||||||
import { getMetricDetailsQuery } from './utils';
|
|
||||||
import ROUTES from '../../../constants/routes';
|
|
||||||
import { PANEL_TYPES } from '../../../constants/queryBuilder';
|
import { PANEL_TYPES } from '../../../constants/queryBuilder';
|
||||||
|
import ROUTES from '../../../constants/routes';
|
||||||
|
import { useHandleExplorerTabChange } from '../../../hooks/useHandleExplorerTabChange';
|
||||||
|
import { AllAttributesProps } from './types';
|
||||||
|
import { getMetricDetailsQuery } from './utils';
|
||||||
|
|
||||||
function AllAttributes({
|
function AllAttributes({
|
||||||
metricName,
|
metricName,
|
||||||
|
@ -16,6 +16,9 @@ import { useIsDarkMode } from 'hooks/useDarkMode';
|
|||||||
import { Compass, Crosshair, X } from 'lucide-react';
|
import { Compass, Crosshair, X } from 'lucide-react';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { PANEL_TYPES } from '../../../constants/queryBuilder';
|
||||||
|
import ROUTES from '../../../constants/routes';
|
||||||
|
import { useHandleExplorerTabChange } from '../../../hooks/useHandleExplorerTabChange';
|
||||||
import { isInspectEnabled } from '../Inspect/utils';
|
import { isInspectEnabled } from '../Inspect/utils';
|
||||||
import { formatNumberIntoHumanReadableFormat } from '../Summary/utils';
|
import { formatNumberIntoHumanReadableFormat } from '../Summary/utils';
|
||||||
import AllAttributes from './AllAttributes';
|
import AllAttributes from './AllAttributes';
|
||||||
@ -27,9 +30,6 @@ import {
|
|||||||
formatTimestampToReadableDate,
|
formatTimestampToReadableDate,
|
||||||
getMetricDetailsQuery,
|
getMetricDetailsQuery,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import { PANEL_TYPES } from '../../../constants/queryBuilder';
|
|
||||||
import ROUTES from '../../../constants/routes';
|
|
||||||
import { useHandleExplorerTabChange } from '../../../hooks/useHandleExplorerTabChange';
|
|
||||||
|
|
||||||
function MetricDetails({
|
function MetricDetails({
|
||||||
onClose,
|
onClose,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { fireEvent, render, screen } from '@testing-library/react';
|
import { fireEvent, render, screen } from '@testing-library/react';
|
||||||
|
import * as useHandleExplorerTabChange from 'hooks/useHandleExplorerTabChange';
|
||||||
|
|
||||||
import AllAttributes from '../AllAttributes';
|
|
||||||
import { MetricDetailsAttribute } from '../../../../api/metricsExplorer/getMetricDetails';
|
import { MetricDetailsAttribute } from '../../../../api/metricsExplorer/getMetricDetails';
|
||||||
import ROUTES from '../../../../constants/routes';
|
import ROUTES from '../../../../constants/routes';
|
||||||
import * as useHandleExplorerTabChange from 'hooks/useHandleExplorerTabChange';
|
import AllAttributes from '../AllAttributes';
|
||||||
|
|
||||||
jest.mock('react-router-dom', () => ({
|
jest.mock('react-router-dom', () => ({
|
||||||
...jest.requireActual('react-router-dom'),
|
...jest.requireActual('react-router-dom'),
|
||||||
|
@ -124,7 +124,7 @@ function Summary(): JSX.Element {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const isListViewError = useMemo(
|
const isListViewError = useMemo(
|
||||||
() => isMetricsError || (metricsData && metricsData.statusCode !== 200),
|
() => isMetricsError || !!(metricsData && metricsData.statusCode !== 200),
|
||||||
[isMetricsError, metricsData],
|
[isMetricsError, metricsData],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
"label": "Start with Demo Data in <5 minutes",
|
"label": "Start with Demo Data in <5 minutes",
|
||||||
"tags": ["quickstart"],
|
"tags": ["quickstart"],
|
||||||
"module": "apm",
|
"module": "apm",
|
||||||
"relatedSearchKeywords": [
|
"relatedSearchKeywords": ["send data", "demo", "quickstart"],
|
||||||
"send data",
|
|
||||||
"demo",
|
|
||||||
"quickstart"
|
|
||||||
],
|
|
||||||
"imgUrl": "/Logos/quickstart.svg",
|
"imgUrl": "/Logos/quickstart.svg",
|
||||||
"link": "https://signoz.io/docs/cloud/quickstart/"
|
"link": "https://signoz.io/docs/cloud/quickstart/"
|
||||||
},
|
},
|
||||||
@ -17,10 +13,7 @@
|
|||||||
"label": "From Datadog",
|
"label": "From Datadog",
|
||||||
"tags": ["migrate to SigNoz"],
|
"tags": ["migrate to SigNoz"],
|
||||||
"module": "home",
|
"module": "home",
|
||||||
"relatedSearchKeywords": [
|
"relatedSearchKeywords": ["datadog", "opentelemetry"],
|
||||||
"datadog",
|
|
||||||
"opentelemetry"
|
|
||||||
],
|
|
||||||
"imgUrl": "/Logos/datadog.svg",
|
"imgUrl": "/Logos/datadog.svg",
|
||||||
"link": "https://signoz.io/docs/migration/migrate-from-datadog/"
|
"link": "https://signoz.io/docs/migration/migrate-from-datadog/"
|
||||||
},
|
},
|
||||||
@ -1143,12 +1136,7 @@
|
|||||||
"imgUrl": "/Logos/nginx.svg",
|
"imgUrl": "/Logos/nginx.svg",
|
||||||
"tags": ["apm"],
|
"tags": ["apm"],
|
||||||
"module": "apm",
|
"module": "apm",
|
||||||
"relatedSearchKeywords": [
|
"relatedSearchKeywords": ["tracing", "nginx server", "nginx proxy", "nginx"],
|
||||||
"tracing",
|
|
||||||
"nginx server",
|
|
||||||
"nginx proxy",
|
|
||||||
"nginx"
|
|
||||||
],
|
|
||||||
"id": "nginx-tracing",
|
"id": "nginx-tracing",
|
||||||
"link": "https://signoz.io/docs/instrumentation/opentelemetry-nginx/"
|
"link": "https://signoz.io/docs/instrumentation/opentelemetry-nginx/"
|
||||||
},
|
},
|
||||||
@ -2697,12 +2685,7 @@
|
|||||||
"label": "Redis",
|
"label": "Redis",
|
||||||
"tags": ["integrations", "database"],
|
"tags": ["integrations", "database"],
|
||||||
"module": "integrations",
|
"module": "integrations",
|
||||||
"relatedSearchKeywords": [
|
"relatedSearchKeywords": ["redis", "redis logs", "redis metrics", "database"],
|
||||||
"redis",
|
|
||||||
"redis logs",
|
|
||||||
"redis metrics",
|
|
||||||
"database"
|
|
||||||
],
|
|
||||||
"imgUrl": "/Logos/redis.svg",
|
"imgUrl": "/Logos/redis.svg",
|
||||||
"link": "/integrations?integration=builtin-redis",
|
"link": "/integrations?integration=builtin-redis",
|
||||||
"internalRedirect": true
|
"internalRedirect": true
|
||||||
@ -2727,12 +2710,7 @@
|
|||||||
"label": "Nginx",
|
"label": "Nginx",
|
||||||
"tags": ["integrations"],
|
"tags": ["integrations"],
|
||||||
"module": "integrations",
|
"module": "integrations",
|
||||||
"relatedSearchKeywords": [
|
"relatedSearchKeywords": ["nginx", "nginx logs", "nginx metrics", "proxy"],
|
||||||
"nginx",
|
|
||||||
"nginx logs",
|
|
||||||
"nginx metrics",
|
|
||||||
"proxy"
|
|
||||||
],
|
|
||||||
"imgUrl": "/Logos/nginx.svg",
|
"imgUrl": "/Logos/nginx.svg",
|
||||||
"link": "/integrations?integration=builtin-nginx",
|
"link": "/integrations?integration=builtin-nginx",
|
||||||
"internalRedirect": true
|
"internalRedirect": true
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
.processor-form-container {
|
.processor-form-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.processor-field-container {
|
.processor-field-container {
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.logs-pipelines-empty-state-video-iframe {
|
.logs-pipelines-empty-state-video-iframe {
|
||||||
width: min(90vw, 640px);
|
width: min(90vw, 640px);
|
||||||
height: min(68vw, 480px);
|
height: min(68vw, 480px);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
.additinal-filters-container {
|
.additinal-filters-container {
|
||||||
.action-btn {
|
.action-btn {
|
||||||
background: #4E74F8;
|
background: #4e74f8;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
/*eslint-disable*/
|
/*eslint-disable*/
|
||||||
//@ts-nocheck
|
//@ts-nocheck
|
||||||
|
|
||||||
import { cloneDeep, find, maxBy, uniq, uniqBy, groupBy, sumBy } from 'lodash-es';
|
import {
|
||||||
|
cloneDeep,
|
||||||
|
find,
|
||||||
|
maxBy,
|
||||||
|
uniq,
|
||||||
|
uniqBy,
|
||||||
|
groupBy,
|
||||||
|
sumBy,
|
||||||
|
} from 'lodash-es';
|
||||||
import { graphDataType } from './ServiceMap';
|
import { graphDataType } from './ServiceMap';
|
||||||
|
|
||||||
const MIN_WIDTH = 10;
|
const MIN_WIDTH = 10;
|
||||||
@ -25,7 +33,7 @@ export const getGraphData = (serviceMap, isDarkMode): graphDataType => {
|
|||||||
serviceName: e[0].child,
|
serviceName: e[0].child,
|
||||||
errorRate: sumBy(e, 'errorRate'),
|
errorRate: sumBy(e, 'errorRate'),
|
||||||
callRate: sumBy(e, 'callRate'),
|
callRate: sumBy(e, 'callRate'),
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
const highestCallCount = maxBy(items, (e) => e?.callCount)?.callCount;
|
const highestCallCount = maxBy(items, (e) => e?.callCount)?.callCount;
|
||||||
const highestCallRate = maxBy(services, (e) => e?.callRate)?.callRate;
|
const highestCallRate = maxBy(services, (e) => e?.callRate)?.callRate;
|
||||||
@ -101,7 +109,7 @@ const getRound2DigitsAfterDecimal = (num: number) => {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return num.toFixed(20).match(/^-?\d*\.?0*\d{0,2}/)[0];
|
return num.toFixed(20).match(/^-?\d*\.?0*\d{0,2}/)[0];
|
||||||
}
|
};
|
||||||
|
|
||||||
export const getTooltip = (link: {
|
export const getTooltip = (link: {
|
||||||
p99: number;
|
p99: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user