mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
parent
b5027cff9c
commit
5f77efa915
6 changed files with 26 additions and 21 deletions
|
@ -15,6 +15,7 @@ const LegendItem: FC<LegendItemProps> = ({ legend, onChange }) => {
|
||||||
const [copiedValue, setCopiedValue] = useState("");
|
const [copiedValue, setCopiedValue] = useState("");
|
||||||
const freeFormFields = useMemo(() => getFreeFields(legend), [legend]);
|
const freeFormFields = useMemo(() => getFreeFields(legend), [legend]);
|
||||||
const calculations = legend.calculations;
|
const calculations = legend.calculations;
|
||||||
|
const showCalculations = Object.values(calculations).some(v => v);
|
||||||
|
|
||||||
const handleClickFreeField = async (val: string, id: string) => {
|
const handleClickFreeField = async (val: string, id: string) => {
|
||||||
await navigator.clipboard.writeText(val);
|
await navigator.clipboard.writeText(val);
|
||||||
|
@ -68,9 +69,11 @@ const LegendItem: FC<LegendItemProps> = ({ legend, onChange }) => {
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="vm-legend-item-values">
|
{showCalculations && (
|
||||||
median:{calculations.median}, min:{calculations.min}, max:{calculations.max}, last:{calculations.last}
|
<div className="vm-legend-item-values">
|
||||||
</div>
|
median:{calculations.median}, min:{calculations.min}, max:{calculations.max}, last:{calculations.last}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
&__error {
|
&__error {
|
||||||
top: calc((100% - ($font-size-small/2)) - 2px);
|
top: calc((100% - ($font-size-small/2)) - 2px);
|
||||||
color: $color-error;
|
color: $color-error;
|
||||||
|
pointer-events: auto;
|
||||||
|
user-select: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__helper-text {
|
&__helper-text {
|
||||||
|
|
|
@ -26,6 +26,7 @@ interface FetchQueryReturn {
|
||||||
graphData?: MetricResult[],
|
graphData?: MetricResult[],
|
||||||
liveData?: InstantMetricResult[],
|
liveData?: InstantMetricResult[],
|
||||||
error?: ErrorTypes | string,
|
error?: ErrorTypes | string,
|
||||||
|
queryErrors: (ErrorTypes | string)[],
|
||||||
warning?: string,
|
warning?: string,
|
||||||
traces?: Trace[],
|
traces?: Trace[],
|
||||||
}
|
}
|
||||||
|
@ -58,17 +59,10 @@ export const useFetchQuery = ({
|
||||||
const [liveData, setLiveData] = useState<InstantMetricResult[]>();
|
const [liveData, setLiveData] = useState<InstantMetricResult[]>();
|
||||||
const [traces, setTraces] = useState<Trace[]>();
|
const [traces, setTraces] = useState<Trace[]>();
|
||||||
const [error, setError] = useState<ErrorTypes | string>();
|
const [error, setError] = useState<ErrorTypes | string>();
|
||||||
|
const [queryErrors, setQueryErrors] = useState<(ErrorTypes | string)[]>([]);
|
||||||
const [warning, setWarning] = useState<string>();
|
const [warning, setWarning] = useState<string>();
|
||||||
const [fetchQueue, setFetchQueue] = useState<AbortController[]>([]);
|
const [fetchQueue, setFetchQueue] = useState<AbortController[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (error) {
|
|
||||||
setGraphData(undefined);
|
|
||||||
setLiveData(undefined);
|
|
||||||
setTraces(undefined);
|
|
||||||
}
|
|
||||||
}, [error]);
|
|
||||||
|
|
||||||
const fetchData = async ({
|
const fetchData = async ({
|
||||||
fetchUrl,
|
fetchUrl,
|
||||||
fetchQueue,
|
fetchQueue,
|
||||||
|
@ -100,7 +94,7 @@ export const useFetchQuery = ({
|
||||||
const resp = await response.json();
|
const resp = await response.json();
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
setError(undefined);
|
setQueryErrors(prev => [...prev, ""]);
|
||||||
|
|
||||||
if (resp.trace) {
|
if (resp.trace) {
|
||||||
const trace = new Trace(resp.trace, query[counter - 1]);
|
const trace = new Trace(resp.trace, query[counter - 1]);
|
||||||
|
@ -114,10 +108,11 @@ export const useFetchQuery = ({
|
||||||
});
|
});
|
||||||
|
|
||||||
totalLength += resp.data.result.length;
|
totalLength += resp.data.result.length;
|
||||||
counter++;
|
|
||||||
} else {
|
} else {
|
||||||
setError(`${resp.errorType}\r\n${resp?.error}`);
|
tempData.push({ metric: {}, values: [], group: counter } as MetricBase);
|
||||||
|
setQueryErrors(prev => [...prev, `${resp.errorType}\r\n${resp?.error}`]);
|
||||||
}
|
}
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const limitText = `Showing ${seriesLimit} series out of ${totalLength} series due to performance reasons. Please narrow down the query, so it returns less series`;
|
const limitText = `Showing ${seriesLimit} series out of ${totalLength} series due to performance reasons. Please narrow down the query, so it returns less series`;
|
||||||
|
@ -136,13 +131,15 @@ export const useFetchQuery = ({
|
||||||
const throttledFetchData = useCallback(debounce(fetchData, 300), []);
|
const throttledFetchData = useCallback(debounce(fetchData, 300), []);
|
||||||
|
|
||||||
const fetchUrl = useMemo(() => {
|
const fetchUrl = useMemo(() => {
|
||||||
|
setError("");
|
||||||
|
setQueryErrors([]);
|
||||||
const expr = predefinedQuery ?? query;
|
const expr = predefinedQuery ?? query;
|
||||||
const displayChart = (display || displayType) === "chart";
|
const displayChart = (display || displayType) === "chart";
|
||||||
if (!period) return;
|
if (!period) return;
|
||||||
if (!serverUrl) {
|
if (!serverUrl) {
|
||||||
setError(ErrorTypes.emptyServer);
|
setError(ErrorTypes.emptyServer);
|
||||||
} else if (expr.every(q => !q.trim())) {
|
} else if (expr.every(q => !q.trim())) {
|
||||||
setError(ErrorTypes.validQuery);
|
setQueryErrors(expr.map(() => ErrorTypes.validQuery));
|
||||||
} else if (isValidHttpUrl(serverUrl)) {
|
} else if (isValidHttpUrl(serverUrl)) {
|
||||||
const updatedPeriod = { ...period };
|
const updatedPeriod = { ...period };
|
||||||
updatedPeriod.step = customStep;
|
updatedPeriod.step = customStep;
|
||||||
|
@ -181,5 +178,5 @@ export const useFetchQuery = ({
|
||||||
setFetchQueue(fetchQueue.filter(f => !f.signal.aborted));
|
setFetchQueue(fetchQueue.filter(f => !f.signal.aborted));
|
||||||
}, [fetchQueue]);
|
}, [fetchQueue]);
|
||||||
|
|
||||||
return { fetchUrl, isLoading, graphData, liveData, error, warning, traces };
|
return { fetchUrl, isLoading, graphData, liveData, error, queryErrors, warning, traces };
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,14 +16,14 @@ import { arrayEquals } from "../../../utils/array";
|
||||||
import useDeviceDetect from "../../../hooks/useDeviceDetect";
|
import useDeviceDetect from "../../../hooks/useDeviceDetect";
|
||||||
|
|
||||||
export interface QueryConfiguratorProps {
|
export interface QueryConfiguratorProps {
|
||||||
error?: ErrorTypes | string;
|
errors: (ErrorTypes | string)[];
|
||||||
queryOptions: string[]
|
queryOptions: string[]
|
||||||
onHideQuery: (queries: number[]) => void
|
onHideQuery: (queries: number[]) => void
|
||||||
onRunQuery: () => void
|
onRunQuery: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const QueryConfigurator: FC<QueryConfiguratorProps> = ({
|
const QueryConfigurator: FC<QueryConfiguratorProps> = ({
|
||||||
error,
|
errors,
|
||||||
queryOptions,
|
queryOptions,
|
||||||
onHideQuery,
|
onHideQuery,
|
||||||
onRunQuery
|
onRunQuery
|
||||||
|
@ -141,7 +141,7 @@ const QueryConfigurator: FC<QueryConfiguratorProps> = ({
|
||||||
value={stateQuery[i]}
|
value={stateQuery[i]}
|
||||||
autocomplete={autocomplete}
|
autocomplete={autocomplete}
|
||||||
options={queryOptions}
|
options={queryOptions}
|
||||||
error={error}
|
error={errors[i]}
|
||||||
onArrowUp={createHandlerArrow(-1, i)}
|
onArrowUp={createHandlerArrow(-1, i)}
|
||||||
onArrowDown={createHandlerArrow(1, i)}
|
onArrowDown={createHandlerArrow(1, i)}
|
||||||
onEnter={handleRunQuery}
|
onEnter={handleRunQuery}
|
||||||
|
|
|
@ -41,7 +41,9 @@ const CustomPanel: FC = () => {
|
||||||
const graphDispatch = useGraphDispatch();
|
const graphDispatch = useGraphDispatch();
|
||||||
|
|
||||||
const { queryOptions } = useFetchQueryOptions();
|
const { queryOptions } = useFetchQueryOptions();
|
||||||
const { isLoading, liveData, graphData, error, warning, traces } = useFetchQuery({
|
const {
|
||||||
|
isLoading, liveData, graphData, error, queryErrors, warning, traces
|
||||||
|
} = useFetchQuery({
|
||||||
visible: true,
|
visible: true,
|
||||||
customStep,
|
customStep,
|
||||||
hideQuery,
|
hideQuery,
|
||||||
|
@ -99,7 +101,7 @@ const CustomPanel: FC = () => {
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<QueryConfigurator
|
<QueryConfigurator
|
||||||
error={!hideError ? error : ""}
|
errors={!hideError ? queryErrors : []}
|
||||||
queryOptions={queryOptions}
|
queryOptions={queryOptions}
|
||||||
onHideQuery={handleHideQuery}
|
onHideQuery={handleHideQuery}
|
||||||
onRunQuery={handleRunQuery}
|
onRunQuery={handleRunQuery}
|
||||||
|
|
|
@ -33,6 +33,7 @@ created by v1.90.0 or newer versions. The solution is to upgrade to v1.90.0 or n
|
||||||
|
|
||||||
* BUGFIX: prevent from slow [snapshot creating](https://docs.victoriametrics.com/#how-to-work-with-snapshots) under high data ingestion rate. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3551).
|
* BUGFIX: prevent from slow [snapshot creating](https://docs.victoriametrics.com/#how-to-work-with-snapshots) under high data ingestion rate. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3551).
|
||||||
* BUGFIX: [vmauth](https://docs.victoriametrics.com/vmauth.html): suppress [proxy protocol](https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt) parsing errors in case of `EOF`. Usually, the error is caused by health checks and is not a sign of an actual error.
|
* BUGFIX: [vmauth](https://docs.victoriametrics.com/vmauth.html): suppress [proxy protocol](https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt) parsing errors in case of `EOF`. Usually, the error is caused by health checks and is not a sign of an actual error.
|
||||||
|
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix displaying errors for each query. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3987).
|
||||||
|
|
||||||
## [v1.89.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.89.1)
|
## [v1.89.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.89.1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue