models

package
v11.1.4-modfix Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

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 AccountsProvider interface {
	GetAccountsForCurrentUserOrRole(ctx context.Context) ([]resources.ResourceResponse[resources.Account], error)
}

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 (q *CloudWatchQuery) BuildDeepLink(startTime time.Time, endTime time.Time) (string, error)

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:"-"`
}

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalJSON

func (duration *Duration) UnmarshalJSON(b []byte) error

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 HttpError

type HttpError struct {
	Message    string
	Error      string
	StatusCode int
}

func NewHttpError

func NewHttpError(message string, statusCode int, err error) *HttpError

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 LogsQuery

type LogsQuery struct {
	dataquery.CloudWatchLogsQuery
	StartTime     *int64
	EndTime       *int64
	Limit         *int64
	LogGroupName  string
	LogStreamName string
	QueryId       string
	QueryString   string
	StartFromHead bool
	Subtype       string
}

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

type QueryError struct {
	Err   error
	RefID string
}

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 RegionsAPIProvider interface {
	GetRegions(ctx context.Context) ([]resources.ResourceResponse[resources.Region], error)
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL