Skip to content

Commit

Permalink
vmui: Fix initial serverUrl for vmanomaly (VictoriaMetrics#6834)
Browse files Browse the repository at this point in the history
- fix TS lint
- anomaly: remove /vmui
- anomaly: minor inspections fix
- docs: fix broken links to headings

### Describe Your Changes

Initially vmanomaly opened with `/vmui` in serverUrl, remove it.
  • Loading branch information
dima-vm authored Aug 20, 2024
1 parent 2dba416 commit 535a9ed
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/vmui/packages/vmui/src/AppAnomaly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ExploreAnomaly from "./pages/ExploreAnomaly/ExploreAnomaly";
import router from "./router";
import CustomPanel from "./pages/CustomPanel";

const AppLogs: FC = () => {
const AppAnomaly: FC = () => {
const [loadedTheme, setLoadedTheme] = useState(false);

return <>
Expand Down Expand Up @@ -38,4 +38,4 @@ const AppLogs: FC = () => {
</>;
};

export default AppLogs;
export default AppAnomaly;
9 changes: 4 additions & 5 deletions app/vmui/packages/vmui/src/assets/MetricsQL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
sort: 23
weight: 23
title: MetricsQL
menu:
Expand Down Expand Up @@ -546,7 +545,7 @@ while [increase](#increase) ignores the first value in a series if it is too big

This function is usually applied to [counters](https://docs.victoriametrics.com/keyconcepts/#counter).

See also [increase](#increas) and [increase_prometheus](#increase_prometheus).
See also [increase](#increase) and [increase_prometheus](#increase_prometheus).

#### increases_over_time

Expand Down Expand Up @@ -955,7 +954,7 @@ See also [stddev_over_time](#stddev_over_time).

#### sum_eq_over_time

`sum_eq_over_time(series_selector[d], eq)` is a [rollup function](#rollup-function), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
`sum_eq_over_time(series_selector[d], eq)` is a [rollup function](#rollup-functions), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
values equal to `eq` on the given lookbehind window `d` per each time series returned from the given [series_selector](https://docs.victoriametrics.com/keyconcepts/#filtering).

Metric names are stripped from the resulting rollups. Add [keep_metric_names](#keep_metric_names) modifier in order to keep metric names.
Expand All @@ -966,7 +965,7 @@ See also [sum_over_time](#sum_over_time) and [count_eq_over_time](#count_eq_over

#### sum_gt_over_time

`sum_gt_over_time(series_selector[d], gt)` is a [rollup function](#rollup-function), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
`sum_gt_over_time(series_selector[d], gt)` is a [rollup function](#rollup-functions), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
values bigger than `gt` on the given lookbehind window `d` per each time series returned from the given [series_selector](https://docs.victoriametrics.com/keyconcepts/#filtering).

Metric names are stripped from the resulting rollups. Add [keep_metric_names](#keep_metric_names) modifier in order to keep metric names.
Expand All @@ -977,7 +976,7 @@ See also [sum_over_time](#sum_over_time) and [count_gt_over_time](#count_gt_over

#### sum_le_over_time

`sum_le_over_time(series_selector[d], le)` is a [rollup function](#rollup-function), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
`sum_le_over_time(series_selector[d], le)` is a [rollup function](#rollup-functions), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
values smaller or equal to `le` on the given lookbehind window `d` per each time series returned from the given [series_selector](https://docs.victoriametrics.com/keyconcepts/#filtering).

Metric names are stripped from the resulting rollups. Add [keep_metric_names](#keep_metric_names) modifier in order to keep metric names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const AnomalyConfig: FC = () => {
URL.revokeObjectURL(downloadUrl);
setTextConfig("");
setDownloadUrl("");
fetchConfig();
return fetchConfig();
};

return (
Expand Down
6 changes: 3 additions & 3 deletions app/vmui/packages/vmui/src/hooks/useSortedCategories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useMemo} from "preact/compat";
import {MetricBase} from "../api/types";
import { useMemo } from "preact/compat";
import { MetricBase } from "../api/types";

export type MetricCategory = {
key: string;
Expand All @@ -10,7 +10,7 @@ export const getColumns = (data: MetricBase[]): MetricCategory[] => {
const columns: { [key: string]: { options: Set<string> } } = {};
data.forEach(d =>
Object.entries(d.metric).forEach(e =>
columns[e[0]] ? columns[e[0]].options.add(e[1]) : columns[e[0]] = {options: new Set([e[1]])}
columns[e[0]] ? columns[e[0]].options.add(e[1]) : columns[e[0]] = { options: new Set([e[1]]) }
)
);

Expand Down
2 changes: 1 addition & 1 deletion app/vmui/packages/vmui/src/utils/default-server-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getDefaultServer = (tenantId?: string): string => {
const { serverURL } = getAppModeParams();
const storageURL = getFromStorage("SERVER_URL") as string;
const logsURL = window.location.href.replace(/\/(select\/)?(vmui)\/.*/, "");
const anomalyURL = `${window.location.origin}${window.location.pathname}`;
const anomalyURL = `${window.location.origin}${window.location.pathname.replace(/^\/vmui/, "")}`;
const defaultURL = window.location.href.replace(/\/(?:prometheus\/)?(?:graph|vmui)\/.*/, "/prometheus");
const url = serverURL || storageURL || defaultURL;

Expand Down
8 changes: 4 additions & 4 deletions docs/MetricsQL.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ while [increase](#increase) ignores the first value in a series if it is too big

This function is usually applied to [counters](https://docs.victoriametrics.com/keyconcepts/#counter).

See also [increase](#increas) and [increase_prometheus](#increase_prometheus).
See also [increase](#increase) and [increase_prometheus](#increase_prometheus).

#### increases_over_time

Expand Down Expand Up @@ -954,7 +954,7 @@ See also [stddev_over_time](#stddev_over_time).

#### sum_eq_over_time

`sum_eq_over_time(series_selector[d], eq)` is a [rollup function](#rollup-function), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
`sum_eq_over_time(series_selector[d], eq)` is a [rollup function](#rollup-functions), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
values equal to `eq` on the given lookbehind window `d` per each time series returned from the given [series_selector](https://docs.victoriametrics.com/keyconcepts/#filtering).

Metric names are stripped from the resulting rollups. Add [keep_metric_names](#keep_metric_names) modifier in order to keep metric names.
Expand All @@ -965,7 +965,7 @@ See also [sum_over_time](#sum_over_time) and [count_eq_over_time](#count_eq_over

#### sum_gt_over_time

`sum_gt_over_time(series_selector[d], gt)` is a [rollup function](#rollup-function), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
`sum_gt_over_time(series_selector[d], gt)` is a [rollup function](#rollup-functions), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
values bigger than `gt` on the given lookbehind window `d` per each time series returned from the given [series_selector](https://docs.victoriametrics.com/keyconcepts/#filtering).

Metric names are stripped from the resulting rollups. Add [keep_metric_names](#keep_metric_names) modifier in order to keep metric names.
Expand All @@ -976,7 +976,7 @@ See also [sum_over_time](#sum_over_time) and [count_gt_over_time](#count_gt_over

#### sum_le_over_time

`sum_le_over_time(series_selector[d], le)` is a [rollup function](#rollup-function), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
`sum_le_over_time(series_selector[d], le)` is a [rollup function](#rollup-functions), which calculates the sum of [raw sample](https://docs.victoriametrics.com/keyconcepts/#raw-samples)
values smaller or equal to `le` on the given lookbehind window `d` per each time series returned from the given [series_selector](https://docs.victoriametrics.com/keyconcepts/#filtering).

Metric names are stripped from the resulting rollups. Add [keep_metric_names](#keep_metric_names) modifier in order to keep metric names.
Expand Down

0 comments on commit 535a9ed

Please sign in to comment.