models

package
v0.0.0-cloud Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

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
	Alias             string
	Label             string
	MatchExact        bool
	UsedExpression    string
	TimezoneUTCOffset string
	MetricQueryType   MetricQueryType
	MetricEditorMode  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, dynamicLabelsEnabled,
	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, dynamicLabelEnabled bool) (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
}

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 LogGroup

type LogGroup struct {
	ARN       string `json:"arn"`
	Name      string `json:"name"`
	AccountID string `json:"accountId"`
}

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 {
	LogType            string `json:"type"`
	SubType            string
	Limit              *int64
	Time               int64
	StartTime          *int64
	EndTime            *int64
	LogGroupName       string
	LogGroupNames      []string
	LogGroups          []LogGroup `json:"logGroups"`
	LogGroupNamePrefix string
	LogStreamName      string
	StartFromHead      bool
	Region             string
	QueryString        string
	QueryId            string
	StatsGroups        []string
	Subtype            string
	Expression         string
}

type MetricEditorMode

type MetricEditorMode uint32
const (
	MetricEditorModeBuilder MetricEditorMode = iota
	MetricEditorModeRaw
)

type MetricQueryType

type MetricQueryType uint32
const (
	MetricQueryTypeSearch MetricQueryType = iota
	MetricQueryTypeQuery
)

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(pluginCtx backend.PluginContext, region string) (reqCtx RequestContext, err error)

type RouteHandlerFunc

type RouteHandlerFunc func(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