model

package
v0.61.2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultPeriodSeconds = int64(300)
	DefaultLengthSeconds = int64(300)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudwatchData

type CloudwatchData struct {
	MetricName string
	// ResourceName will have different values depending on the job type
	// DiscoveryJob = Resource ARN associated with the metric or global when it could not be associated but shouldn't be dropped
	// StaticJob = Resource Name from static job config
	// CustomNamespace = Custom Namespace job name
	ResourceName string
	Namespace    string
	Tags         []Tag
	Dimensions   []Dimension
	// GetMetricDataProcessingParams includes necessary fields to run GetMetricData
	GetMetricDataProcessingParams *GetMetricDataProcessingParams

	// MetricMigrationParams holds configuration values necessary when migrating the resulting metrics
	MetricMigrationParams MetricMigrationParams

	// GetMetricsDataResult is an optional field and will be non-nil when metric data was populated from the GetMetricsData API (Discovery and CustomNamespace jobs)
	GetMetricDataResult *GetMetricDataResult

	// GetMetricStatisticsResult is an optional field and will be non-nil when metric data was populated from the GetMetricStatistics API (static jobs)
	GetMetricStatisticsResult *GetMetricStatisticsResult
}

CloudwatchData is an internal representation of a CloudWatch metric with attached data points, metric and resource information.

type CloudwatchMetricResult added in v0.55.0

type CloudwatchMetricResult struct {
	Context *ScrapeContext
	Data    []*CloudwatchData
}

type CustomNamespaceJob added in v0.56.0

type CustomNamespaceJob struct {
	Regions                   []string
	Name                      string
	Namespace                 string
	RoundingPeriod            *int64
	RecentlyActiveOnly        bool
	Roles                     []Role
	Metrics                   []*MetricConfig
	CustomTags                []Tag
	DimensionNameRequirements []string
}

type Datapoint added in v0.52.0

type Datapoint struct {
	// The average of the metric values that correspond to the data point.
	Average *float64

	// The percentile statistic for the data point.
	ExtendedStatistics map[string]*float64

	// The maximum metric value for the data point.
	Maximum *float64

	// The minimum metric value for the data point.
	Minimum *float64

	// The number of metric values that contributed to the aggregate value of this
	// data point.
	SampleCount *float64

	// The sum of the metric values for the data point.
	Sum *float64

	// The time stamp used for the data point.
	Timestamp *time.Time
}

type Dimension added in v0.52.0

type Dimension struct {
	Name  string
	Value string
}

type DimensionsRegexp added in v0.57.0

type DimensionsRegexp struct {
	Regexp          *regexp.Regexp
	DimensionsNames []string
}

type DiscoveryJob added in v0.56.0

type DiscoveryJob struct {
	Regions                     []string
	Type                        string
	Roles                       []Role
	SearchTags                  []SearchTag
	CustomTags                  []Tag
	DimensionNameRequirements   []string
	Metrics                     []*MetricConfig
	RoundingPeriod              *int64
	RecentlyActiveOnly          bool
	ExportedTagsOnMetrics       []string
	IncludeContextOnInfoMetrics bool
	DimensionsRegexps           []DimensionsRegexp
}

type GetMetricDataProcessingParams added in v0.57.0

type GetMetricDataProcessingParams struct {
	// QueryID is a value internal to processing used for mapping results from GetMetricData their original request
	QueryID string

	// The statistic to be used to call GetMetricData
	Statistic string

	// Fields which impact the start and endtime for
	Period int64
	Length int64
	Delay  int64
}

type GetMetricDataResult added in v0.57.0

type GetMetricDataResult struct {
	Statistic string
	Datapoint *float64
	Timestamp time.Time
}

type GetMetricStatisticsResult added in v0.57.0

type GetMetricStatisticsResult struct {
	Datapoints []*Datapoint
	Statistics []string
}

type JobsConfig added in v0.56.0

type JobsConfig struct {
	StsRegion           string
	DiscoveryJobs       []DiscoveryJob
	StaticJobs          []StaticJob
	CustomNamespaceJobs []CustomNamespaceJob
}

type LabelSet

type LabelSet map[string]struct{}

type Metric added in v0.52.0

type Metric struct {
	// The dimensions for the metric.
	Dimensions []Dimension
	MetricName string
	Namespace  string
}

type MetricConfig added in v0.56.0

type MetricConfig struct {
	Name                   string
	Statistics             []string
	Period                 int64
	Length                 int64
	Delay                  int64
	NilToZero              bool
	AddCloudwatchTimestamp bool
}

type MetricMigrationParams added in v0.57.0

type MetricMigrationParams struct {
	NilToZero              bool
	AddCloudwatchTimestamp bool
}

type Role added in v0.56.0

type Role struct {
	RoleArn    string
	ExternalID string
}

type ScrapeContext added in v0.57.0

type ScrapeContext struct {
	Region       string
	AccountID    string
	AccountAlias string
	CustomTags   []Tag
}

type SearchTag added in v0.57.0

type SearchTag struct {
	Key   string
	Value *regexp.Regexp
}

type StaticJob added in v0.56.0

type StaticJob struct {
	Name       string
	Regions    []string
	Roles      []Role
	Namespace  string
	CustomTags []Tag
	Dimensions []Dimension
	Metrics    []*MetricConfig
}

type Tag

type Tag struct {
	Key   string
	Value string
}

type TaggedResource

type TaggedResource struct {
	// ARN is the unique AWS ARN (Amazon Resource Name) of the resource
	ARN string

	// Namespace identifies the resource type (e.g. EC2)
	Namespace string

	// Region is the AWS regions that the resource belongs to
	Region string

	// Tags is a set of tags associated to the resource
	Tags []Tag
}

TaggedResource is an AWS resource with tags

func (TaggedResource) FilterThroughTags

func (r TaggedResource) FilterThroughTags(filterTags []SearchTag) bool

FilterThroughTags returns true if all filterTags match with tags of the TaggedResource, returns false otherwise.

func (TaggedResource) MetricTags

func (r TaggedResource) MetricTags(exportedTags []string) []Tag

MetricTags returns a list of tags built from the tags of TaggedResource, if exportedTags is not empty.

Returned tags have as key the key from exportedTags, and as value the value from the corresponding tag of the resource, if it exists (otherwise an empty string).

type TaggedResourceResult added in v0.57.0

type TaggedResourceResult struct {
	Context *ScrapeContext
	Data    []*TaggedResource
}

Jump to

Keyboard shortcuts

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