Alerting: Define rules.alerting.grafana.app/v0alpha1 AlertRule and RecordingRule
The first version of the app platform apis for alerting rules, including AlertRule and RecordingRule definitions. Co-authored-by: William Wernert <william.wernert@grafana.com>
This commit is contained in:
committed by
Moustafa Baiou
parent
4b416f89bf
commit
0a85a30642
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file was generated by grafana-app-sdk. DO NOT EDIT.
|
||||
*/
|
||||
import { Spec } from './types.spec.gen';
|
||||
import { Status } from './types.status.gen';
|
||||
|
||||
export interface Metadata {
|
||||
name: string;
|
||||
namespace: string;
|
||||
generateName?: string;
|
||||
selfLink?: string;
|
||||
uid?: string;
|
||||
resourceVersion?: string;
|
||||
generation?: number;
|
||||
creationTimestamp?: string;
|
||||
deletionTimestamp?: string;
|
||||
deletionGracePeriodSeconds?: number;
|
||||
labels?: Record<string, string>;
|
||||
annotations?: Record<string, string>;
|
||||
ownerReferences?: OwnerReference[];
|
||||
finalizers?: string[];
|
||||
managedFields?: ManagedFieldsEntry[];
|
||||
}
|
||||
|
||||
export interface OwnerReference {
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
name: string;
|
||||
uid: string;
|
||||
controller?: boolean;
|
||||
blockOwnerDeletion?: boolean;
|
||||
}
|
||||
|
||||
export interface ManagedFieldsEntry {
|
||||
manager?: string;
|
||||
operation?: string;
|
||||
apiVersion?: string;
|
||||
time?: string;
|
||||
fieldsType?: string;
|
||||
subresource?: string;
|
||||
}
|
||||
|
||||
export interface AlertRule {
|
||||
kind: string;
|
||||
apiVersion: string;
|
||||
metadata: Metadata;
|
||||
spec: Spec;
|
||||
status: Status;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
export interface Metadata {
|
||||
updateTimestamp: string;
|
||||
createdBy: string;
|
||||
uid: string;
|
||||
creationTimestamp: string;
|
||||
deletionTimestamp?: string;
|
||||
finalizers: string[];
|
||||
resourceVersion: string;
|
||||
generation: number;
|
||||
updatedBy: string;
|
||||
labels: Record<string, string>;
|
||||
}
|
||||
|
||||
export const defaultMetadata = (): Metadata => ({
|
||||
updateTimestamp: "",
|
||||
createdBy: "",
|
||||
uid: "",
|
||||
creationTimestamp: "",
|
||||
finalizers: [],
|
||||
resourceVersion: "",
|
||||
generation: 0,
|
||||
updatedBy: "",
|
||||
labels: {},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// TODO: validate that only one can specify source=true
|
||||
// & struct.MinFields(1) This doesn't work in Cue <v0.12.0 as per
|
||||
export type QueryMap = Record<string, Query>;
|
||||
|
||||
export const defaultQueryMap = (): QueryMap => ({});
|
||||
|
||||
// TODO: come up with a better name for this. We have expression type things and data source queries
|
||||
export interface Query {
|
||||
// TODO: consider making this optional, with the nil value meaning "__expr__" (i.e. expression query)
|
||||
queryType: string;
|
||||
relativeTimeRange?: RelativeTimeRange;
|
||||
datasourceUID: DatasourceUID;
|
||||
model: any;
|
||||
source?: boolean;
|
||||
}
|
||||
|
||||
export const defaultQuery = (): Query => ({
|
||||
queryType: "",
|
||||
datasourceUID: defaultDatasourceUID(),
|
||||
model: {},
|
||||
});
|
||||
|
||||
export interface RelativeTimeRange {
|
||||
from: PromDurationWMillis;
|
||||
to: PromDurationWMillis;
|
||||
}
|
||||
|
||||
export const defaultRelativeTimeRange = (): RelativeTimeRange => ({
|
||||
from: defaultPromDurationWMillis(),
|
||||
to: defaultPromDurationWMillis(),
|
||||
});
|
||||
|
||||
export type PromDurationWMillis = string;
|
||||
|
||||
export const defaultPromDurationWMillis = (): PromDurationWMillis => ("");
|
||||
|
||||
export type DatasourceUID = string;
|
||||
|
||||
export const defaultDatasourceUID = (): DatasourceUID => ("");
|
||||
|
||||
export interface IntervalTrigger {
|
||||
interval: PromDuration;
|
||||
}
|
||||
|
||||
export const defaultIntervalTrigger = (): IntervalTrigger => ({
|
||||
interval: defaultPromDuration(),
|
||||
});
|
||||
|
||||
export type PromDuration = string;
|
||||
|
||||
export const defaultPromDuration = (): PromDuration => ("");
|
||||
|
||||
// TODO(@moustafab): validate regex for time interval ref
|
||||
export type TimeIntervalRef = string;
|
||||
|
||||
export const defaultTimeIntervalRef = (): TimeIntervalRef => ("");
|
||||
|
||||
export type TemplateString = string;
|
||||
|
||||
export const defaultTemplateString = (): TemplateString => ("");
|
||||
|
||||
export interface Spec {
|
||||
title: string;
|
||||
data: QueryMap;
|
||||
paused?: boolean;
|
||||
trigger: IntervalTrigger;
|
||||
noDataState: string;
|
||||
execErrState: string;
|
||||
for?: string;
|
||||
keepFiringFor?: string;
|
||||
missingSeriesEvalsToResolve?: number;
|
||||
notificationSettings?: {
|
||||
receiver: string;
|
||||
groupBy?: string[];
|
||||
groupWait?: PromDuration;
|
||||
groupInterval?: PromDuration;
|
||||
repeatInterval?: PromDuration;
|
||||
muteTimeIntervals?: TimeIntervalRef[];
|
||||
activeTimeIntervals?: TimeIntervalRef[];
|
||||
};
|
||||
annotations?: Record<string, TemplateString>;
|
||||
labels?: Record<string, TemplateString>;
|
||||
panelRef?: {
|
||||
dashboardUID: string;
|
||||
panelID: number;
|
||||
};
|
||||
}
|
||||
|
||||
export const defaultSpec = (): Spec => ({
|
||||
title: "",
|
||||
data: defaultQueryMap(),
|
||||
trigger: defaultIntervalTrigger(),
|
||||
noDataState: "NoData",
|
||||
execErrState: "Error",
|
||||
});
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
export interface OperatorState {
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
lastEvaluation: string;
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
state: "success" | "in_progress" | "failed";
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
descriptiveState?: string;
|
||||
// details contains any extra information that is operator-specific
|
||||
details?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultOperatorState = (): OperatorState => ({
|
||||
lastEvaluation: "",
|
||||
state: "success",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
operatorStates?: Record<string, OperatorState>;
|
||||
// additionalFields is reserved for future use
|
||||
additionalFields?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultStatus = (): Status => ({
|
||||
});
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file was generated by grafana-app-sdk. DO NOT EDIT.
|
||||
*/
|
||||
import { Spec } from './types.spec.gen';
|
||||
import { Status } from './types.status.gen';
|
||||
|
||||
export interface Metadata {
|
||||
name: string;
|
||||
namespace: string;
|
||||
generateName?: string;
|
||||
selfLink?: string;
|
||||
uid?: string;
|
||||
resourceVersion?: string;
|
||||
generation?: number;
|
||||
creationTimestamp?: string;
|
||||
deletionTimestamp?: string;
|
||||
deletionGracePeriodSeconds?: number;
|
||||
labels?: Record<string, string>;
|
||||
annotations?: Record<string, string>;
|
||||
ownerReferences?: OwnerReference[];
|
||||
finalizers?: string[];
|
||||
managedFields?: ManagedFieldsEntry[];
|
||||
}
|
||||
|
||||
export interface OwnerReference {
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
name: string;
|
||||
uid: string;
|
||||
controller?: boolean;
|
||||
blockOwnerDeletion?: boolean;
|
||||
}
|
||||
|
||||
export interface ManagedFieldsEntry {
|
||||
manager?: string;
|
||||
operation?: string;
|
||||
apiVersion?: string;
|
||||
time?: string;
|
||||
fieldsType?: string;
|
||||
subresource?: string;
|
||||
}
|
||||
|
||||
export interface RecordingRule {
|
||||
kind: string;
|
||||
apiVersion: string;
|
||||
metadata: Metadata;
|
||||
spec: Spec;
|
||||
status: Status;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// metadata contains embedded CommonMetadata and can be extended with custom string fields
|
||||
// TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
|
||||
// without external reference as using the CommonMetadata reference breaks thema codegen.
|
||||
export interface Metadata {
|
||||
updateTimestamp: string;
|
||||
createdBy: string;
|
||||
uid: string;
|
||||
creationTimestamp: string;
|
||||
deletionTimestamp?: string;
|
||||
finalizers: string[];
|
||||
resourceVersion: string;
|
||||
generation: number;
|
||||
updatedBy: string;
|
||||
labels: Record<string, string>;
|
||||
}
|
||||
|
||||
export const defaultMetadata = (): Metadata => ({
|
||||
updateTimestamp: "",
|
||||
createdBy: "",
|
||||
uid: "",
|
||||
creationTimestamp: "",
|
||||
finalizers: [],
|
||||
resourceVersion: "",
|
||||
generation: 0,
|
||||
updatedBy: "",
|
||||
labels: {},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
// TODO: validate that only one can specify source=true
|
||||
// & struct.MinFields(1) This doesn't work in Cue <v0.12.0 as per
|
||||
export type QueryMap = Record<string, Query>;
|
||||
|
||||
export const defaultQueryMap = (): QueryMap => ({});
|
||||
|
||||
// TODO: come up with a better name for this. We have expression type things and data source queries
|
||||
export interface Query {
|
||||
// TODO: consider making this optional, with the nil value meaning "__expr__" (i.e. expression query)
|
||||
queryType: string;
|
||||
relativeTimeRange?: RelativeTimeRange;
|
||||
datasourceUID: DatasourceUID;
|
||||
model: any;
|
||||
source?: boolean;
|
||||
}
|
||||
|
||||
export const defaultQuery = (): Query => ({
|
||||
queryType: "",
|
||||
datasourceUID: defaultDatasourceUID(),
|
||||
model: {},
|
||||
});
|
||||
|
||||
export interface RelativeTimeRange {
|
||||
from: PromDurationWMillis;
|
||||
to: PromDurationWMillis;
|
||||
}
|
||||
|
||||
export const defaultRelativeTimeRange = (): RelativeTimeRange => ({
|
||||
from: defaultPromDurationWMillis(),
|
||||
to: defaultPromDurationWMillis(),
|
||||
});
|
||||
|
||||
export type PromDurationWMillis = string;
|
||||
|
||||
export const defaultPromDurationWMillis = (): PromDurationWMillis => ("");
|
||||
|
||||
export type DatasourceUID = string;
|
||||
|
||||
export const defaultDatasourceUID = (): DatasourceUID => ("");
|
||||
|
||||
export interface IntervalTrigger {
|
||||
interval: PromDuration;
|
||||
}
|
||||
|
||||
export const defaultIntervalTrigger = (): IntervalTrigger => ({
|
||||
interval: defaultPromDuration(),
|
||||
});
|
||||
|
||||
export type PromDuration = string;
|
||||
|
||||
export const defaultPromDuration = (): PromDuration => ("");
|
||||
|
||||
export type TemplateString = string;
|
||||
|
||||
export const defaultTemplateString = (): TemplateString => ("");
|
||||
|
||||
export interface Spec {
|
||||
title: string;
|
||||
data: QueryMap;
|
||||
paused?: boolean;
|
||||
trigger: IntervalTrigger;
|
||||
metric: string;
|
||||
labels?: Record<string, TemplateString>;
|
||||
targetDatasourceUID: string;
|
||||
}
|
||||
|
||||
export const defaultSpec = (): Spec => ({
|
||||
title: "",
|
||||
data: defaultQueryMap(),
|
||||
trigger: defaultIntervalTrigger(),
|
||||
metric: "",
|
||||
targetDatasourceUID: "",
|
||||
});
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
export interface OperatorState {
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
lastEvaluation: string;
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
state: "success" | "in_progress" | "failed";
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
descriptiveState?: string;
|
||||
// details contains any extra information that is operator-specific
|
||||
details?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultOperatorState = (): OperatorState => ({
|
||||
lastEvaluation: "",
|
||||
state: "success",
|
||||
});
|
||||
|
||||
export interface Status {
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
operatorStates?: Record<string, OperatorState>;
|
||||
// additionalFields is reserved for future use
|
||||
additionalFields?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const defaultStatus = (): Status => ({
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user