grafana / cog

Code Generation with a human touch
Apache License 2.0
43 stars 2 forks source link

Compiler pass/prefix object names #430

Closed K-Phoen closed 3 months ago

K-Phoen commented 3 months ago

Adds a compiler pass that alters object names to add a prefix to them.

This is to support an existing feature in grafana-app-sdk's codegen: https://github.com/grafana/grafana-app-sdk/blob/9643ce43ef07d9218303db5722be6e04ab9d1f3b/codegen/jennies/gotypes.go#L174-L175

Contributes to #408

github-actions[bot] commented 3 months ago

Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in main.

### 🔎 Changes to `grafana-foundation-sdk@next+cog-v0.0.x` ```patch diff --git a/go/alerting/types_gen.go b/go/alerting/types_gen.go index 3f3142d..d35d15f 100644 --- a/go/alerting/types_gen.go +++ b/go/alerting/types_gen.go @@ -10,94 +10,6 @@ import ( cogvariants "github.com/grafana/grafana-foundation-sdk/go/cog/variants" ) -// Duration in seconds. -type Duration int64 - -type Json any - -type MatchRegexps map[string]string - -type MatchType int64 - -type Matcher struct { - Name *string `json:"Name,omitempty"` - Type *MatchType `json:"Type,omitempty"` - Value *string `json:"Value,omitempty"` -} - -// Matchers is a slice of Matchers that is sortable, implements Stringer, and -// provides a Matches method to match a LabelSet against all Matchers in the -// slice. Note that some users of Matchers might require it to be sorted. -type Matchers []Matcher - -type NotificationTemplate struct { - Name *string `json:"name,omitempty"` - Provenance *Provenance `json:"provenance,omitempty"` - Template *string `json:"template,omitempty"` -} - -type ObjectMatcher []string - -type ObjectMatchers []ObjectMatcher - -type Provenance string - -// RelativeTimeRange is the per query start and end time -// for requests. -type RelativeTimeRange struct { - // RelativeTimeRange is the per query start and end time - // for requests. - From *Duration `json:"from,omitempty"` - // RelativeTimeRange is the per query start and end time - // for requests. - To *Duration `json:"to,omitempty"` -} - -type TimeInterval struct { - Name *string `json:"name,omitempty"` - TimeIntervals []TimeInterval `json:"time_intervals,omitempty"` -} - -type RuleGroup struct { - FolderUid *string `json:"folderUid,omitempty"` - // The interval, in seconds, at which all rules in the group are evaluated. - // If a group contains many rules, the rules are evaluated sequentially. - Interval *Duration `json:"interval,omitempty"` - Rules []Rule `json:"rules,omitempty"` - Title *string `json:"title,omitempty"` -} - -type Rule struct { - Annotations map[string]string `json:"annotations,omitempty"` - Condition string `json:"condition"` - Data []Query `json:"data"` - ExecErrState RuleExecErrState `json:"execErrState"` - FolderUID string `json:"folderUID"` - // The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing. - // Before this time has elapsed, the rule is only considered to be Pending. - For string `json:"for"` - Id *int64 `json:"id,omitempty"` - IsPaused *bool `json:"isPaused,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - NoDataState RuleNoDataState `json:"noDataState"` - NotificationSettings *NotificationSettings `json:"notification_settings,omitempty"` - OrgID int64 `json:"orgID"` - Provenance *Provenance `json:"provenance,omitempty"` - RuleGroup string `json:"ruleGroup"` - Title string `json:"title"` - Uid *string `json:"uid,omitempty"` - Updated *time.Time `json:"updated,omitempty"` -} - -type NotificationSettings struct { - GroupBy []string `json:"group_by,omitempty"` - GroupInterval *string `json:"group_interval,omitempty"` - GroupWait *string `json:"group_wait,omitempty"` - MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"` - Receiver string `json:"receiver"` - RepeatInterval *string `json:"repeat_interval,omitempty"` -} - type Query struct { DatasourceUid *string `json:"datasourceUid,omitempty"` Model cogvariants.Dataquery `json:"model,omitempty"` @@ -152,6 +64,27 @@ func (resource *Query) UnmarshalJSON(raw []byte) error { return nil } +type RuleGroup struct { + FolderUid *string `json:"folderUid,omitempty"` + // The interval, in seconds, at which all rules in the group are evaluated. + // If a group contains many rules, the rules are evaluated sequentially. + Interval *Duration `json:"interval,omitempty"` + Rules []Rule `json:"rules,omitempty"` + Title *string `json:"title,omitempty"` +} + +type NotificationSettings struct { + GroupBy []string `json:"group_by,omitempty"` + GroupInterval *string `json:"group_interval,omitempty"` + GroupWait *string `json:"group_wait,omitempty"` + MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"` + Receiver string `json:"receiver"` + RepeatInterval *string `json:"repeat_interval,omitempty"` +} + +// Duration in seconds. +type Duration int64 + // EmbeddedContactPoint is the contact point type that is used // by grafanas embedded alertmanager implementation. type ContactPoint struct { @@ -175,6 +108,73 @@ type ContactPoint struct { Uid *string `json:"uid,omitempty"` } +type Json any + +type MatchRegexps map[string]string + +type MatchType int64 + +type Matcher struct { + Name *string `json:"Name,omitempty"` + Type *MatchType `json:"Type,omitempty"` + Value *string `json:"Value,omitempty"` +} + +// Matchers is a slice of Matchers that is sortable, implements Stringer, and +// provides a Matches method to match a LabelSet against all Matchers in the +// slice. Note that some users of Matchers might require it to be sorted. +type Matchers []Matcher + +type MuteTiming struct { + Name *string `json:"name,omitempty"` + TimeIntervals []TimeInterval `json:"time_intervals,omitempty"` +} + +type NotificationTemplate struct { + Name *string `json:"name,omitempty"` + Provenance *Provenance `json:"provenance,omitempty"` + Template *string `json:"template,omitempty"` +} + +type ObjectMatcher []string + +type ObjectMatchers []ObjectMatcher + +type Provenance string + +type Rule struct { + Annotations map[string]string `json:"annotations,omitempty"` + Condition string `json:"condition"` + Data []Query `json:"data"` + ExecErrState RuleExecErrState `json:"execErrState"` + FolderUID string `json:"folderUID"` + // The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing. + // Before this time has elapsed, the rule is only considered to be Pending. + For string `json:"for"` + Id *int64 `json:"id,omitempty"` + IsPaused *bool `json:"isPaused,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + NoDataState RuleNoDataState `json:"noDataState"` + NotificationSettings *NotificationSettings `json:"notification_settings,omitempty"` + OrgID int64 `json:"orgID"` + Provenance *Provenance `json:"provenance,omitempty"` + RuleGroup string `json:"ruleGroup"` + Title string `json:"title"` + Uid *string `json:"uid,omitempty"` + Updated *time.Time `json:"updated,omitempty"` +} + +// RelativeTimeRange is the per query start and end time +// for requests. +type RelativeTimeRange struct { + // RelativeTimeRange is the per query start and end time + // for requests. + From *Duration `json:"from,omitempty"` + // RelativeTimeRange is the per query start and end time + // for requests. + To *Duration `json:"to,omitempty"` +} + // A Route is a node that contains definitions of how to handle alerts. This is modified // from the upstream alertmanager in that it adds the ObjectMatchers property. type NotificationPolicy struct { @@ -219,27 +219,11 @@ type NotificationPolicy struct { Routes []NotificationPolicy `json:"routes,omitempty"` } -type MuteTiming struct { +type TimeInterval struct { Name *string `json:"name,omitempty"` TimeIntervals []TimeInterval `json:"time_intervals,omitempty"` } -type RuleExecErrState string - -const ( - RuleExecErrStateOK RuleExecErrState = "OK" - RuleExecErrStateAlerting RuleExecErrState = "Alerting" - RuleExecErrStateError RuleExecErrState = "Error" -) - -type RuleNoDataState string - -const ( - RuleNoDataStateAlerting RuleNoDataState = "Alerting" - RuleNoDataStateNoData RuleNoDataState = "NoData" - RuleNoDataStateOK RuleNoDataState = "OK" -) - type ContactPointType string const ( @@ -262,3 +246,19 @@ const ( ContactPointTypeWebhook ContactPointType = " webhook" ContactPointTypeWecom ContactPointType = " wecom" ) + +type RuleExecErrState string + +const ( + RuleExecErrStateOK RuleExecErrState = "OK" + RuleExecErrStateAlerting RuleExecErrState = "Alerting" + RuleExecErrStateError RuleExecErrState = "Error" +) + +type RuleNoDataState string + +const ( + RuleNoDataStateAlerting RuleNoDataState = "Alerting" + RuleNoDataStateNoData RuleNoDataState = "NoData" + RuleNoDataStateOK RuleNoDataState = "OK" +) diff --git a/go/azuremonitor/azurelogsquery_builder_gen.go b/go/azuremonitor/azurelogsquery_builder_gen.go index 076f120..48a2d9a 100644 --- a/go/azuremonitor/azurelogsquery_builder_gen.go +++ b/go/azuremonitor/azurelogsquery_builder_gen.go @@ -75,6 +75,13 @@ func (builder *AzureLogsQueryBuilder) TimeColumn(timeColumn string) *AzureLogsQu return builder } +// If set to true the query will be run as a basic logs query +func (builder *AzureLogsQueryBuilder) BasicLogsQuery(basicLogsQuery bool) *AzureLogsQueryBuilder { + builder.internal.BasicLogsQuery = &basicLogsQuery + + return builder +} + // Workspace ID. This was removed in Grafana 8, but remains for backwards compat. func (builder *AzureLogsQueryBuilder) Workspace(workspace string) *AzureLogsQueryBuilder { builder.internal.Workspace = &workspace diff --git a/go/azuremonitor/types_gen.go b/go/azuremonitor/types_gen.go index 0e98f37..0e789fb 100644 --- a/go/azuremonitor/types_gen.go +++ b/go/azuremonitor/types_gen.go @@ -136,6 +136,8 @@ type AzureLogsQuery struct { DashboardTime *bool `json:"dashboardTime,omitempty"` // If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated TimeColumn *string `json:"timeColumn,omitempty"` + // If set to true the query will be run as a basic logs query + BasicLogsQuery *bool `json:"basicLogsQuery,omitempty"` // Workspace ID. This was removed in Grafana 8, but remains for backwards compat. Workspace *string `json:"workspace,omitempty"` // @deprecated Use resources instead diff --git a/go/common/types_gen.go b/go/common/types_gen.go index 6389be0..515fd60 100644 --- a/go/common/types_gen.go +++ b/go/common/types_gen.go @@ -492,6 +492,15 @@ const ( BigValueTextModeNone BigValueTextMode = "none" ) +// TODO docs +type PercentChangeColorMode string + +const ( + PercentChangeColorModeStandard PercentChangeColorMode = "standard" + PercentChangeColorModeInverted PercentChangeColorMode = "inverted" + PercentChangeColorModeSameAsValue PercentChangeColorMode = "same_as_value" +) + // TODO -- should not be table specific! // TODO docs type FieldTextAlignment string diff --git a/go/stat/panel_builder_gen.go b/go/stat/panel_builder_gen.go index f3223dd..eaf3847 100644 --- a/go/stat/panel_builder_gen.go +++ b/go/stat/panel_builder_gen.go @@ -460,6 +460,15 @@ func (builder *PanelBuilder) WideLayout(wideLayout bool) *PanelBuilder { return builder } +func (builder *PanelBuilder) ShowPercentChange(showPercentChange bool) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).ShowPercentChange = showPercentChange + + return builder +} + func (builder *PanelBuilder) ReduceOptions(reduceOptions cog.Builder[common.ReduceDataOptions]) *PanelBuilder { if builder.internal.Options == nil { builder.internal.Options = &Options{} @@ -488,11 +497,11 @@ func (builder *PanelBuilder) Text(text cog.Builder[common.VizTextDisplayOptions] return builder } -func (builder *PanelBuilder) ShowPercentChange(showPercentChange bool) *PanelBuilder { +func (builder *PanelBuilder) PercentChangeColorMode(percentChangeColorMode common.PercentChangeColorMode) *PanelBuilder { if builder.internal.Options == nil { builder.internal.Options = &Options{} } - builder.internal.Options.(*Options).ShowPercentChange = showPercentChange + builder.internal.Options.(*Options).PercentChangeColorMode = percentChangeColorMode return builder } @@ -516,4 +525,5 @@ func (builder *PanelBuilder) applyDefaults() { builder.TextMode("auto") builder.WideLayout(true) builder.ShowPercentChange(false) + builder.PercentChangeColorMode("standard") } diff --git a/go/stat/types_gen.go b/go/stat/types_gen.go index dacf902..5f75c28 100644 --- a/go/stat/types_gen.go +++ b/go/stat/types_gen.go @@ -10,15 +10,16 @@ import ( ) type Options struct { - GraphMode common.BigValueGraphMode `json:"graphMode"` - ColorMode common.BigValueColorMode `json:"colorMode"` - JustifyMode common.BigValueJustifyMode `json:"justifyMode"` - TextMode common.BigValueTextMode `json:"textMode"` - WideLayout bool `json:"wideLayout"` - ReduceOptions common.ReduceDataOptions `json:"reduceOptions"` - Text *common.VizTextDisplayOptions `json:"text,omitempty"` - ShowPercentChange bool `json:"showPercentChange"` - Orientation common.VizOrientation `json:"orientation"` + GraphMode common.BigValueGraphMode `json:"graphMode"` + ColorMode common.BigValueColorMode `json:"colorMode"` + JustifyMode common.BigValueJustifyMode `json:"justifyMode"` + TextMode common.BigValueTextMode `json:"textMode"` + WideLayout bool `json:"wideLayout"` + ShowPercentChange bool `json:"showPercentChange"` + ReduceOptions common.ReduceDataOptions `json:"reduceOptions"` + Text *common.VizTextDisplayOptions `json:"text,omitempty"` + PercentChangeColorMode common.PercentChangeColorMode `json:"percentChangeColorMode"` + Orientation common.VizOrientation `json:"orientation"` } func VariantConfig() cogvariants.PanelcfgConfig { diff --git a/go/testdata/types_gen.go b/go/testdata/types_gen.go index 1acbdf9..1762f09 100644 --- a/go/testdata/types_gen.go +++ b/go/testdata/types_gen.go @@ -8,6 +8,105 @@ import ( cogvariants "github.com/grafana/grafana-foundation-sdk/go/cog/variants" ) +type CSVWave struct { + Labels *string `json:"labels,omitempty"` + Name *string `json:"name,omitempty"` + TimeStep *int64 `json:"timeStep,omitempty"` + ValuesCSV *string `json:"valuesCSV,omitempty"` +} + +type Datasource struct { + // The apiserver version + ApiVersion *string `json:"apiVersion,omitempty"` + // The datasource plugin type + Type string `json:"type"` + // Datasource UID (NOTE: name in k8s) + Uid *string `json:"uid,omitempty"` +} + +type NodesQuery struct { + Count *int64 `json:"count,omitempty"` + Seed *int64 `json:"seed,omitempty"` + // Possible enum values: + // - `"random"` + // - `"random edges"` + // - `"response_medium"` + // - `"response_small"` + // - `"feature_showcase"` + Type *NodesQueryType `json:"type,omitempty"` +} + +type PulseWaveQuery struct { + OffCount *int64 `json:"offCount,omitempty"` + OffValue *float64 `json:"offValue,omitempty"` + OnCount *int64 `json:"onCount,omitempty"` + OnValue *float64 `json:"onValue,omitempty"` + TimeStep *int64 `json:"timeStep,omitempty"` +} + +type ResultAssertions struct { + // Maximum frame count + MaxFrames *int64 `json:"maxFrames,omitempty"` + // Type asserts that the frame matches a known type structure. + // Possible enum values: + // - `""` + // - `"timeseries-wide"` + // - `"timeseries-long"` + // - `"timeseries-many"` + // - `"timeseries-multi"` + // - `"directory-listing"` + // - `"table"` + // - `"numeric-wide"` + // - `"numeric-multi"` + // - `"numeric-long"` + // - `"log-lines"` + Type *ResultAssertionsType `json:"type,omitempty"` + // TypeVersion is the version of the Type property. Versions greater than 0.0 correspond to the dataplane + // contract documentation https://grafana.github.io/dataplane/contract/. + TypeVersion []int64 `json:"typeVersion"` +} + +type Key struct { + Tick float64 `json:"tick"` + Type string `json:"type"` + Uid *string `json:"uid,omitempty"` +} + +type SimulationQuery struct { + Config any `json:"config,omitempty"` + Key Key `json:"key"` + Last *bool `json:"last,omitempty"` + Stream *bool `json:"stream,omitempty"` +} + +type StreamingQuery struct { + Bands *int64 `json:"bands,omitempty"` + Noise float64 `json:"noise"` + Speed float64 `json:"speed"` + Spread float64 `json:"spread"` + // Possible enum values: + // - `"fetch"` + // - `"logs"` + // - `"signal"` + // - `"traces"` + Type StreamingQueryType `json:"type"` + Url *string `json:"url,omitempty"` +} + +type TimeRange struct { + // From is the start time of the query. + From string `json:"from"` + // To is the end time of the query. + To string `json:"to"` +} + +type USAQuery struct { + Fields []string `json:"fields,omitempty"` + Mode *string `json:"mode,omitempty"` + Period *string `json:"period,omitempty"` + States []string `json:"states,omitempty"` +} + type Dataquery struct { Alias *string `json:"alias,omitempty"` // Used for live query @@ -118,104 +217,40 @@ func VariantConfig() cogvariants.DataqueryConfig { } } -type CSVWave struct { - Labels *string `json:"labels,omitempty"` - Name *string `json:"name,omitempty"` - TimeStep *int64 `json:"timeStep,omitempty"` - ValuesCSV *string `json:"valuesCSV,omitempty"` -} - -type Datasource struct { - // The apiserver version - ApiVersion *string `json:"apiVersion,omitempty"` - // The datasource plugin type - Type string `json:"type"` - // Datasource UID (NOTE: name in k8s) - Uid *string `json:"uid,omitempty"` -} - -type NodesQuery struct { - Count *int64 `json:"count,omitempty"` - Seed *int64 `json:"seed,omitempty"` - // Possible enum values: - // - `"random"` - // - `"random edges"` - // - `"response_medium"` - // - `"response_small"` - // - `"feature_showcase"` - Type *NodesQueryType `json:"type,omitempty"` -} - -type PulseWaveQuery struct { - OffCount *int64 `json:"offCount,omitempty"` - OffValue *float64 `json:"offValue,omitempty"` - OnCount *int64 `json:"onCount,omitempty"` - OnValue *float64 `json:"onValue,omitempty"` - TimeStep *int64 `json:"timeStep,omitempty"` -} - -type ResultAssertions struct { - // Maximum frame count - MaxFrames *int64 `json:"maxFrames,omitempty"` - // Type asserts that the frame matches a known type structure. - // Possible enum values: - // - `""` - // - `"timeseries-wide"` - // - `"timeseries-long"` - // - `"timeseries-many"` - // - `"timeseries-multi"` - // - `"directory-listing"` - // - `"table"` - // - `"numeric-wide"` - // - `"numeric-multi"` - // - `"numeric-long"` - // - `"log-lines"` - Type *ResultAssertionsType `json:"type,omitempty"` - // TypeVersion is the version of the Type property. Versions greater than 0.0 correspond to the dataplane - // contract documentation https://grafana.github.io/dataplane/contract/. - TypeVersion []int64 `json:"typeVersion"` -} +type NodesQueryType string -type Key struct { - Tick float64 `json:"tick"` - Type string `json:"type"` - Uid *string `json:"uid,omitempty"` -} +const ( + NodesQueryTypeRandom NodesQueryType = "random" + NodesQueryTypeRandomEdges NodesQueryType = "random edges" + NodesQueryTypeResponseMedium NodesQueryType = "response_medium" + NodesQueryTypeResponseSmall NodesQueryType = "response_small" + NodesQueryTypeFeatureShowcase NodesQueryType = "feature_showcase" +) -type SimulationQuery struct { - Config any `json:"config,omitempty"` - Key Key `json:"key"` - Last *bool `json:"last,omitempty"` - Stream *bool `json:"stream,omitempty"` -} +type ResultAssertionsType string -type StreamingQuery struct { - Bands *int64 `json:"bands,omitempty"` - Noise float64 `json:"noise"` - Speed float64 `json:"speed"` - Spread float64 `json:"spread"` - // Possible enum values: - // - `"fetch"` - // - `"logs"` - // - `"signal"` - // - `"traces"` - Type StreamingQueryType `json:"type"` - Url *string `json:"url,omitempty"` -} +const ( + ResultAssertionsTypeNone ResultAssertionsType = "" + ResultAssertionsTypeTimeseriesWide ResultAssertionsType = "timeseries-wide" + ResultAssertionsTypeTimeseriesLong ResultAssertionsType = "timeseries-long" + ResultAssertionsTypeTimeseriesMany ResultAssertionsType = "timeseries-many" + ResultAssertionsTypeTimeseriesMulti ResultAssertionsType = "timeseries-multi" + ResultAssertionsTypeDirectoryListing ResultAssertionsType = "directory-listing" + ResultAssertionsTypeTable ResultAssertionsType = "table" + ResultAssertionsTypeNumericWide ResultAssertionsType = "numeric-wide" + ResultAssertionsTypeNumericMulti ResultAssertionsType = "numeric-multi" + ResultAssertionsTypeNumericLong ResultAssertionsType = "numeric-long" + ResultAssertionsTypeLogLines ResultAssertionsType = "log-lines" +) -type TimeRange struct { - // From is the start time of the query. - From string `json:"from"` - // To is the end time of the query. - To string `json:"to"` -} +type StreamingQueryType string -type USAQuery struct { - Fields []string `json:"fields,omitempty"` - Mode *string `json:"mode,omitempty"` - Period *string `json:"period,omitempty"` - States []string `json:"states,omitempty"` -} +const ( + StreamingQueryTypeFetch StreamingQueryType = "fetch" + StreamingQueryTypeLogs StreamingQueryType = "logs" + StreamingQueryTypeSignal StreamingQueryType = "signal" + StreamingQueryTypeTraces StreamingQueryType = "traces" +) type DataqueryErrorType string @@ -258,38 +293,3 @@ const ( DataqueryScenarioIdUsa DataqueryScenarioId = "usa" DataqueryScenarioIdVariablesQuery DataqueryScenarioId = "variables-query" ) - -type NodesQueryType string - -const ( - NodesQueryTypeRandom NodesQueryType = "random" - NodesQueryTypeRandomEdges NodesQueryType = "random edges" - NodesQueryTypeResponseMedium NodesQueryType = "response_medium" - NodesQueryTypeResponseSmall NodesQueryType = "response_small" - NodesQueryTypeFeatureShowcase NodesQueryType = "feature_showcase" -) - -type ResultAssertionsType string - -const ( - ResultAssertionsTypeNone ResultAssertionsType = "" - ResultAssertionsTypeTimeseriesWide ResultAssertionsType = "timeseries-wide" - ResultAssertionsTypeTimeseriesLong ResultAssertionsType = "timeseries-long" - ResultAssertionsTypeTimeseriesMany ResultAssertionsType = "timeseries-many" - ResultAssertionsTypeTimeseriesMulti ResultAssertionsType = "timeseries-multi" - ResultAssertionsTypeDirectoryListing ResultAssertionsType = "directory-listing" - ResultAssertionsTypeTable ResultAssertionsType = "table" - ResultAssertionsTypeNumericWide ResultAssertionsType = "numeric-wide" - ResultAssertionsTypeNumericMulti ResultAssertionsType = "numeric-multi" - ResultAssertionsTypeNumericLong ResultAssertionsType = "numeric-long" - ResultAssertionsTypeLogLines ResultAssertionsType = "log-lines" -) - -type StreamingQueryType string - -const ( - StreamingQueryTypeFetch StreamingQueryType = "fetch" - StreamingQueryTypeLogs StreamingQueryType = "logs" - StreamingQueryTypeSignal StreamingQueryType = "signal" - StreamingQueryTypeTraces StreamingQueryType = "traces" -) diff --git a/jsonschema/alerting.jsonschema.json b/jsonschema/alerting.jsonschema.json index 08c2bbc..776dc60 100644 --- a/jsonschema/alerting.jsonschema.json +++ b/jsonschema/alerting.jsonschema.json @@ -1,10 +1,147 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { + "Query": { + "type": "object", + "additionalProperties": false, + "properties": { + "datasourceUid": { + "type": "string" + }, + "model": { + "type": "object", + "additionalProperties": {} + }, + "queryType": { + "type": "string" + }, + "refId": { + "type": "string" + }, + "relativeTimeRange": { + "$ref": "#/definitions/RelativeTimeRange" + } + } + }, + "RuleGroup": { + "type": "object", + "additionalProperties": false, + "properties": { + "folderUid": { + "type": "string" + }, + "interval": { + "$ref": "#/definitions/Duration", + "description": "The interval, in seconds, at which all rules in the group are evaluated.\nIf a group contains many rules, the rules are evaluated sequentially." + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/Rule" + } + }, + "title": { + "type": "string" + } + } + }, + "NotificationSettings": { + "type": "object", + "additionalProperties": false, + "required": [ + "receiver" + ], + "properties": { + "group_by": { + "type": "array", + "items": { + "type": "string" + }, + "default": [ + "alertname", + "grafana_folder" + ] + }, + "group_interval": { + "type": "string" + }, + "group_wait": { + "type": "string" + }, + "mute_time_intervals": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiver": { + "type": "string" + }, + "repeat_interval": { + "type": "string" + } + } + }, "Duration": { "type": "integer", "description": "Duration in seconds." }, + "ContactPoint": { + "type": "object", + "additionalProperties": false, + "required": [ + "settings", + "type" + ], + "properties": { + "disableResolveMessage": { + "type": "boolean", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "name": { + "type": "string", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "provenance": { + "type": "string", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "settings": { + "$ref": "#/definitions/Json", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "type": { + "enum": [ + "alertmanager", + " dingding", + " discord", + " email", + " googlechat", + " kafka", + " line", + " opsgenie", + " pagerduty", + " pushover", + " sensugo", + " slack", + " teams", + " telegram", + " threema", + " victorops", + " webhook", + " wecom" + ], + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "uid": { + "type": "string", + "minLength": 1, + "maxLength": 40, + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + } + }, + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, "Json": { "type": "object", "additionalProperties": {} @@ -40,6 +177,21 @@ }, "description": "Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted." }, + "MuteTiming": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "time_intervals": { + "type": "array", + "items": { + "$ref": "#/definitions/TimeInterval" + } + } + } + }, "NotificationTemplate": { "type": "object", "additionalProperties": false, @@ -70,58 +222,6 @@ "Provenance": { "type": "string" }, - "RelativeTimeRange": { - "type": "object", - "additionalProperties": false, - "properties": { - "from": { - "$ref": "#/definitions/Duration", - "description": "RelativeTimeRange is the per query start and end time\nfor requests." - }, - "to": { - "$ref": "#/definitions/Duration", - "description": "RelativeTimeRange is the per query start and end time\nfor requests." - } - }, - "description": "RelativeTimeRange is the per query start and end time\nfor requests." - }, - "TimeInterval": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "time_intervals": { - "type": "array", - "items": { - "$ref": "#/definitions/TimeInterval" - } - } - } - }, - "RuleGroup": { - "type": "object", - "additionalProperties": false, - "properties": { - "folderUid": { - "type": "string" - }, - "interval": { - "$ref": "#/definitions/Duration", - "description": "The interval, in seconds, at which all rules in the group are evaluated.\nIf a group contains many rules, the rules are evaluated sequentially." - }, - "rules": { - "type": "array", - "items": { - "$ref": "#/definitions/Rule" - } - }, - "title": { - "type": "string" - } - } - }, "Rule": { "type": "object", "additionalProperties": false, @@ -215,120 +315,20 @@ } } }, - "NotificationSettings": { - "type": "object", - "additionalProperties": false, - "required": [ - "receiver" - ], - "properties": { - "group_by": { - "type": "array", - "items": { - "type": "string" - }, - "default": [ - "alertname", - "grafana_folder" - ] - }, - "group_interval": { - "type": "string" - }, - "group_wait": { - "type": "string" - }, - "mute_time_intervals": { - "type": "array", - "items": { - "type": "string" - } - }, - "receiver": { - "type": "string" - }, - "repeat_interval": { - "type": "string" - } - } - }, - "Query": { - "type": "object", - "additionalProperties": false, - "properties": { - "datasourceUid": { - "type": "string" - }, - "model": { - "type": "object", - "additionalProperties": {} - }, - "queryType": { - "type": "string" - }, - "refId": { - "type": "string" - }, - "relativeTimeRange": { - "$ref": "#/definitions/RelativeTimeRange" - } - } - }, - "ContactPoint": { + "RelativeTimeRange": { "type": "object", "additionalProperties": false, - "required": [ - "settings", - "type" - ], "properties": { - "disableResolveMessage": { - "type": "boolean", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "name": { - "type": "string", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "provenance": { - "type": "string", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "settings": { - "$ref": "#/definitions/Json", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "type": { - "enum": [ - "alertmanager", - " dingding", - " discord", - " email", - " googlechat", - " kafka", - " line", - " opsgenie", - " pagerduty", - " pushover", - " sensugo", - " slack", - " teams", - " telegram", - " threema", - " victorops", - " webhook", - " wecom" - ], - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + "from": { + "$ref": "#/definitions/Duration", + "description": "RelativeTimeRange is the per query start and end time\nfor requests." }, - "uid": { - "type": "string", - "minLength": 1, - "maxLength": 40, - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + "to": { + "$ref": "#/definitions/Duration", + "description": "RelativeTimeRange is the per query start and end time\nfor requests." } }, - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + "description": "RelativeTimeRange is the per query start and end time\nfor requests." }, "NotificationPolicy": { "type": "object", @@ -401,7 +401,7 @@ }, "description": "A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property." }, - "MuteTiming": { + "TimeInterval": { "type": "object", "additionalProperties": false, "properties": { diff --git a/jsonschema/azuremonitor.jsonschema.json b/jsonschema/azuremonitor.jsonschema.json index d2d343e..3aa1d09 100644 --- a/jsonschema/azuremonitor.jsonschema.json +++ b/jsonschema/azuremonitor.jsonschema.json @@ -203,6 +203,10 @@ "type": "string", "description": "If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated" }, + "basicLogsQuery": { + "type": "boolean", + "description": "If set to true the query will be run as a basic logs query" + }, "workspace": { "type": "string", "description": "Workspace ID. This was removed in Grafana 8, but remains for backwards compat." diff --git a/jsonschema/common.jsonschema.json b/jsonschema/common.jsonschema.json index bd71a75..9a0163c 100644 --- a/jsonschema/common.jsonschema.json +++ b/jsonschema/common.jsonschema.json @@ -757,6 +757,14 @@ ], "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "FieldTextAlignment": { "enum": [ "auto", diff --git a/jsonschema/dashboard.jsonschema.json b/jsonschema/dashboard.jsonschema.json index 1e50241..28d29c3 100644 --- a/jsonschema/dashboard.jsonschema.json +++ b/jsonschema/dashboard.jsonschema.json @@ -101,7 +101,7 @@ "schemaVersion": { "type": "integer", "description": "Version of the JSON schema, incremented each time a Grafana update brings\nchanges to said schema.", - "default": 36 + "default": 39 }, "version": { "type": "integer", diff --git a/jsonschema/stat.jsonschema.json b/jsonschema/stat.jsonschema.json index 0fa8b86..eca0e1c 100644 --- a/jsonschema/stat.jsonschema.json +++ b/jsonschema/stat.jsonschema.json @@ -10,8 +10,9 @@ "justifyMode", "textMode", "wideLayout", - "reduceOptions", "showPercentChange", + "reduceOptions", + "percentChangeColorMode", "orientation" ], "properties": { @@ -35,15 +36,19 @@ "type": "boolean", "default": true }, + "showPercentChange": { + "type": "boolean", + "default": false + }, "reduceOptions": { "$ref": "#/definitions/ReduceDataOptions" }, "text": { "$ref": "#/definitions/VizTextDisplayOptions" }, - "showPercentChange": { - "type": "boolean", - "default": false + "percentChangeColorMode": { + "$ref": "#/definitions/PercentChangeColorMode", + "default": "standard" }, "orientation": { "$ref": "#/definitions/VizOrientation" @@ -128,6 +133,14 @@ }, "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "VizOrientation": { "enum": [ "auto", diff --git a/jsonschema/testdata.jsonschema.json b/jsonschema/testdata.jsonschema.json index decaf42..b9cb127 100644 --- a/jsonschema/testdata.jsonschema.json +++ b/jsonschema/testdata.jsonschema.json @@ -1,177 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { - "dataquery": { - "type": "object", - "additionalProperties": false, - "properties": { - "alias": { - "type": "string" - }, - "channel": { - "type": "string", - "description": "Used for live query" - }, - "csvContent": { - "type": "string" - }, - "csvFileName": { - "type": "string" - }, - "csvWave": { - "type": "array", - "items": { - "$ref": "#/definitions/CSVWave" - } - }, - "datasource": { - "$ref": "#/definitions/datasource", - "description": "The datasource" - }, - "dropPercent": { - "type": "number", - "description": "Drop percentage (the chance we will lose a point 0-100)" - }, - "errorType": { - "enum": [ - "frontend_exception", - "frontend_observable", - "server_panic" - ], - "description": "Possible enum values:\n - `\"frontend_exception\"` \n - `\"frontend_observable\"` \n - `\"server_panic\"` " - }, - "flamegraphDiff": { - "type": "boolean" - }, - "hide": { - "type": "boolean", - "description": "true if query is disabled (ie should not be returned to the dashboard)\nNOTE: this does not always imply that the query should not be executed since\nthe results from a hidden query may be used as the input to other queries (SSE etc)" - }, - "intervalMs": { - "type": "number", - "description": "Interval is the suggested duration between time points in a time series query.\nNOTE: the values for intervalMs is not saved in the query model. It is typically calculated\nfrom the interval required to fill a pixels in the visualization" - }, - "labels": { - "type": "string" - }, - "levelColumn": { - "type": "boolean" - }, - "lines": { - "type": "integer" - }, - "max": { - "type": "number" - }, - "maxDataPoints": { - "type": "integer", - "description": "MaxDataPoints is the maximum number of data points that should be returned from a time series query.\nNOTE: the values for maxDataPoints is not saved in the query model. It is typically calculated\nfrom the number of pixels visible in a visualization" - }, - "min": { - "type": "number" - }, - "nodes": { - "$ref": "#/definitions/NodesQuery" - }, - "noise": { - "type": "number" - }, - "points": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": {} - } - } - }, - "pulseWave": { - "$ref": "#/definitions/PulseWaveQuery" - }, - "queryType": { - "type": "string", - "description": "QueryType is an optional identifier for the type of query.\nIt can be used to distinguish different types of queries." - }, - "rawFrameContent": { - "type": "string" - }, - "refId": { - "type": "string", - "description": "RefID is the unique identifier of the query, set by the frontend call." - }, - "resultAssertions": { - "$ref": "#/definitions/ResultAssertions", - "description": "Optionally define expected query result behavior" - }, - "scenarioId": { - "enum": [ - "annotations", - "arrow", - "csv_content", - "csv_file", - "csv_metric_values", - "datapoints_outside_range", - "exponential_heatmap_bucket_data", - "flame_graph", - "grafana_api", - "linear_heatmap_bucket_data", - "live", - "logs", - "manual_entry", - "no_data_points", - "node_graph", - "predictable_csv_wave", - "predictable_pulse", - "random_walk", - "random_walk_table", - "random_walk_with_error", - "raw_frame", - "server_error_500", - "simulation", - "slow_query", - "streaming_client", - "table_static", - "trace", - "usa", - "variables-query" - ], - "description": "Possible enum values:\n - `\"annotations\"` \n - `\"arrow\"` \n - `\"csv_content\"` \n - `\"csv_file\"` \n - `\"csv_metric_values\"` \n - `\"datapoints_outside_range\"` \n - `\"exponential_heatmap_bucket_data\"` \n - `\"flame_graph\"` \n - `\"grafana_api\"` \n - `\"linear_heatmap_bucket_data\"` \n - `\"live\"` \n - `\"logs\"` \n - `\"manual_entry\"` \n - `\"no_data_points\"` \n - `\"node_graph\"` \n - `\"predictable_csv_wave\"` \n - `\"predictable_pulse\"` \n - `\"random_walk\"` \n - `\"random_walk_table\"` \n - `\"random_walk_with_error\"` \n - `\"raw_frame\"` \n - `\"server_error_500\"` \n - `\"simulation\"` \n - `\"slow_query\"` \n - `\"streaming_client\"` \n - `\"table_static\"` \n - `\"trace\"` \n - `\"usa\"` \n - `\"variables-query\"` " - }, - "seriesCount": { - "type": "integer" - }, - "sim": { - "$ref": "#/definitions/SimulationQuery" - }, - "spanCount": { - "type": "integer" - }, - "spread": { - "type": "number" - }, - "startValue": { - "type": "number" - }, - "stream": { - "$ref": "#/definitions/StreamingQuery" - }, - "stringInput": { - "type": "string", - "description": "common parameter used by many query types" - }, - "timeRange": { - "$ref": "#/definitions/TimeRange", - "description": "TimeRange represents the query range\nNOTE: unlike generic /ds/query, we can now send explicit time values in each query\nNOTE: the values for timeRange are not saved in a dashboard, they are constructed on the fly" - }, - "usa": { - "$ref": "#/definitions/USAQuery" - }, - "withNil": { - "type": "boolean" - } - } - }, "CSVWave": { "type": "object", "additionalProperties": false, @@ -410,6 +239,177 @@ } } } + }, + "dataquery": { + "type": "object", + "additionalProperties": false, + "properties": { + "alias": { + "type": "string" + }, + "channel": { + "type": "string", + "description": "Used for live query" + }, + "csvContent": { + "type": "string" + }, + "csvFileName": { + "type": "string" + }, + "csvWave": { + "type": "array", + "items": { + "$ref": "#/definitions/CSVWave" + } + }, + "datasource": { + "$ref": "#/definitions/datasource", + "description": "The datasource" + }, + "dropPercent": { + "type": "number", + "description": "Drop percentage (the chance we will lose a point 0-100)" + }, + "errorType": { + "enum": [ + "frontend_exception", + "frontend_observable", + "server_panic" + ], + "description": "Possible enum values:\n - `\"frontend_exception\"` \n - `\"frontend_observable\"` \n - `\"server_panic\"` " + }, + "flamegraphDiff": { + "type": "boolean" + }, + "hide": { + "type": "boolean", + "description": "true if query is disabled (ie should not be returned to the dashboard)\nNOTE: this does not always imply that the query should not be executed since\nthe results from a hidden query may be used as the input to other queries (SSE etc)" + }, + "intervalMs": { + "type": "number", + "description": "Interval is the suggested duration between time points in a time series query.\nNOTE: the values for intervalMs is not saved in the query model. It is typically calculated\nfrom the interval required to fill a pixels in the visualization" + }, + "labels": { + "type": "string" + }, + "levelColumn": { + "type": "boolean" + }, + "lines": { + "type": "integer" + }, + "max": { + "type": "number" + }, + "maxDataPoints": { + "type": "integer", + "description": "MaxDataPoints is the maximum number of data points that should be returned from a time series query.\nNOTE: the values for maxDataPoints is not saved in the query model. It is typically calculated\nfrom the number of pixels visible in a visualization" + }, + "min": { + "type": "number" + }, + "nodes": { + "$ref": "#/definitions/NodesQuery" + }, + "noise": { + "type": "number" + }, + "points": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": {} + } + } + }, + "pulseWave": { + "$ref": "#/definitions/PulseWaveQuery" + }, + "queryType": { + "type": "string", + "description": "QueryType is an optional identifier for the type of query.\nIt can be used to distinguish different types of queries." + }, + "rawFrameContent": { + "type": "string" + }, + "refId": { + "type": "string", + "description": "RefID is the unique identifier of the query, set by the frontend call." + }, + "resultAssertions": { + "$ref": "#/definitions/ResultAssertions", + "description": "Optionally define expected query result behavior" + }, + "scenarioId": { + "enum": [ + "annotations", + "arrow", + "csv_content", + "csv_file", + "csv_metric_values", + "datapoints_outside_range", + "exponential_heatmap_bucket_data", + "flame_graph", + "grafana_api", + "linear_heatmap_bucket_data", + "live", + "logs", + "manual_entry", + "no_data_points", + "node_graph", + "predictable_csv_wave", + "predictable_pulse", + "random_walk", + "random_walk_table", + "random_walk_with_error", + "raw_frame", + "server_error_500", + "simulation", + "slow_query", + "streaming_client", + "table_static", + "trace", + "usa", + "variables-query" + ], + "description": "Possible enum values:\n - `\"annotations\"` \n - `\"arrow\"` \n - `\"csv_content\"` \n - `\"csv_file\"` \n - `\"csv_metric_values\"` \n - `\"datapoints_outside_range\"` \n - `\"exponential_heatmap_bucket_data\"` \n - `\"flame_graph\"` \n - `\"grafana_api\"` \n - `\"linear_heatmap_bucket_data\"` \n - `\"live\"` \n - `\"logs\"` \n - `\"manual_entry\"` \n - `\"no_data_points\"` \n - `\"node_graph\"` \n - `\"predictable_csv_wave\"` \n - `\"predictable_pulse\"` \n - `\"random_walk\"` \n - `\"random_walk_table\"` \n - `\"random_walk_with_error\"` \n - `\"raw_frame\"` \n - `\"server_error_500\"` \n - `\"simulation\"` \n - `\"slow_query\"` \n - `\"streaming_client\"` \n - `\"table_static\"` \n - `\"trace\"` \n - `\"usa\"` \n - `\"variables-query\"` " + }, + "seriesCount": { + "type": "integer" + }, + "sim": { + "$ref": "#/definitions/SimulationQuery" + }, + "spanCount": { + "type": "integer" + }, + "spread": { + "type": "number" + }, + "startValue": { + "type": "number" + }, + "stream": { + "$ref": "#/definitions/StreamingQuery" + }, + "stringInput": { + "type": "string", + "description": "common parameter used by many query types" + }, + "timeRange": { + "$ref": "#/definitions/TimeRange", + "description": "TimeRange represents the query range\nNOTE: unlike generic /ds/query, we can now send explicit time values in each query\nNOTE: the values for timeRange are not saved in a dashboard, they are constructed on the fly" + }, + "usa": { + "$ref": "#/definitions/USAQuery" + }, + "withNil": { + "type": "boolean" + } + } } } } \ No newline at end of file diff --git a/openapi/alerting.openapi.json b/openapi/alerting.openapi.json index 0b1a7bf..bcd20c6 100644 --- a/openapi/alerting.openapi.json +++ b/openapi/alerting.openapi.json @@ -9,10 +9,147 @@ "paths": {}, "components": { "schemas": { + "Query": { + "type": "object", + "additionalProperties": false, + "properties": { + "datasourceUid": { + "type": "string" + }, + "model": { + "type": "object", + "additionalProperties": {} + }, + "queryType": { + "type": "string" + }, + "refId": { + "type": "string" + }, + "relativeTimeRange": { + "$ref": "#/components/schemas/RelativeTimeRange" + } + } + }, + "RuleGroup": { + "type": "object", + "additionalProperties": false, + "properties": { + "folderUid": { + "type": "string" + }, + "interval": { + "$ref": "#/components/schemas/Duration", + "description": "The interval, in seconds, at which all rules in the group are evaluated.\nIf a group contains many rules, the rules are evaluated sequentially." + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Rule" + } + }, + "title": { + "type": "string" + } + } + }, + "NotificationSettings": { + "type": "object", + "additionalProperties": false, + "required": [ + "receiver" + ], + "properties": { + "group_by": { + "type": "array", + "items": { + "type": "string" + }, + "default": [ + "alertname", + "grafana_folder" + ] + }, + "group_interval": { + "type": "string" + }, + "group_wait": { + "type": "string" + }, + "mute_time_intervals": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiver": { + "type": "string" + }, + "repeat_interval": { + "type": "string" + } + } + }, "Duration": { "type": "integer", "description": "Duration in seconds." }, + "ContactPoint": { + "type": "object", + "additionalProperties": false, + "required": [ + "settings", + "type" + ], + "properties": { + "disableResolveMessage": { + "type": "boolean", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "name": { + "type": "string", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "provenance": { + "type": "string", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "settings": { + "$ref": "#/components/schemas/Json", + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "type": { + "enum": [ + "alertmanager", + " dingding", + " discord", + " email", + " googlechat", + " kafka", + " line", + " opsgenie", + " pagerduty", + " pushover", + " sensugo", + " slack", + " teams", + " telegram", + " threema", + " victorops", + " webhook", + " wecom" + ], + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, + "uid": { + "type": "string", + "minLength": 1, + "maxLength": 40, + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + } + }, + "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + }, "Json": { "type": "object", "additionalProperties": {} @@ -48,6 +185,21 @@ }, "description": "Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted." }, + "MuteTiming": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "time_intervals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TimeInterval" + } + } + } + }, "NotificationTemplate": { "type": "object", "additionalProperties": false, @@ -78,58 +230,6 @@ "Provenance": { "type": "string" }, - "RelativeTimeRange": { - "type": "object", - "additionalProperties": false, - "properties": { - "from": { - "$ref": "#/components/schemas/Duration", - "description": "RelativeTimeRange is the per query start and end time\nfor requests." - }, - "to": { - "$ref": "#/components/schemas/Duration", - "description": "RelativeTimeRange is the per query start and end time\nfor requests." - } - }, - "description": "RelativeTimeRange is the per query start and end time\nfor requests." - }, - "TimeInterval": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "time_intervals": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TimeInterval" - } - } - } - }, - "RuleGroup": { - "type": "object", - "additionalProperties": false, - "properties": { - "folderUid": { - "type": "string" - }, - "interval": { - "$ref": "#/components/schemas/Duration", - "description": "The interval, in seconds, at which all rules in the group are evaluated.\nIf a group contains many rules, the rules are evaluated sequentially." - }, - "rules": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Rule" - } - }, - "title": { - "type": "string" - } - } - }, "Rule": { "type": "object", "additionalProperties": false, @@ -223,120 +323,20 @@ } } }, - "NotificationSettings": { - "type": "object", - "additionalProperties": false, - "required": [ - "receiver" - ], - "properties": { - "group_by": { - "type": "array", - "items": { - "type": "string" - }, - "default": [ - "alertname", - "grafana_folder" - ] - }, - "group_interval": { - "type": "string" - }, - "group_wait": { - "type": "string" - }, - "mute_time_intervals": { - "type": "array", - "items": { - "type": "string" - } - }, - "receiver": { - "type": "string" - }, - "repeat_interval": { - "type": "string" - } - } - }, - "Query": { - "type": "object", - "additionalProperties": false, - "properties": { - "datasourceUid": { - "type": "string" - }, - "model": { - "type": "object", - "additionalProperties": {} - }, - "queryType": { - "type": "string" - }, - "refId": { - "type": "string" - }, - "relativeTimeRange": { - "$ref": "#/components/schemas/RelativeTimeRange" - } - } - }, - "ContactPoint": { + "RelativeTimeRange": { "type": "object", "additionalProperties": false, - "required": [ - "settings", - "type" - ], "properties": { - "disableResolveMessage": { - "type": "boolean", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "name": { - "type": "string", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "provenance": { - "type": "string", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "settings": { - "$ref": "#/components/schemas/Json", - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." - }, - "type": { - "enum": [ - "alertmanager", - " dingding", - " discord", - " email", - " googlechat", - " kafka", - " line", - " opsgenie", - " pagerduty", - " pushover", - " sensugo", - " slack", - " teams", - " telegram", - " threema", - " victorops", - " webhook", - " wecom" - ], - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + "from": { + "$ref": "#/components/schemas/Duration", + "description": "RelativeTimeRange is the per query start and end time\nfor requests." }, - "uid": { - "type": "string", - "minLength": 1, - "maxLength": 40, - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + "to": { + "$ref": "#/components/schemas/Duration", + "description": "RelativeTimeRange is the per query start and end time\nfor requests." } }, - "description": "EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation." + "description": "RelativeTimeRange is the per query start and end time\nfor requests." }, "NotificationPolicy": { "type": "object", @@ -409,7 +409,7 @@ }, "description": "A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property." }, - "MuteTiming": { + "TimeInterval": { "type": "object", "additionalProperties": false, "properties": { diff --git a/openapi/azuremonitor.openapi.json b/openapi/azuremonitor.openapi.json index 89bfca5..82454e4 100644 --- a/openapi/azuremonitor.openapi.json +++ b/openapi/azuremonitor.openapi.json @@ -212,6 +212,10 @@ "type": "string", "description": "If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated" }, + "basicLogsQuery": { + "type": "boolean", + "description": "If set to true the query will be run as a basic logs query" + }, "workspace": { "type": "string", "description": "Workspace ID. This was removed in Grafana 8, but remains for backwards compat." diff --git a/openapi/common.openapi.json b/openapi/common.openapi.json index e8bea4a..f03e8df 100644 --- a/openapi/common.openapi.json +++ b/openapi/common.openapi.json @@ -765,6 +765,14 @@ ], "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "FieldTextAlignment": { "enum": [ "auto", diff --git a/openapi/dashboard.openapi.json b/openapi/dashboard.openapi.json index 5f10555..a7ec373 100644 --- a/openapi/dashboard.openapi.json +++ b/openapi/dashboard.openapi.json @@ -108,7 +108,7 @@ "schemaVersion": { "type": "integer", "description": "Version of...*[Comment body truncated]*