mirror of https://github.com/grafana/grafana
CloudMonitoring: Initial GCM Schema (#67739)
* Initial GCM schema work - Split types for convenience - Update conditionals where needed - Update type references * Add additional supporting types * Add some more accessory and legacy types * Add missing type * Rename backend folder * Add missing generated file * Reviewpull/69258/head
parent
2f74d0c6a9
commit
108acee08e
@ -0,0 +1,19 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: GoogleCloudMonitoringDataQuery kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
## GoogleCloudMonitoringDataQuery |
||||
|
||||
#### Maturity: [merged](../../../maturity/#merged) |
||||
#### Version: 0.0 |
||||
|
||||
|
||||
|
||||
| Property | Type | Required | Default | Description | |
||||
|----------|------|----------|---------|-------------| |
||||
|
||||
|
||||
@ -0,0 +1,504 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// public/app/plugins/gen.go
|
||||
// Using jennies:
|
||||
// PluginGoTypesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package dataquery |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
) |
||||
|
||||
// Defines values for AlignmentTypes.
|
||||
const ( |
||||
AlignmentTypesALIGNCOUNT AlignmentTypes = "ALIGN_COUNT" |
||||
AlignmentTypesALIGNCOUNTFALSE AlignmentTypes = "ALIGN_COUNT_FALSE" |
||||
AlignmentTypesALIGNCOUNTTRUE AlignmentTypes = "ALIGN_COUNT_TRUE" |
||||
AlignmentTypesALIGNDELTA AlignmentTypes = "ALIGN_DELTA" |
||||
AlignmentTypesALIGNFRACTIONTRUE AlignmentTypes = "ALIGN_FRACTION_TRUE" |
||||
AlignmentTypesALIGNINTERPOLATE AlignmentTypes = "ALIGN_INTERPOLATE" |
||||
AlignmentTypesALIGNMAX AlignmentTypes = "ALIGN_MAX" |
||||
AlignmentTypesALIGNMEAN AlignmentTypes = "ALIGN_MEAN" |
||||
AlignmentTypesALIGNMIN AlignmentTypes = "ALIGN_MIN" |
||||
AlignmentTypesALIGNNEXTOLDER AlignmentTypes = "ALIGN_NEXT_OLDER" |
||||
AlignmentTypesALIGNNONE AlignmentTypes = "ALIGN_NONE" |
||||
AlignmentTypesALIGNPERCENTCHANGE AlignmentTypes = "ALIGN_PERCENT_CHANGE" |
||||
AlignmentTypesALIGNPERCENTILE05 AlignmentTypes = "ALIGN_PERCENTILE_05" |
||||
AlignmentTypesALIGNPERCENTILE50 AlignmentTypes = "ALIGN_PERCENTILE_50" |
||||
AlignmentTypesALIGNPERCENTILE95 AlignmentTypes = "ALIGN_PERCENTILE_95" |
||||
AlignmentTypesALIGNPERCENTILE99 AlignmentTypes = "ALIGN_PERCENTILE_99" |
||||
AlignmentTypesALIGNRATE AlignmentTypes = "ALIGN_RATE" |
||||
AlignmentTypesALIGNSTDDEV AlignmentTypes = "ALIGN_STDDEV" |
||||
AlignmentTypesALIGNSUM AlignmentTypes = "ALIGN_SUM" |
||||
) |
||||
|
||||
// Defines values for AnnotationQueryPreprocessor.
|
||||
const ( |
||||
AnnotationQueryPreprocessorDelta AnnotationQueryPreprocessor = "delta" |
||||
AnnotationQueryPreprocessorNone AnnotationQueryPreprocessor = "none" |
||||
AnnotationQueryPreprocessorRate AnnotationQueryPreprocessor = "rate" |
||||
) |
||||
|
||||
// Defines values for CloudMonitoringQueryTimeSeriesListPreprocessor.
|
||||
const ( |
||||
CloudMonitoringQueryTimeSeriesListPreprocessorDelta CloudMonitoringQueryTimeSeriesListPreprocessor = "delta" |
||||
CloudMonitoringQueryTimeSeriesListPreprocessorNone CloudMonitoringQueryTimeSeriesListPreprocessor = "none" |
||||
CloudMonitoringQueryTimeSeriesListPreprocessorRate CloudMonitoringQueryTimeSeriesListPreprocessor = "rate" |
||||
) |
||||
|
||||
// Defines values for LegacyCloudMonitoringAnnotationQueryMetricKind.
|
||||
const ( |
||||
LegacyCloudMonitoringAnnotationQueryMetricKindCUMULATIVE LegacyCloudMonitoringAnnotationQueryMetricKind = "CUMULATIVE" |
||||
LegacyCloudMonitoringAnnotationQueryMetricKindDELTA LegacyCloudMonitoringAnnotationQueryMetricKind = "DELTA" |
||||
LegacyCloudMonitoringAnnotationQueryMetricKindGAUGE LegacyCloudMonitoringAnnotationQueryMetricKind = "GAUGE" |
||||
LegacyCloudMonitoringAnnotationQueryMetricKindMETRICKINDUNSPECIFIED LegacyCloudMonitoringAnnotationQueryMetricKind = "METRIC_KIND_UNSPECIFIED" |
||||
) |
||||
|
||||
// Defines values for MetricFindQueryTypes.
|
||||
const ( |
||||
MetricFindQueryTypesAggregations MetricFindQueryTypes = "aggregations" |
||||
MetricFindQueryTypesAligners MetricFindQueryTypes = "aligners" |
||||
MetricFindQueryTypesAlignmentPeriods MetricFindQueryTypes = "alignmentPeriods" |
||||
MetricFindQueryTypesDefaultProject MetricFindQueryTypes = "defaultProject" |
||||
MetricFindQueryTypesLabelKeys MetricFindQueryTypes = "labelKeys" |
||||
MetricFindQueryTypesLabelValues MetricFindQueryTypes = "labelValues" |
||||
MetricFindQueryTypesMetricTypes MetricFindQueryTypes = "metricTypes" |
||||
MetricFindQueryTypesProjects MetricFindQueryTypes = "projects" |
||||
MetricFindQueryTypesResourceTypes MetricFindQueryTypes = "resourceTypes" |
||||
MetricFindQueryTypesSelectors MetricFindQueryTypes = "selectors" |
||||
MetricFindQueryTypesServices MetricFindQueryTypes = "services" |
||||
MetricFindQueryTypesSlo MetricFindQueryTypes = "slo" |
||||
MetricFindQueryTypesSloServices MetricFindQueryTypes = "sloServices" |
||||
) |
||||
|
||||
// Defines values for MetricKind.
|
||||
const ( |
||||
MetricKindCUMULATIVE MetricKind = "CUMULATIVE" |
||||
MetricKindDELTA MetricKind = "DELTA" |
||||
MetricKindGAUGE MetricKind = "GAUGE" |
||||
MetricKindMETRICKINDUNSPECIFIED MetricKind = "METRIC_KIND_UNSPECIFIED" |
||||
) |
||||
|
||||
// Defines values for MetricQueryMetricKind.
|
||||
const ( |
||||
MetricQueryMetricKindCUMULATIVE MetricQueryMetricKind = "CUMULATIVE" |
||||
MetricQueryMetricKindDELTA MetricQueryMetricKind = "DELTA" |
||||
MetricQueryMetricKindGAUGE MetricQueryMetricKind = "GAUGE" |
||||
MetricQueryMetricKindMETRICKINDUNSPECIFIED MetricQueryMetricKind = "METRIC_KIND_UNSPECIFIED" |
||||
) |
||||
|
||||
// Defines values for MetricQueryPreprocessor.
|
||||
const ( |
||||
MetricQueryPreprocessorDelta MetricQueryPreprocessor = "delta" |
||||
MetricQueryPreprocessorNone MetricQueryPreprocessor = "none" |
||||
MetricQueryPreprocessorRate MetricQueryPreprocessor = "rate" |
||||
) |
||||
|
||||
// Defines values for PreprocessorType.
|
||||
const ( |
||||
PreprocessorTypeDelta PreprocessorType = "delta" |
||||
PreprocessorTypeNone PreprocessorType = "none" |
||||
PreprocessorTypeRate PreprocessorType = "rate" |
||||
) |
||||
|
||||
// Defines values for QueryType.
|
||||
const ( |
||||
QueryTypeAnnotation QueryType = "annotation" |
||||
QueryTypeSlo QueryType = "slo" |
||||
QueryTypeTimeSeriesList QueryType = "timeSeriesList" |
||||
QueryTypeTimeSeriesQuery QueryType = "timeSeriesQuery" |
||||
) |
||||
|
||||
// Defines values for TimeSeriesListPreprocessor.
|
||||
const ( |
||||
TimeSeriesListPreprocessorDelta TimeSeriesListPreprocessor = "delta" |
||||
TimeSeriesListPreprocessorNone TimeSeriesListPreprocessor = "none" |
||||
TimeSeriesListPreprocessorRate TimeSeriesListPreprocessor = "rate" |
||||
) |
||||
|
||||
// Defines values for ValueTypes.
|
||||
const ( |
||||
ValueTypesBOOL ValueTypes = "BOOL" |
||||
ValueTypesDISTRIBUTION ValueTypes = "DISTRIBUTION" |
||||
ValueTypesDOUBLE ValueTypes = "DOUBLE" |
||||
ValueTypesINT64 ValueTypes = "INT64" |
||||
ValueTypesMONEY ValueTypes = "MONEY" |
||||
ValueTypesSTRING ValueTypes = "STRING" |
||||
ValueTypesVALUETYPEUNSPECIFIED ValueTypes = "VALUE_TYPE_UNSPECIFIED" |
||||
) |
||||
|
||||
// AlignmentTypes defines model for AlignmentTypes.
|
||||
type AlignmentTypes string |
||||
|
||||
// Annotation sub-query properties.
|
||||
type AnnotationQuery struct { |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
AlignmentPeriod *string `json:"alignmentPeriod,omitempty"` |
||||
|
||||
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
CrossSeriesReducer string `json:"crossSeriesReducer"` |
||||
|
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric.
|
||||
Filters []string `json:"filters,omitempty"` |
||||
|
||||
// Array of labels to group data by.
|
||||
GroupBys []string `json:"groupBys,omitempty"` |
||||
|
||||
// Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
PerSeriesAligner *string `json:"perSeriesAligner,omitempty"` |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
Preprocessor *AnnotationQueryPreprocessor `json:"preprocessor,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// Only present if a preprocessor is selected. Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
SecondaryAlignmentPeriod *string `json:"secondaryAlignmentPeriod,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
SecondaryCrossSeriesReducer *string `json:"secondaryCrossSeriesReducer,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Array of labels to group data by.
|
||||
SecondaryGroupBys []string `json:"secondaryGroupBys,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
SecondaryPerSeriesAligner *string `json:"secondaryPerSeriesAligner,omitempty"` |
||||
|
||||
// Annotation text.
|
||||
Text *string `json:"text,omitempty"` |
||||
|
||||
// Annotation title.
|
||||
Title *string `json:"title,omitempty"` |
||||
|
||||
// Data view, defaults to FULL.
|
||||
View *string `json:"view,omitempty"` |
||||
AdditionalProperties map[string]interface{} `json:"-"` |
||||
} |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
type AnnotationQueryPreprocessor string |
||||
|
||||
// CloudMonitoringQuery defines model for CloudMonitoringQuery.
|
||||
type CloudMonitoringQuery struct { |
||||
// Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail.
|
||||
AliasBy *string `json:"aliasBy,omitempty"` |
||||
|
||||
// For mixed data sources the selected datasource is on the query level.
|
||||
// For non mixed scenarios this is undefined.
|
||||
// TODO find a better way to do this ^ that's friendly to schema
|
||||
// TODO this shouldn't be unknown but DataSourceRef | null
|
||||
Datasource *interface{} `json:"datasource,omitempty"` |
||||
|
||||
// Hide true if query is disabled (ie should not be returned to the dashboard)
|
||||
// Note this does not always imply that the query should not be executed since
|
||||
// the results from a hidden query may be used as the input to other queries (SSE etc)
|
||||
Hide *bool `json:"hide,omitempty"` |
||||
|
||||
// Time interval in milliseconds.
|
||||
IntervalMs *float32 `json:"intervalMs,omitempty"` |
||||
|
||||
// Specify the query flavor
|
||||
// TODO make this required and give it a default
|
||||
QueryType *string `json:"queryType,omitempty"` |
||||
|
||||
// A unique identifier for the query within the list of targets.
|
||||
// In server side expressions, the refId is used as a variable name to identify results.
|
||||
// By default, the UI will assign A->Z; however setting meaningful names may be useful.
|
||||
RefId string `json:"refId"` |
||||
|
||||
// SLO sub-query properties.
|
||||
SloQuery *struct { |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
AlignmentPeriod *string `json:"alignmentPeriod,omitempty"` |
||||
|
||||
// SLO goal value.
|
||||
Goal *float32 `json:"goal,omitempty"` |
||||
|
||||
// Specific lookback period for the SLO.
|
||||
LookbackPeriod *string `json:"lookbackPeriod,omitempty"` |
||||
|
||||
// Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
PerSeriesAligner *string `json:"perSeriesAligner,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// SLO selector.
|
||||
SelectorName string `json:"selectorName"` |
||||
|
||||
// ID for the service the SLO is in.
|
||||
ServiceId string `json:"serviceId"` |
||||
|
||||
// Name for the service the SLO is in.
|
||||
ServiceName string `json:"serviceName"` |
||||
|
||||
// ID for the SLO.
|
||||
SloId string `json:"sloId"` |
||||
|
||||
// Name of the SLO.
|
||||
SloName string `json:"sloName"` |
||||
} `json:"sloQuery,omitempty"` |
||||
|
||||
// GCM query type.
|
||||
// queryType: #QueryType
|
||||
// Time Series List sub-query properties.
|
||||
TimeSeriesList *CloudMonitoringQueryTimeSeriesList `json:"timeSeriesList,omitempty"` |
||||
|
||||
// Time Series sub-query properties.
|
||||
TimeSeriesQuery *struct { |
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'.
|
||||
GraphPeriod *string `json:"graphPeriod,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// MQL query to be executed.
|
||||
Query string `json:"query"` |
||||
} `json:"timeSeriesQuery,omitempty"` |
||||
} |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
type CloudMonitoringQueryTimeSeriesListPreprocessor string |
||||
|
||||
// GCM query type.
|
||||
// queryType: #QueryType
|
||||
// Time Series List sub-query properties.
|
||||
type CloudMonitoringQueryTimeSeriesList struct { |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
AlignmentPeriod *string `json:"alignmentPeriod,omitempty"` |
||||
|
||||
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
CrossSeriesReducer *string `json:"crossSeriesReducer,omitempty"` |
||||
|
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric.
|
||||
Filters []string `json:"filters,omitempty"` |
||||
|
||||
// Array of labels to group data by.
|
||||
GroupBys []string `json:"groupBys,omitempty"` |
||||
|
||||
// Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
PerSeriesAligner *string `json:"perSeriesAligner,omitempty"` |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
Preprocessor *CloudMonitoringQueryTimeSeriesListPreprocessor `json:"preprocessor,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName *string `json:"projectName,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
SecondaryAlignmentPeriod *string `json:"secondaryAlignmentPeriod,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
SecondaryCrossSeriesReducer *string `json:"secondaryCrossSeriesReducer,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Array of labels to group data by.
|
||||
SecondaryGroupBys []string `json:"secondaryGroupBys,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
SecondaryPerSeriesAligner *string `json:"secondaryPerSeriesAligner,omitempty"` |
||||
|
||||
// Annotation text.
|
||||
Text *string `json:"text,omitempty"` |
||||
|
||||
// Annotation title.
|
||||
Title *string `json:"title,omitempty"` |
||||
|
||||
// Data view, defaults to FULL.
|
||||
View *string `json:"view,omitempty"` |
||||
AdditionalProperties map[string]interface{} `json:"-"` |
||||
union json.RawMessage |
||||
} |
||||
|
||||
// Query filter representation.
|
||||
type Filter struct { |
||||
// Filter condition.
|
||||
Condition *string `json:"condition,omitempty"` |
||||
|
||||
// Filter key.
|
||||
Key string `json:"key"` |
||||
|
||||
// Filter operator.
|
||||
Operator string `json:"operator"` |
||||
|
||||
// Filter value.
|
||||
Value string `json:"value"` |
||||
} |
||||
|
||||
// GoogleCloudMonitoringDataQuery defines model for GoogleCloudMonitoringDataQuery.
|
||||
type GoogleCloudMonitoringDataQuery = map[string]interface{} |
||||
|
||||
// @deprecated Use AnnotationQuery instead. Legacy annotation query properties for migration purposes.
|
||||
type LegacyCloudMonitoringAnnotationQuery struct { |
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric.
|
||||
Filters []string `json:"filters"` |
||||
MetricKind LegacyCloudMonitoringAnnotationQueryMetricKind `json:"metricKind"` |
||||
MetricType string `json:"metricType"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// Query refId.
|
||||
RefId string `json:"refId"` |
||||
|
||||
// Annotation text.
|
||||
Text string `json:"text"` |
||||
|
||||
// Annotation title.
|
||||
Title string `json:"title"` |
||||
ValueType string `json:"valueType"` |
||||
} |
||||
|
||||
// LegacyCloudMonitoringAnnotationQueryMetricKind defines model for LegacyCloudMonitoringAnnotationQuery.MetricKind.
|
||||
type LegacyCloudMonitoringAnnotationQueryMetricKind string |
||||
|
||||
// MetricFindQueryTypes defines model for MetricFindQueryTypes.
|
||||
type MetricFindQueryTypes string |
||||
|
||||
// MetricKind defines model for MetricKind.
|
||||
type MetricKind string |
||||
|
||||
// @deprecated This type is for migration purposes only. Replaced by TimeSeriesList Metric sub-query properties.
|
||||
type MetricQuery struct { |
||||
// Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail.
|
||||
AliasBy *string `json:"aliasBy,omitempty"` |
||||
|
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
AlignmentPeriod *string `json:"alignmentPeriod,omitempty"` |
||||
|
||||
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
CrossSeriesReducer string `json:"crossSeriesReducer"` |
||||
EditorMode string `json:"editorMode"` |
||||
|
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric.
|
||||
Filters []string `json:"filters,omitempty"` |
||||
|
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'.
|
||||
GraphPeriod *string `json:"graphPeriod,omitempty"` |
||||
|
||||
// Array of labels to group data by.
|
||||
GroupBys []string `json:"groupBys,omitempty"` |
||||
MetricKind *MetricQueryMetricKind `json:"metricKind,omitempty"` |
||||
MetricType string `json:"metricType"` |
||||
|
||||
// Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
PerSeriesAligner *string `json:"perSeriesAligner,omitempty"` |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
Preprocessor *MetricQueryPreprocessor `json:"preprocessor,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// MQL query to be executed.
|
||||
Query string `json:"query"` |
||||
ValueType *string `json:"valueType,omitempty"` |
||||
View *string `json:"view,omitempty"` |
||||
} |
||||
|
||||
// MetricQueryMetricKind defines model for MetricQuery.MetricKind.
|
||||
type MetricQueryMetricKind string |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
type MetricQueryPreprocessor string |
||||
|
||||
// Types of pre-processor available. Defined by the metric.
|
||||
type PreprocessorType string |
||||
|
||||
// Defines the supported queryTypes.
|
||||
type QueryType string |
||||
|
||||
// SLO sub-query properties.
|
||||
type SLOQuery struct { |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
AlignmentPeriod *string `json:"alignmentPeriod,omitempty"` |
||||
|
||||
// SLO goal value.
|
||||
Goal *float32 `json:"goal,omitempty"` |
||||
|
||||
// Specific lookback period for the SLO.
|
||||
LookbackPeriod *string `json:"lookbackPeriod,omitempty"` |
||||
|
||||
// Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
PerSeriesAligner *string `json:"perSeriesAligner,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// SLO selector.
|
||||
SelectorName string `json:"selectorName"` |
||||
|
||||
// ID for the service the SLO is in.
|
||||
ServiceId string `json:"serviceId"` |
||||
|
||||
// Name for the service the SLO is in.
|
||||
ServiceName string `json:"serviceName"` |
||||
|
||||
// ID for the SLO.
|
||||
SloId string `json:"sloId"` |
||||
|
||||
// Name of the SLO.
|
||||
SloName string `json:"sloName"` |
||||
} |
||||
|
||||
// Time Series List sub-query properties.
|
||||
type TimeSeriesList struct { |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
AlignmentPeriod *string `json:"alignmentPeriod,omitempty"` |
||||
|
||||
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
CrossSeriesReducer string `json:"crossSeriesReducer"` |
||||
|
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric.
|
||||
Filters []string `json:"filters,omitempty"` |
||||
|
||||
// Array of labels to group data by.
|
||||
GroupBys []string `json:"groupBys,omitempty"` |
||||
|
||||
// Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
PerSeriesAligner *string `json:"perSeriesAligner,omitempty"` |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
Preprocessor *TimeSeriesListPreprocessor `json:"preprocessor,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// Only present if a preprocessor is selected. Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto.
|
||||
SecondaryAlignmentPeriod *string `json:"secondaryAlignmentPeriod,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Reducer applied across a set of time-series values. Defaults to REDUCE_NONE.
|
||||
SecondaryCrossSeriesReducer *string `json:"secondaryCrossSeriesReducer,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Array of labels to group data by.
|
||||
SecondaryGroupBys []string `json:"secondaryGroupBys,omitempty"` |
||||
|
||||
// Only present if a preprocessor is selected. Alignment function to be used. Defaults to ALIGN_MEAN.
|
||||
SecondaryPerSeriesAligner *string `json:"secondaryPerSeriesAligner,omitempty"` |
||||
|
||||
// Data view, defaults to FULL.
|
||||
View *string `json:"view,omitempty"` |
||||
AdditionalProperties map[string]interface{} `json:"-"` |
||||
} |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters
|
||||
type TimeSeriesListPreprocessor string |
||||
|
||||
// Time Series sub-query properties.
|
||||
type TimeSeriesQuery struct { |
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'.
|
||||
GraphPeriod *string `json:"graphPeriod,omitempty"` |
||||
|
||||
// GCP project to execute the query against.
|
||||
ProjectName string `json:"projectName"` |
||||
|
||||
// MQL query to be executed.
|
||||
Query string `json:"query"` |
||||
} |
||||
|
||||
// ValueTypes defines model for ValueTypes.
|
||||
type ValueTypes string |
||||
@ -0,0 +1,197 @@ |
||||
// Copyright 2023 Grafana Labs |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
package grafanaplugin |
||||
|
||||
import ( |
||||
"github.com/grafana/grafana/packages/grafana-schema/src/common" |
||||
"github.com/grafana/grafana/pkg/plugins/pfs" |
||||
) |
||||
|
||||
pfs.GrafanaPlugin |
||||
|
||||
composableKinds: DataQuery: { |
||||
maturity: "merged" |
||||
|
||||
lineage: { |
||||
seqs: [ |
||||
{ |
||||
schemas: [ |
||||
{ |
||||
#CloudMonitoringQuery: common.DataQuery & { |
||||
// Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail. |
||||
aliasBy?: string |
||||
// GCM query type. |
||||
// queryType: #QueryType |
||||
// Time Series List sub-query properties. |
||||
timeSeriesList?: #TimeSeriesList | #AnnotationQuery |
||||
// Time Series sub-query properties. |
||||
timeSeriesQuery?: #TimeSeriesQuery |
||||
// SLO sub-query properties. |
||||
sloQuery?: #SLOQuery |
||||
// Time interval in milliseconds. |
||||
intervalMs?: number |
||||
} @cuetsy(kind="interface") |
||||
|
||||
// Defines the supported queryTypes. |
||||
#QueryType: "timeSeriesList" | "timeSeriesQuery" | "slo" | "annotation" @cuetsy(kind="enum", memberNames="TIME_SERIES_LIST|TIME_SERIES_QUERY|SLO|ANNOTATION") |
||||
|
||||
// Time Series List sub-query properties. |
||||
#TimeSeriesList: { |
||||
// GCP project to execute the query against. |
||||
projectName: string |
||||
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE. |
||||
crossSeriesReducer: string |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
alignmentPeriod?: string |
||||
// Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
perSeriesAligner?: string |
||||
// Array of labels to group data by. |
||||
groupBys?: [...string] |
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric. |
||||
filters?: [...string] |
||||
// Data view, defaults to FULL. |
||||
view?: string |
||||
|
||||
// Only present if a preprocessor is selected. Reducer applied across a set of time-series values. Defaults to REDUCE_NONE. |
||||
secondaryCrossSeriesReducer?: string |
||||
// Only present if a preprocessor is selected. Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
secondaryAlignmentPeriod?: string |
||||
// Only present if a preprocessor is selected. Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
secondaryPerSeriesAligner?: string |
||||
// Only present if a preprocessor is selected. Array of labels to group data by. |
||||
secondaryGroupBys?: [...string] |
||||
|
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters |
||||
preprocessor?: #PreprocessorType |
||||
... |
||||
} @cuetsy(kind="interface") |
||||
|
||||
// Types of pre-processor available. Defined by the metric. |
||||
#PreprocessorType: "none" | "rate" | "delta" @cuetsy(kind="enum") |
||||
|
||||
// Annotation sub-query properties. |
||||
#AnnotationQuery: #TimeSeriesList & { |
||||
// Annotation title. |
||||
title?: string |
||||
// Annotation text. |
||||
text?: string |
||||
} @cuetsy(kind="interface") |
||||
|
||||
// Time Series sub-query properties. |
||||
#TimeSeriesQuery: { |
||||
// GCP project to execute the query against. |
||||
projectName: string |
||||
// MQL query to be executed. |
||||
query: string |
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'. |
||||
graphPeriod?: "disabled" | string |
||||
} @cuetsy(kind="interface") |
||||
|
||||
// SLO sub-query properties. |
||||
#SLOQuery: { |
||||
// GCP project to execute the query against. |
||||
projectName: string |
||||
// Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
perSeriesAligner?: string |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
alignmentPeriod?: string |
||||
// SLO selector. |
||||
selectorName: string |
||||
// ID for the service the SLO is in. |
||||
serviceId: string |
||||
// Name for the service the SLO is in. |
||||
serviceName: string |
||||
// ID for the SLO. |
||||
sloId: string |
||||
// Name of the SLO. |
||||
sloName: string |
||||
// SLO goal value. |
||||
goal?: number |
||||
// Specific lookback period for the SLO. |
||||
lookbackPeriod?: string |
||||
} @cuetsy(kind="interface") |
||||
|
||||
// @deprecated This type is for migration purposes only. Replaced by TimeSeriesList Metric sub-query properties. |
||||
#MetricQuery: { |
||||
// GCP project to execute the query against. |
||||
projectName: string |
||||
// Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
perSeriesAligner?: string |
||||
// Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
alignmentPeriod?: string |
||||
// Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail. |
||||
aliasBy?: string |
||||
editorMode: string |
||||
metricType: string |
||||
// Reducer applied across a set of time-series values. Defaults to REDUCE_NONE. |
||||
crossSeriesReducer: string |
||||
// Array of labels to group data by. |
||||
groupBys?: [...string] |
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric. |
||||
filters?: [...string] |
||||
metricKind?: #MetricKind |
||||
valueType?: string |
||||
view?: string |
||||
// MQL query to be executed. |
||||
query: string |
||||
// Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters |
||||
preprocessor?: #PreprocessorType |
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'. |
||||
graphPeriod?: "disabled" | string |
||||
} @cuetsy(kind="interface") |
||||
|
||||
#MetricKind: "METRIC_KIND_UNSPECIFIED" | "GAUGE" | "DELTA" | "CUMULATIVE" @cuetsy(kind="enum") |
||||
|
||||
#ValueTypes: "VALUE_TYPE_UNSPECIFIED" | "BOOL" | "INT64" | "DOUBLE" | "STRING" | "DISTRIBUTION" | "MONEY" @cuetsy(kind="enum") |
||||
|
||||
#AlignmentTypes: "ALIGN_DELTA" | "ALIGN_RATE" | "ALIGN_INTERPOLATE" | "ALIGN_NEXT_OLDER" | "ALIGN_MIN" | "ALIGN_MAX" | "ALIGN_MEAN" | "ALIGN_COUNT" | "ALIGN_SUM" | "ALIGN_STDDEV" | "ALIGN_COUNT_TRUE" | "ALIGN_COUNT_FALSE" | "ALIGN_FRACTION_TRUE" | "ALIGN_PERCENTILE_99" | "ALIGN_PERCENTILE_95" | "ALIGN_PERCENTILE_50" | "ALIGN_PERCENTILE_05" | "ALIGN_PERCENT_CHANGE" | "ALIGN_NONE" @cuetsy(kind="enum") |
||||
|
||||
// @deprecated Use AnnotationQuery instead. Legacy annotation query properties for migration purposes. |
||||
#LegacyCloudMonitoringAnnotationQuery: { |
||||
// GCP project to execute the query against. |
||||
projectName: string |
||||
metricType: string |
||||
// Query refId. |
||||
refId: string |
||||
// Array of filters to query data by. Labels that can be filtered on are defined by the metric. |
||||
filters: [...string] |
||||
metricKind: #MetricKind |
||||
valueType: string |
||||
// Annotation title. |
||||
title: string |
||||
// Annotation text. |
||||
text: string |
||||
} @cuetsy(kind="interface") |
||||
|
||||
// Query filter representation. |
||||
#Filter: { |
||||
// Filter key. |
||||
key: string |
||||
// Filter operator. |
||||
operator: string |
||||
// Filter value. |
||||
value: string |
||||
// Filter condition. |
||||
condition?: string |
||||
} @cuetsy(kind="interface") |
||||
|
||||
#MetricFindQueryTypes: "projects" | "services" | "defaultProject" | "metricTypes" | "labelKeys" | "labelValues" | "resourceTypes" | "aggregations" | "aligners" | "alignmentPeriods" | "selectors" | "sloServices" | "slo" @cuetsy(kind="enum", memberNames="Projects|Services|DefaultProject|MetricTypes|LabelKeys|LabelValues|ResourceTypes|Aggregations|Aligners|AlignmentPeriods|Selectors|SLOServices|SLO") |
||||
}, |
||||
|
||||
] |
||||
}, |
||||
] |
||||
} |
||||
} |
||||
@ -0,0 +1,363 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// public/app/plugins/gen.go
|
||||
// Using jennies:
|
||||
// TSTypesJenny
|
||||
// PluginTSTypesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
import * as common from '@grafana/schema'; |
||||
|
||||
export const DataQueryModelVersion = Object.freeze([0, 0]); |
||||
|
||||
export interface CloudMonitoringQuery extends common.DataQuery { |
||||
/** |
||||
* Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail. |
||||
*/ |
||||
aliasBy?: string; |
||||
/** |
||||
* Time interval in milliseconds. |
||||
*/ |
||||
intervalMs?: number; |
||||
/** |
||||
* SLO sub-query properties. |
||||
*/ |
||||
sloQuery?: SLOQuery; |
||||
/** |
||||
* GCM query type. |
||||
* queryType: #QueryType |
||||
* Time Series List sub-query properties. |
||||
*/ |
||||
timeSeriesList?: (TimeSeriesList | AnnotationQuery); |
||||
/** |
||||
* Time Series sub-query properties. |
||||
*/ |
||||
timeSeriesQuery?: TimeSeriesQuery; |
||||
} |
||||
|
||||
/** |
||||
* Defines the supported queryTypes. |
||||
*/ |
||||
export enum QueryType { |
||||
ANNOTATION = 'annotation', |
||||
SLO = 'slo', |
||||
TIME_SERIES_LIST = 'timeSeriesList', |
||||
TIME_SERIES_QUERY = 'timeSeriesQuery', |
||||
} |
||||
|
||||
/** |
||||
* Time Series List sub-query properties. |
||||
*/ |
||||
export interface TimeSeriesList { |
||||
/** |
||||
* Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
*/ |
||||
alignmentPeriod?: string; |
||||
/** |
||||
* Reducer applied across a set of time-series values. Defaults to REDUCE_NONE. |
||||
*/ |
||||
crossSeriesReducer: string; |
||||
/** |
||||
* Array of filters to query data by. Labels that can be filtered on are defined by the metric. |
||||
*/ |
||||
filters?: Array<string>; |
||||
/** |
||||
* Array of labels to group data by. |
||||
*/ |
||||
groupBys?: Array<string>; |
||||
/** |
||||
* Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
*/ |
||||
perSeriesAligner?: string; |
||||
/** |
||||
* Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters |
||||
*/ |
||||
preprocessor?: PreprocessorType; |
||||
/** |
||||
* GCP project to execute the query against. |
||||
*/ |
||||
projectName: string; |
||||
/** |
||||
* Only present if a preprocessor is selected. Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
*/ |
||||
secondaryAlignmentPeriod?: string; |
||||
/** |
||||
* Only present if a preprocessor is selected. Reducer applied across a set of time-series values. Defaults to REDUCE_NONE. |
||||
*/ |
||||
secondaryCrossSeriesReducer?: string; |
||||
/** |
||||
* Only present if a preprocessor is selected. Array of labels to group data by. |
||||
*/ |
||||
secondaryGroupBys?: Array<string>; |
||||
/** |
||||
* Only present if a preprocessor is selected. Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
*/ |
||||
secondaryPerSeriesAligner?: string; |
||||
/** |
||||
* Data view, defaults to FULL. |
||||
*/ |
||||
view?: string; |
||||
} |
||||
|
||||
export const defaultTimeSeriesList: Partial<TimeSeriesList> = { |
||||
filters: [], |
||||
groupBys: [], |
||||
secondaryGroupBys: [], |
||||
}; |
||||
|
||||
/** |
||||
* Types of pre-processor available. Defined by the metric. |
||||
*/ |
||||
export enum PreprocessorType { |
||||
Delta = 'delta', |
||||
None = 'none', |
||||
Rate = 'rate', |
||||
} |
||||
|
||||
/** |
||||
* Annotation sub-query properties. |
||||
*/ |
||||
export interface AnnotationQuery extends TimeSeriesList { |
||||
/** |
||||
* Annotation text. |
||||
*/ |
||||
text?: string; |
||||
/** |
||||
* Annotation title. |
||||
*/ |
||||
title?: string; |
||||
} |
||||
|
||||
/** |
||||
* Time Series sub-query properties. |
||||
*/ |
||||
export interface TimeSeriesQuery { |
||||
/** |
||||
* To disable the graphPeriod, it should explictly be set to 'disabled'. |
||||
*/ |
||||
graphPeriod?: ('disabled' | string); |
||||
/** |
||||
* GCP project to execute the query against. |
||||
*/ |
||||
projectName: string; |
||||
/** |
||||
* MQL query to be executed. |
||||
*/ |
||||
query: string; |
||||
} |
||||
|
||||
/** |
||||
* SLO sub-query properties. |
||||
*/ |
||||
export interface SLOQuery { |
||||
/** |
||||
* Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
*/ |
||||
alignmentPeriod?: string; |
||||
/** |
||||
* SLO goal value. |
||||
*/ |
||||
goal?: number; |
||||
/** |
||||
* Specific lookback period for the SLO. |
||||
*/ |
||||
lookbackPeriod?: string; |
||||
/** |
||||
* Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
*/ |
||||
perSeriesAligner?: string; |
||||
/** |
||||
* GCP project to execute the query against. |
||||
*/ |
||||
projectName: string; |
||||
/** |
||||
* SLO selector. |
||||
*/ |
||||
selectorName: string; |
||||
/** |
||||
* ID for the service the SLO is in. |
||||
*/ |
||||
serviceId: string; |
||||
/** |
||||
* Name for the service the SLO is in. |
||||
*/ |
||||
serviceName: string; |
||||
/** |
||||
* ID for the SLO. |
||||
*/ |
||||
sloId: string; |
||||
/** |
||||
* Name of the SLO. |
||||
*/ |
||||
sloName: string; |
||||
} |
||||
|
||||
/** |
||||
* @deprecated This type is for migration purposes only. Replaced by TimeSeriesList Metric sub-query properties. |
||||
*/ |
||||
export interface MetricQuery { |
||||
/** |
||||
* Aliases can be set to modify the legend labels. e.g. {{metric.label.xxx}}. See docs for more detail. |
||||
*/ |
||||
aliasBy?: string; |
||||
/** |
||||
* Alignment period to use when regularizing data. Defaults to cloud-monitoring-auto. |
||||
*/ |
||||
alignmentPeriod?: string; |
||||
/** |
||||
* Reducer applied across a set of time-series values. Defaults to REDUCE_NONE. |
||||
*/ |
||||
crossSeriesReducer: string; |
||||
editorMode: string; |
||||
/** |
||||
* Array of filters to query data by. Labels that can be filtered on are defined by the metric. |
||||
*/ |
||||
filters?: Array<string>; |
||||
/** |
||||
* To disable the graphPeriod, it should explictly be set to 'disabled'. |
||||
*/ |
||||
graphPeriod?: ('disabled' | string); |
||||
/** |
||||
* Array of labels to group data by. |
||||
*/ |
||||
groupBys?: Array<string>; |
||||
metricKind?: MetricKind; |
||||
metricType: string; |
||||
/** |
||||
* Alignment function to be used. Defaults to ALIGN_MEAN. |
||||
*/ |
||||
perSeriesAligner?: string; |
||||
/** |
||||
* Preprocessor is not part of the API, but is used to store the preprocessor and not affect the UI for the rest of parameters |
||||
*/ |
||||
preprocessor?: PreprocessorType; |
||||
/** |
||||
* GCP project to execute the query against. |
||||
*/ |
||||
projectName: string; |
||||
/** |
||||
* MQL query to be executed. |
||||
*/ |
||||
query: string; |
||||
valueType?: string; |
||||
view?: string; |
||||
} |
||||
|
||||
export const defaultMetricQuery: Partial<MetricQuery> = { |
||||
filters: [], |
||||
groupBys: [], |
||||
}; |
||||
|
||||
export enum MetricKind { |
||||
CUMULATIVE = 'CUMULATIVE', |
||||
DELTA = 'DELTA', |
||||
GAUGE = 'GAUGE', |
||||
METRIC_KIND_UNSPECIFIED = 'METRIC_KIND_UNSPECIFIED', |
||||
} |
||||
|
||||
export enum ValueTypes { |
||||
BOOL = 'BOOL', |
||||
DISTRIBUTION = 'DISTRIBUTION', |
||||
DOUBLE = 'DOUBLE', |
||||
INT64 = 'INT64', |
||||
MONEY = 'MONEY', |
||||
STRING = 'STRING', |
||||
VALUE_TYPE_UNSPECIFIED = 'VALUE_TYPE_UNSPECIFIED', |
||||
} |
||||
|
||||
export enum AlignmentTypes { |
||||
ALIGN_COUNT = 'ALIGN_COUNT', |
||||
ALIGN_COUNT_FALSE = 'ALIGN_COUNT_FALSE', |
||||
ALIGN_COUNT_TRUE = 'ALIGN_COUNT_TRUE', |
||||
ALIGN_DELTA = 'ALIGN_DELTA', |
||||
ALIGN_FRACTION_TRUE = 'ALIGN_FRACTION_TRUE', |
||||
ALIGN_INTERPOLATE = 'ALIGN_INTERPOLATE', |
||||
ALIGN_MAX = 'ALIGN_MAX', |
||||
ALIGN_MEAN = 'ALIGN_MEAN', |
||||
ALIGN_MIN = 'ALIGN_MIN', |
||||
ALIGN_NEXT_OLDER = 'ALIGN_NEXT_OLDER', |
||||
ALIGN_NONE = 'ALIGN_NONE', |
||||
ALIGN_PERCENTILE_05 = 'ALIGN_PERCENTILE_05', |
||||
ALIGN_PERCENTILE_50 = 'ALIGN_PERCENTILE_50', |
||||
ALIGN_PERCENTILE_95 = 'ALIGN_PERCENTILE_95', |
||||
ALIGN_PERCENTILE_99 = 'ALIGN_PERCENTILE_99', |
||||
ALIGN_PERCENT_CHANGE = 'ALIGN_PERCENT_CHANGE', |
||||
ALIGN_RATE = 'ALIGN_RATE', |
||||
ALIGN_STDDEV = 'ALIGN_STDDEV', |
||||
ALIGN_SUM = 'ALIGN_SUM', |
||||
} |
||||
|
||||
/** |
||||
* @deprecated Use AnnotationQuery instead. Legacy annotation query properties for migration purposes. |
||||
*/ |
||||
export interface LegacyCloudMonitoringAnnotationQuery { |
||||
/** |
||||
* Array of filters to query data by. Labels that can be filtered on are defined by the metric. |
||||
*/ |
||||
filters: Array<string>; |
||||
metricKind: MetricKind; |
||||
metricType: string; |
||||
/** |
||||
* GCP project to execute the query against. |
||||
*/ |
||||
projectName: string; |
||||
/** |
||||
* Query refId. |
||||
*/ |
||||
refId: string; |
||||
/** |
||||
* Annotation text. |
||||
*/ |
||||
text: string; |
||||
/** |
||||
* Annotation title. |
||||
*/ |
||||
title: string; |
||||
valueType: string; |
||||
} |
||||
|
||||
export const defaultLegacyCloudMonitoringAnnotationQuery: Partial<LegacyCloudMonitoringAnnotationQuery> = { |
||||
filters: [], |
||||
}; |
||||
|
||||
/** |
||||
* Query filter representation. |
||||
*/ |
||||
export interface Filter { |
||||
/** |
||||
* Filter condition. |
||||
*/ |
||||
condition?: string; |
||||
/** |
||||
* Filter key. |
||||
*/ |
||||
key: string; |
||||
/** |
||||
* Filter operator. |
||||
*/ |
||||
operator: string; |
||||
/** |
||||
* Filter value. |
||||
*/ |
||||
value: string; |
||||
} |
||||
|
||||
export enum MetricFindQueryTypes { |
||||
Aggregations = 'aggregations', |
||||
Aligners = 'aligners', |
||||
AlignmentPeriods = 'alignmentPeriods', |
||||
DefaultProject = 'defaultProject', |
||||
LabelKeys = 'labelKeys', |
||||
LabelValues = 'labelValues', |
||||
MetricTypes = 'metricTypes', |
||||
Projects = 'projects', |
||||
ResourceTypes = 'resourceTypes', |
||||
SLO = 'slo', |
||||
SLOServices = 'sloServices', |
||||
Selectors = 'selectors', |
||||
Services = 'services', |
||||
} |
||||
|
||||
export interface GoogleCloudMonitoring {} |
||||
@ -1,233 +0,0 @@ |
||||
import { DataQuery, SelectableValue } from '@grafana/data'; |
||||
import { DataSourceOptions, DataSourceSecureJsonData } from '@grafana/google-sdk'; |
||||
|
||||
export enum MetricFindQueryTypes { |
||||
Projects = 'projects', |
||||
Services = 'services', |
||||
DefaultProject = 'defaultProject', |
||||
MetricTypes = 'metricTypes', |
||||
LabelKeys = 'labelKeys', |
||||
LabelValues = 'labelValues', |
||||
ResourceTypes = 'resourceTypes', |
||||
Aggregations = 'aggregations', |
||||
Aligners = 'aligners', |
||||
AlignmentPeriods = 'alignmentPeriods', |
||||
Selectors = 'selectors', |
||||
SLOServices = 'sloServices', |
||||
SLO = 'slo', |
||||
} |
||||
|
||||
export interface CloudMonitoringVariableQuery extends DataQuery { |
||||
selectedQueryType: string; |
||||
selectedService: string; |
||||
selectedMetricType: string; |
||||
selectedSLOService: string; |
||||
labelKey: string; |
||||
projects: SelectableValue[]; |
||||
sloServices: SelectableValue[]; |
||||
projectName: string; |
||||
} |
||||
|
||||
export interface VariableQueryData { |
||||
selectedQueryType: string; |
||||
metricDescriptors: MetricDescriptor[]; |
||||
selectedService: string; |
||||
selectedMetricType: string; |
||||
selectedSLOService: string; |
||||
labels: string[]; |
||||
labelKey: string; |
||||
metricTypes: Array<{ value: string; name: string }>; |
||||
services: SelectableValue[]; |
||||
projects: SelectableValue[]; |
||||
sloServices: SelectableValue[]; |
||||
projectName: string; |
||||
loading: boolean; |
||||
} |
||||
|
||||
export interface Aggregation { |
||||
crossSeriesReducer?: string; |
||||
groupBys?: string[]; |
||||
} |
||||
|
||||
export enum QueryType { |
||||
TIME_SERIES_LIST = 'timeSeriesList', |
||||
TIME_SERIES_QUERY = 'timeSeriesQuery', |
||||
SLO = 'slo', |
||||
ANNOTATION = 'annotation', |
||||
} |
||||
|
||||
export enum PreprocessorType { |
||||
None = 'none', |
||||
Rate = 'rate', |
||||
Delta = 'delta', |
||||
} |
||||
|
||||
export enum MetricKind { |
||||
METRIC_KIND_UNSPECIFIED = 'METRIC_KIND_UNSPECIFIED', |
||||
GAUGE = 'GAUGE', |
||||
DELTA = 'DELTA', |
||||
CUMULATIVE = 'CUMULATIVE', |
||||
} |
||||
|
||||
export enum ValueTypes { |
||||
VALUE_TYPE_UNSPECIFIED = 'VALUE_TYPE_UNSPECIFIED', |
||||
BOOL = 'BOOL', |
||||
INT64 = 'INT64', |
||||
DOUBLE = 'DOUBLE', |
||||
STRING = 'STRING', |
||||
DISTRIBUTION = 'DISTRIBUTION', |
||||
MONEY = 'MONEY', |
||||
} |
||||
|
||||
export enum AlignmentTypes { |
||||
ALIGN_DELTA = 'ALIGN_DELTA', |
||||
ALIGN_RATE = 'ALIGN_RATE', |
||||
ALIGN_INTERPOLATE = 'ALIGN_INTERPOLATE', |
||||
ALIGN_NEXT_OLDER = 'ALIGN_NEXT_OLDER', |
||||
ALIGN_MIN = 'ALIGN_MIN', |
||||
ALIGN_MAX = 'ALIGN_MAX', |
||||
ALIGN_MEAN = 'ALIGN_MEAN', |
||||
ALIGN_COUNT = 'ALIGN_COUNT', |
||||
ALIGN_SUM = 'ALIGN_SUM', |
||||
ALIGN_STDDEV = 'ALIGN_STDDEV', |
||||
ALIGN_COUNT_TRUE = 'ALIGN_COUNT_TRUE', |
||||
ALIGN_COUNT_FALSE = 'ALIGN_COUNT_FALSE', |
||||
ALIGN_FRACTION_TRUE = 'ALIGN_FRACTION_TRUE', |
||||
ALIGN_PERCENTILE_99 = 'ALIGN_PERCENTILE_99', |
||||
ALIGN_PERCENTILE_95 = 'ALIGN_PERCENTILE_95', |
||||
ALIGN_PERCENTILE_50 = 'ALIGN_PERCENTILE_50', |
||||
ALIGN_PERCENTILE_05 = 'ALIGN_PERCENTILE_05', |
||||
ALIGN_PERCENT_CHANGE = 'ALIGN_PERCENT_CHANGE', |
||||
ALIGN_NONE = 'ALIGN_NONE', |
||||
} |
||||
|
||||
// deprecated: use TimeSeriesList instead
|
||||
// left here for migration purposes
|
||||
export interface MetricQuery { |
||||
projectName: string; |
||||
perSeriesAligner?: string; |
||||
alignmentPeriod?: string; |
||||
aliasBy?: string; |
||||
editorMode: string; |
||||
metricType: string; |
||||
crossSeriesReducer: string; |
||||
groupBys?: string[]; |
||||
filters?: string[]; |
||||
metricKind?: MetricKind; |
||||
valueType?: string; |
||||
view?: string; |
||||
query: string; |
||||
preprocessor?: PreprocessorType; |
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'
|
||||
graphPeriod?: 'disabled' | string; |
||||
} |
||||
|
||||
export interface TimeSeriesList { |
||||
projectName: string; |
||||
crossSeriesReducer: string; |
||||
alignmentPeriod?: string; |
||||
perSeriesAligner?: string; |
||||
groupBys?: string[]; |
||||
filters?: string[]; |
||||
view?: string; |
||||
secondaryCrossSeriesReducer?: string; |
||||
secondaryAlignmentPeriod?: string; |
||||
secondaryPerSeriesAligner?: string; |
||||
secondaryGroupBys?: string[]; |
||||
// preprocessor is not part of the API, but is used to store the preprocessor
|
||||
// and not affect the UI for the rest of parameters
|
||||
preprocessor?: PreprocessorType; |
||||
} |
||||
|
||||
export interface TimeSeriesQuery { |
||||
projectName: string; |
||||
query: string; |
||||
// To disable the graphPeriod, it should explictly be set to 'disabled'
|
||||
graphPeriod?: 'disabled' | string; |
||||
} |
||||
|
||||
export interface AnnotationQuery extends TimeSeriesList { |
||||
title?: string; |
||||
text?: string; |
||||
} |
||||
|
||||
export interface SLOQuery { |
||||
projectName: string; |
||||
perSeriesAligner?: string; |
||||
alignmentPeriod?: string; |
||||
selectorName: string; |
||||
serviceId: string; |
||||
serviceName: string; |
||||
sloId: string; |
||||
sloName: string; |
||||
goal?: number; |
||||
lookbackPeriod?: string; |
||||
} |
||||
|
||||
export interface CloudMonitoringQuery extends DataQuery { |
||||
aliasBy?: string; |
||||
datasourceId?: number; // Should not be necessary anymore
|
||||
queryType: QueryType; |
||||
timeSeriesList?: TimeSeriesList | AnnotationQuery; |
||||
timeSeriesQuery?: TimeSeriesQuery; |
||||
sloQuery?: SLOQuery; |
||||
intervalMs: number; |
||||
} |
||||
|
||||
export interface CloudMonitoringOptions extends DataSourceOptions { |
||||
gceDefaultProject?: string; |
||||
} |
||||
|
||||
export interface CloudMonitoringSecureJsonData extends DataSourceSecureJsonData {} |
||||
|
||||
export interface LegacyCloudMonitoringAnnotationQuery { |
||||
projectName: string; |
||||
metricType: string; |
||||
refId: string; |
||||
filters: string[]; |
||||
metricKind: MetricKind; |
||||
valueType: string; |
||||
title: string; |
||||
text: string; |
||||
} |
||||
|
||||
export interface QueryMeta { |
||||
alignmentPeriod: string; |
||||
rawQuery: string; |
||||
rawQueryString: string; |
||||
metricLabels: { [key: string]: string[] }; |
||||
resourceLabels: { [key: string]: string[] }; |
||||
resourceTypes: string[]; |
||||
} |
||||
|
||||
export interface MetricDescriptor { |
||||
valueType: string; |
||||
metricKind: MetricKind; |
||||
type: string; |
||||
unit: string; |
||||
service: string; |
||||
serviceShortName: string; |
||||
displayName: string; |
||||
description: string; |
||||
} |
||||
|
||||
export interface Segment { |
||||
type: string; |
||||
value: string; |
||||
} |
||||
|
||||
export interface Filter { |
||||
key: string; |
||||
operator: string; |
||||
value: string; |
||||
condition?: string; |
||||
} |
||||
|
||||
export interface CustomMetaData { |
||||
perSeriesAligner?: string; |
||||
alignmentPeriod?: string; |
||||
} |
||||
|
||||
export interface PostResponse { |
||||
results: Record<string, any>; |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
import { CloudMonitoringQuery as CloudMonitoringQueryBase, QueryType } from '../dataquery.gen'; |
||||
|
||||
export { QueryType }; |
||||
export { |
||||
TimeSeriesList, |
||||
PreprocessorType, |
||||
AnnotationQuery, |
||||
TimeSeriesQuery, |
||||
SLOQuery, |
||||
MetricQuery, |
||||
MetricKind, |
||||
LegacyCloudMonitoringAnnotationQuery, |
||||
Filter, |
||||
AlignmentTypes, |
||||
ValueTypes, |
||||
MetricFindQueryTypes, |
||||
} from '../dataquery.gen'; |
||||
|
||||
/** |
||||
* Represents the query as it moves through the frontend query editor and datasource files. |
||||
* It can represent new queries that are still being edited, so all properties are optional |
||||
*/ |
||||
// TODO: This is a workaround until the type extensions issue is resolved in CUE
|
||||
export interface CloudMonitoringQuery extends CloudMonitoringQueryBase { |
||||
queryType?: QueryType; |
||||
} |
||||
@ -0,0 +1,62 @@ |
||||
import { DataQuery, SelectableValue } from '@grafana/data'; |
||||
import { DataSourceOptions, DataSourceSecureJsonData } from '@grafana/google-sdk'; |
||||
|
||||
import { MetricKind } from './query'; |
||||
|
||||
export interface CloudMonitoringVariableQuery extends DataQuery { |
||||
selectedQueryType: string; |
||||
selectedService: string; |
||||
selectedMetricType: string; |
||||
selectedSLOService: string; |
||||
labelKey: string; |
||||
projects: SelectableValue[]; |
||||
sloServices: SelectableValue[]; |
||||
projectName: string; |
||||
} |
||||
|
||||
export interface VariableQueryData { |
||||
selectedQueryType: string; |
||||
metricDescriptors: MetricDescriptor[]; |
||||
selectedService: string; |
||||
selectedMetricType: string; |
||||
selectedSLOService: string; |
||||
labels: string[]; |
||||
labelKey: string; |
||||
metricTypes: Array<{ value: string; name: string }>; |
||||
services: SelectableValue[]; |
||||
projects: SelectableValue[]; |
||||
sloServices: SelectableValue[]; |
||||
projectName: string; |
||||
loading: boolean; |
||||
} |
||||
|
||||
export interface Aggregation { |
||||
crossSeriesReducer?: string; |
||||
groupBys?: string[]; |
||||
} |
||||
|
||||
export interface CloudMonitoringOptions extends DataSourceOptions { |
||||
gceDefaultProject?: string; |
||||
} |
||||
|
||||
export interface CloudMonitoringSecureJsonData extends DataSourceSecureJsonData {} |
||||
|
||||
export interface MetricDescriptor { |
||||
valueType: string; |
||||
metricKind: MetricKind; |
||||
type: string; |
||||
unit: string; |
||||
service: string; |
||||
serviceShortName: string; |
||||
displayName: string; |
||||
description: string; |
||||
} |
||||
|
||||
export interface CustomMetaData { |
||||
perSeriesAligner?: string; |
||||
alignmentPeriod?: string; |
||||
} |
||||
|
||||
export interface PostResponse { |
||||
results: Record<string, any>; |
||||
} |
||||
Loading…
Reference in new issue