Documentation ¶
Index ¶
- Constants
- Variables
- type AccountsProvider
- type CloudWatchLogsAPIProvider
- type CloudWatchMetricsAPIProvider
- type CloudWatchQuery
- func (q *CloudWatchQuery) BuildDeepLink(startTime time.Time, endTime time.Time) (string, error)
- func (q *CloudWatchQuery) GetGetMetricDataAPIMode() GMDApiMode
- func (q *CloudWatchQuery) IsInferredSearchExpression() bool
- func (q *CloudWatchQuery) IsMathExpression() bool
- func (q *CloudWatchQuery) IsMultiValuedDimensionExpression() bool
- func (q *CloudWatchQuery) IsUserDefinedSearchExpression() bool
- type CloudWatchSettings
- type Duration
- type EC2APIProvider
- type GMDApiMode
- type HttpError
- type ListMetricsProvider
- type LogGroupsProvider
- type LogsQuery
- type MetricEditorMode
- type MetricQueryType
- type MetricsClientProvider
- type OAMAPIProvider
- type QueryError
- type QueryRowResponse
- type RegionsAPIProvider
- type RequestContext
- type RequestContextFactoryFunc
- type RouteHandlerFunc
- type SQLExpressionGroupBy
Constants ¶
View Source
const ( MetricEditorModeBuilder = dataquery.MetricEditorModeN0 MetricEditorModeRaw = dataquery.MetricEditorModeN1 )
View Source
const ( MetricQueryTypeSearch = dataquery.MetricQueryTypeN0 MetricQueryTypeQuery = dataquery.MetricQueryTypeN1 )
View Source
const ( MaxMetricsExceeded = "MaxMetricsExceeded" MaxQueryTimeRangeExceeded = "MaxQueryTimeRangeExceeded" MaxQueryResultsExceeded = "MaxQueryResultsExceeded" MaxMatchingResultsExceeded = "MaxMatchingResultsExceeded" )
Variables ¶
View Source
var ErrMissingRegion = fmt.Errorf("missing default region")
View Source
var ErrorMessages = map[string]string{ MaxMetricsExceeded: "Maximum number of allowed metrics exceeded. Your search may have been limited", MaxQueryTimeRangeExceeded: "Max time window exceeded for query", MaxQueryResultsExceeded: "Only the first 500 time series can be returned by a query.", MaxMatchingResultsExceeded: "The query matched more than 10.000 metrics, results might not be accurate.", }
Functions ¶
This section is empty.
Types ¶
type AccountsProvider ¶
type CloudWatchLogsAPIProvider ¶
type CloudWatchLogsAPIProvider interface { DescribeLogGroupsWithContext(ctx context.Context, in *cloudwatchlogs.DescribeLogGroupsInput, opts ...request.Option) (*cloudwatchlogs.DescribeLogGroupsOutput, error) GetLogGroupFieldsWithContext(ctx context.Context, in *cloudwatchlogs.GetLogGroupFieldsInput, option ...request.Option) (*cloudwatchlogs.GetLogGroupFieldsOutput, error) }
type CloudWatchMetricsAPIProvider ¶
type CloudWatchMetricsAPIProvider interface {
ListMetricsPagesWithContext(ctx context.Context, in *cloudwatch.ListMetricsInput, fn func(*cloudwatch.ListMetricsOutput, bool) bool, opts ...request.Option) error
}
APIs - instead of using the API defined in the services within the aws-sdk-go directly, specify a subset of the API with methods that are actually used in a service or a client
type CloudWatchQuery ¶
type CloudWatchQuery struct { RefId string Region string Id string Namespace string MetricName string Statistic string Expression string Sql sqlExpression SqlExpression string ReturnData bool Dimensions map[string][]string Period int Label string MatchExact bool UsedExpression string TimezoneUTCOffset string MetricQueryType dataquery.MetricQueryType MetricEditorMode dataquery.MetricEditorMode AccountId *string // contains filtered or unexported fields }
func ParseMetricDataQueries ¶
func ParseMetricDataQueries(dataQueries []backend.DataQuery, startTime time.Time, endTime time.Time, defaultRegion string, logger log.Logger, crossAccountQueryingEnabled bool) ([]*CloudWatchQuery, error)
ParseMetricDataQueries decodes the metric data queries json, validates, sets default values and returns an array of CloudWatchQueries. The CloudWatchQuery has a 1 to 1 mapping to a query editor row
func (*CloudWatchQuery) BuildDeepLink ¶
func (*CloudWatchQuery) GetGetMetricDataAPIMode ¶
func (q *CloudWatchQuery) GetGetMetricDataAPIMode() GMDApiMode
func (*CloudWatchQuery) IsInferredSearchExpression ¶
func (q *CloudWatchQuery) IsInferredSearchExpression() bool
func (*CloudWatchQuery) IsMathExpression ¶
func (q *CloudWatchQuery) IsMathExpression() bool
func (*CloudWatchQuery) IsMultiValuedDimensionExpression ¶
func (q *CloudWatchQuery) IsMultiValuedDimensionExpression() bool
func (*CloudWatchQuery) IsUserDefinedSearchExpression ¶
func (q *CloudWatchQuery) IsUserDefinedSearchExpression() bool
type CloudWatchSettings ¶
type CloudWatchSettings struct { awsds.AWSDatasourceSettings Namespace string `json:"customMetricsNamespaces"` SecureSocksProxyEnabled bool `json:"enableSecureSocksProxy"` // this can be removed when https://github.com/grafana/grafana/issues/39089 is implemented LogsTimeout Duration `json:"logsTimeout"` // GrafanaSettings are fetched from the GrafanaCfg in the context GrafanaSettings awsds.AuthSettings `json:"-"` }
func LoadCloudWatchSettings ¶
func LoadCloudWatchSettings(ctx context.Context, config backend.DataSourceInstanceSettings) (CloudWatchSettings, error)
type Duration ¶
func (*Duration) UnmarshalJSON ¶
type EC2APIProvider ¶
type EC2APIProvider interface { DescribeRegionsWithContext(ctx context.Context, in *ec2.DescribeRegionsInput, opts ...request.Option) (*ec2.DescribeRegionsOutput, error) DescribeInstancesPagesWithContext(ctx context.Context, in *ec2.DescribeInstancesInput, fn func(*ec2.DescribeInstancesOutput, bool) bool, opts ...request.Option) error }
type GMDApiMode ¶
type GMDApiMode uint32
const ( GMDApiModeMetricStat GMDApiMode = iota GMDApiModeInferredSearchExpression GMDApiModeMathExpression GMDApiModeSQLExpression )
type ListMetricsProvider ¶
type ListMetricsProvider interface { GetDimensionKeysByDimensionFilter(ctx context.Context, r resources.DimensionKeysRequest) ([]resources.ResourceResponse[string], error) GetDimensionValuesByDimensionFilter(ctx context.Context, r resources.DimensionValuesRequest) ([]resources.ResourceResponse[string], error) GetMetricsByNamespace(ctx context.Context, r resources.MetricsRequest) ([]resources.ResourceResponse[resources.Metric], error) }
Services
type LogGroupsProvider ¶
type LogGroupsProvider interface { GetLogGroupsWithContext(ctx context.Context, request resources.LogGroupsRequest) ([]resources.ResourceResponse[resources.LogGroup], error) GetLogGroupFieldsWithContext(ctx context.Context, request resources.LogGroupFieldsRequest, option ...request.Option) ([]resources.ResourceResponse[resources.LogGroupField], error) }
type MetricEditorMode ¶
type MetricEditorMode dataquery.MetricEditorMode
type MetricQueryType ¶
type MetricQueryType dataquery.MetricQueryType
type MetricsClientProvider ¶
type MetricsClientProvider interface {
ListMetricsWithPageLimit(ctx context.Context, params *cloudwatch.ListMetricsInput) ([]resources.MetricResponse, error)
}
Clients
type OAMAPIProvider ¶
type OAMAPIProvider interface { ListSinksWithContext(ctx context.Context, in *oam.ListSinksInput, opts ...request.Option) (*oam.ListSinksOutput, error) ListAttachedLinksWithContext(ctx context.Context, in *oam.ListAttachedLinksInput, opts ...request.Option) (*oam.ListAttachedLinksOutput, error) }
type QueryError ¶
func (*QueryError) Error ¶
func (e *QueryError) Error() string
type QueryRowResponse ¶
type QueryRowResponse struct { ErrorCodes map[string]bool HasArithmeticError bool ArithmeticErrorMessage string HasPermissionError bool PermissionErrorMessage string Metrics []*cloudwatch.MetricDataResult StatusCode string // contains filtered or unexported fields }
queryRowResponse represents the GetMetricData response for a query row in the query editor.
func NewQueryRowResponse ¶
func NewQueryRowResponse(errors map[string]bool) QueryRowResponse
func (*QueryRowResponse) AddArithmeticError ¶
func (q *QueryRowResponse) AddArithmeticError(message *string)
func (*QueryRowResponse) AddMetricDataResult ¶
func (q *QueryRowResponse) AddMetricDataResult(mdr *cloudwatch.MetricDataResult)
func (*QueryRowResponse) AddPermissionError ¶
func (q *QueryRowResponse) AddPermissionError(message *string)
type RegionsAPIProvider ¶
type RequestContext ¶
type RequestContext struct { MetricsClientProvider MetricsClientProvider LogsAPIProvider CloudWatchLogsAPIProvider OAMAPIProvider OAMAPIProvider EC2APIProvider EC2APIProvider Settings CloudWatchSettings Logger log.Logger }
type RequestContextFactoryFunc ¶
type RequestContextFactoryFunc func(ctx context.Context, pluginCtx backend.PluginContext, region string) (reqCtx RequestContext, err error)
type RouteHandlerFunc ¶
type RouteHandlerFunc func(ctx context.Context, pluginCtx backend.PluginContext, reqContextFactory RequestContextFactoryFunc, parameters url.Values) ([]byte, *HttpError)
type SQLExpressionGroupBy ¶
type SQLExpressionGroupBy struct { Expressions []dataquery.QueryEditorGroupByExpression `json:"expressions"` Type dataquery.QueryEditorArrayExpressionType `json:"type"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.