models

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 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 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() ([]resources.ResourceResponse[resources.Account], error)
}

type CloudWatchMetricsAPIProvider

type CloudWatchMetricsAPIProvider interface {
	ListMetricsPages(*cloudwatch.ListMetricsInput, func(*cloudwatch.ListMetricsOutput, bool) bool) 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
	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"`
}

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalJSON

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

type EC2APIProvider

type EC2APIProvider interface {
	DescribeRegions(in *ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error)
	DescribeInstancesPages(in *ec2.DescribeInstancesInput, fn func(*ec2.DescribeInstancesOutput, bool) bool) 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(resources.DimensionKeysRequest) ([]resources.ResourceResponse[string], error)
	GetDimensionValuesByDimensionFilter(resources.DimensionValuesRequest) ([]resources.ResourceResponse[string], error)
	GetMetricsByNamespace(r resources.MetricsRequest) ([]resources.ResourceResponse[resources.Metric], error)
}

Services

type LogGroupsProvider

type LogGroupsProvider interface {
	GetLogGroups(request resources.LogGroupsRequest) ([]resources.ResourceResponse[resources.LogGroup], error)
	GetLogGroupFields(request resources.LogGroupFieldsRequest) ([]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(params *cloudwatch.ListMetricsInput) ([]resources.MetricResponse, error)
}

Clients

type OAMAPIProvider

type OAMAPIProvider interface {
	ListSinks(*oam.ListSinksInput) (*oam.ListSinksOutput, error)
	ListAttachedLinks(*oam.ListAttachedLinksInput) (*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
	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)

type RequestContext

type RequestContext struct {
	MetricsClientProvider MetricsClientProvider
	LogsAPIProvider       CloudWatchLogsAPIProvider
	OAMAPIProvider        OAMAPIProvider
	Settings              CloudWatchSettings
	Features              featuremgmt.FeatureToggles
}

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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