vmui: clarify usage instructions on the Raw Data page

This commit is contained in:
Yury Molodov 2024-11-21 15:22:54 +01:00
parent b2a1e5d782
commit ae6175a44e
No known key found for this signature in database
GPG key ID: 79AD43149C47BDE7
5 changed files with 51 additions and 11 deletions

View file

@ -15,6 +15,8 @@ import Alert from "../../../components/Main/Alert/Alert";
import qs from "qs"; import qs from "qs";
import Popper from "../../../components/Main/Popper/Popper"; import Popper from "../../../components/Main/Popper/Popper";
import helperText from "./helperText"; import helperText from "./helperText";
import { Link } from "react-router-dom";
import router from "../../../router";
type Props = { type Props = {
fetchUrl?: string[]; fetchUrl?: string[];
@ -125,6 +127,15 @@ const DownloadReport: FC<Props> = ({ fetchUrl }) => {
setStepHelper(0); setStepHelper(0);
}, [openHelper]); }, [openHelper]);
const RawQueryLink = () => (
<Link
className="vm-link vm-link_underlined vm-link_colored"
to={router.rawQuery}
>
Raw Query
</Link>
);
return ( return (
<> <>
<Tooltip title={"Export query"}> <Tooltip title={"Export query"}>
@ -165,6 +176,10 @@ const DownloadReport: FC<Props> = ({ fetchUrl }) => {
label={"Include query trace"} label={"Include query trace"}
/> />
</div> </div>
<Alert variant="info">
If confused with the query results,
try viewing the raw samples for selected series in <RawQueryLink/> tab.
</Alert>
</div> </div>
{error && <Alert variant="error">{error}</Alert>} {error && <Alert variant="error">{error}</Alert>}
<div className="vm-download-report__buttons"> <div className="vm-download-report__buttons">

View file

@ -4,14 +4,15 @@
display: grid; display: grid;
gap: $padding-large; gap: $padding-large;
padding-top: calc($padding-large - $padding-global); padding-top: calc($padding-large - $padding-global);
min-width: 400px; width: 700px;
max-width: 100%;
&-settings { &-settings {
display: grid; display: grid;
gap: $padding-global; gap: $padding-global;
textarea { textarea {
min-height: 100px; min-height: 200px;
} }
} }

View file

@ -74,7 +74,6 @@ export const useFetchExport = ({ hideQuery, showAllSeries }: FetchQueryParams):
try { try {
const tempData: MetricBase[] = []; const tempData: MetricBase[] = [];
const seriesLimit = showAllSeries ? Infinity : +stateSeriesLimits[displayType] || Infinity; const seriesLimit = showAllSeries ? Infinity : +stateSeriesLimits[displayType] || Infinity;
console.log(+stateSeriesLimits[displayType]);
let counter = 1; let counter = 1;
let totalLength = 0; let totalLength = 0;

View file

@ -18,6 +18,33 @@ import Hyperlink from "../../components/Main/Hyperlink/Hyperlink";
import { CloseIcon } from "../../components/Main/Icons"; import { CloseIcon } from "../../components/Main/Icons";
import Button from "../../components/Main/Button/Button"; import Button from "../../components/Main/Button/Button";
const RawSamplesLink = () => (
<Hyperlink
href="https://docs.victoriametrics.com/keyconcepts/#raw-samples"
underlined
>
raw samples
</Hyperlink>
);
const QueryDataLink = () => (
<Hyperlink
underlined
href="https://docs.victoriametrics.com/keyconcepts/#query-data"
>
Query API
</Hyperlink>
);
const TimeSeriesSelectorLink = () => (
<Hyperlink
underlined
href="https://docs.victoriametrics.com/keyconcepts/#filtering"
>
time series selector
</Hyperlink>
);
const RawQueryPage: FC = () => { const RawQueryPage: FC = () => {
useSetQueryParams(); useSetQueryParams();
const { isMobile } = useDeviceDetect(); const { isMobile } = useDeviceDetect();
@ -37,7 +64,7 @@ const RawQueryPage: FC = () => {
warning, warning,
queryErrors, queryErrors,
setQueryErrors, setQueryErrors,
abortFetch abortFetch,
} = useFetchExport({ hideQuery, showAllSeries }); } = useFetchExport({ hideQuery, showAllSeries });
const controlsRef = useRef<HTMLDivElement>(null); const controlsRef = useRef<HTMLDivElement>(null);
@ -80,12 +107,10 @@ const RawQueryPage: FC = () => {
<Alert variant="info"> <Alert variant="info">
<div className="vm-explore-metrics-header-description"> <div className="vm-explore-metrics-header-description">
<p> <p>
This page provides a dedicated view for querying and displaying raw samples from VictoriaMetrics. This page provides a dedicated view for querying and displaying <RawSamplesLink/> from VictoriaMetrics.
Users often assume that the <Hyperlink It expects only <TimeSeriesSelectorLink/> as a query argument.
underlined Users often assume that the <QueryDataLink/> returns data exactly as stored,
href="https://docs.victoriametrics.com/keyconcepts/#query-data" but data samples and timestamps may be modified by the API.
>Query
API</Hyperlink> returns data exactly as stored, but data samples and timestamps may be modified by the API.
</p> </p>
<Button <Button
variant="text" variant="text"

View file

@ -205,7 +205,7 @@ const filterPoints = (self: uPlot, seriesIdx: number): number[] | null => {
} }
} }
return indices.length > 0 ? indices : null; return indices;
}; };
type GetStrokeSeriesArgs = { type GetStrokeSeriesArgs = {