mirror of
https://github.com/grafana/grafana.git
synced 2025-09-20 06:31:25 +08:00

* adds alertstatehistory backend config to grafanaBootData * add alertStateHistory api * show different ASH modal when using loki implementation * group log lines by instance (unique set of labels) Co-Authored-By: Konrad Lalik <konrad.lalik@grafana.com> * render log lines for each instance Co-Authored-By: Konrad Lalik <konrad.lalik@grafana.com> * Add visual improvements to the log record of state changes * Add values to log records * compute common labels and show unique labels * Add state changes visualization * fix common labels extraction * Code cleanup * Add timespan-based log record view * WIP * scroll to timestamp - poc * Use SortedVector for timestamp field * add conditional accessor for frames * update some of the log formats and styles * Timestamp-based visualization with scrolling * minor improvements * Split Loki's state history viewer into multiple files * Add memoization to prevent graph rerender on filter updates * make chart size shrink when fewer instances * style updates * show warning when instances are hidden * Add basic label-based filtering * Improve label-based filtering * Add regex validation * Improve no instances message when everything was filtered out * Update warning message * Move timeline viewer to a separate file, refactor handling timeline pointer changes * Remove unused component, add comments * Fix test snapshot, fix type error * adds tests for common.ts * Add tests for converting log records into data frames * Add basic component test, fix type guards * Use a constant for timeseries limit * Improve a11y, update component test * Memoize AlertStateTag, migrate from deprecated ArrayVector * Update public/app/features/alerting/unified/components/rules/state-history/common.ts * Move helper hook into a separate file. Add Search input component * Change the limit of visible time series on the timeline * Add LogRecordViewer perf improvements, refactor timeline cursor events tracking * Use callback to pass timeline refs * Add grouping tests for the log record viewer --------- Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
17 lines
503 B
TypeScript
17 lines
503 B
TypeScript
import { getUnixTime } from 'date-fns';
|
|
|
|
import { DataFrameJSON } from '@grafana/data';
|
|
|
|
import { alertingApi } from './alertingApi';
|
|
|
|
export const stateHistoryApi = alertingApi.injectEndpoints({
|
|
endpoints: (build) => ({
|
|
getRuleHistory: build.query<DataFrameJSON, { ruleUid: string; from: number; to?: number }>({
|
|
query: ({ ruleUid, from, to = getUnixTime(new Date()) }) => ({
|
|
url: '/api/v1/rules/history',
|
|
params: { ruleUID: ruleUid, from, to },
|
|
}),
|
|
}),
|
|
}),
|
|
});
|