Documentation ¶
Overview ¶
Package cloudwatch provides a metric exporter for the OpenTelemetry collector.
Index ¶
- Constants
- Variables
- func BuildDimensions(tagMap map[string]string) []*cloudwatch.Dimension
- func ConvertOtelDimensions(attributes pcommon.Map) []*cloudwatch.Dimension
- func ConvertOtelHistogramDataPoints(dataPoints pmetric.HistogramDataPointSlice, name string, unit string, ...) []*aggregationDatum
- func ConvertOtelMetric(m pmetric.Metric, entity cloudwatch.Entity) []*aggregationDatum
- func ConvertOtelMetrics(m pmetric.Metrics) []*aggregationDatum
- func ConvertOtelNumberDataPoints(dataPoints pmetric.NumberDataPointSlice, name string, unit string, ...) []*aggregationDatum
- func GetUniqueRollupList(inputLists [][]string) [][]string
- func NewFactory() exporter.Factory
- func NumberDataPointValue(dp pmetric.NumberDataPoint) float64
- type Aggregator
- type CloudWatch
- func (c *CloudWatch) BuildMetricDatum(metric *aggregationDatum) (cloudwatch.Entity, []*cloudwatch.MetricDatum)
- func (c *CloudWatch) Capabilities() consumer.Capabilities
- func (c *CloudWatch) Close() error
- func (c *CloudWatch) Connect() error
- func (c *CloudWatch) ConsumeMetrics(ctx context.Context, metrics pmetric.Metrics) error
- func (c *CloudWatch) Description() string
- func (c *CloudWatch) IsDropping(metricName string) bool
- func (c *CloudWatch) ProcessRollup(rawDimensions []*cloudwatch.Dimension) [][]*cloudwatch.Dimension
- func (c *CloudWatch) SampleConfig() string
- func (c *CloudWatch) Shutdown(ctx context.Context) error
- func (c *CloudWatch) Start(_ context.Context, host component.Host) error
- func (c *CloudWatch) Write(metrics []telegraf.Metric) error
- func (c *CloudWatch) WriteToCloudWatch(req interface{})
- type Config
- type MetricDatumBatch
Constants ¶
const (
MaxDimensions = 30
)
Variables ¶
var (
TypeStr, _ = component.NewType("awscloudwatch")
)
Functions ¶
func BuildDimensions ¶
func BuildDimensions(tagMap map[string]string) []*cloudwatch.Dimension
BuildDimensions converts the given map of strings to a list of dimensions. CloudWatch supports up to 30 dimensions per metric. So keep up to the first 30 alphabetically. This always includes the "host" tag if it exists. See https://github.com/aws/amazon-cloudwatch-agent/issues/398
func ConvertOtelDimensions ¶ added in v1.300025.0
func ConvertOtelDimensions(attributes pcommon.Map) []*cloudwatch.Dimension
ConvertOtelDimensions will returns a sorted list of dimensions.
func ConvertOtelHistogramDataPoints ¶ added in v1.300025.0
func ConvertOtelHistogramDataPoints( dataPoints pmetric.HistogramDataPointSlice, name string, unit string, scale float64, entity cloudwatch.Entity, ) []*aggregationDatum
ConvertOtelHistogramDataPoints converts each datapoint in the given slice to Distribution.
func ConvertOtelMetric ¶ added in v1.300025.0
func ConvertOtelMetric(m pmetric.Metric, entity cloudwatch.Entity) []*aggregationDatum
ConvertOtelMetric creates a list of datums from the datapoints in the given metric and returns it. Only supports the metric DataTypes that we plan to use. Intentionally not caching previous values and converting cumulative to delta. Instead use cumulativetodeltaprocessor which supports monotonic cumulative sums.
func ConvertOtelMetrics ¶ added in v1.300025.0
func ConvertOtelNumberDataPoints ¶ added in v1.300025.0
func ConvertOtelNumberDataPoints( dataPoints pmetric.NumberDataPointSlice, name string, unit string, scale float64, entity cloudwatch.Entity, ) []*aggregationDatum
ConvertOtelNumberDataPoints converts each datapoint in the given slice to 1 or more MetricDatums and returns them.
func GetUniqueRollupList ¶
GetUniqueRollupList filters out duplicate dimensions within the sets and filters duplicate sets.
func NewFactory ¶ added in v1.300025.0
func NumberDataPointValue ¶ added in v1.300025.0
func NumberDataPointValue(dp pmetric.NumberDataPoint) float64
NumberDataPointValue converts to float64 since that is what AWS SDK will use.
Types ¶
type Aggregator ¶
type Aggregator interface {
AddMetric(m *aggregationDatum)
}
func NewAggregator ¶
func NewAggregator(metricChan chan<- *aggregationDatum, shutdownChan <-chan struct{}, wg *sync.WaitGroup) Aggregator
type CloudWatch ¶
type CloudWatch struct {
// contains filtered or unexported fields
}
func (*CloudWatch) BuildMetricDatum ¶
func (c *CloudWatch) BuildMetricDatum(metric *aggregationDatum) (cloudwatch.Entity, []*cloudwatch.MetricDatum)
BuildMetricDatum may just return the datum as-is. Or it might expand it into many datums due to dimension aggregation. There may also be more datums due to resize() on a distribution.
func (*CloudWatch) Capabilities ¶ added in v1.300025.0
func (c *CloudWatch) Capabilities() consumer.Capabilities
func (*CloudWatch) Close ¶
func (c *CloudWatch) Close() error
func (*CloudWatch) Connect ¶
func (c *CloudWatch) Connect() error
func (*CloudWatch) ConsumeMetrics ¶ added in v1.300025.0
ConsumeMetrics queues metrics to be published to CW. The actual publishing will occur in a long running goroutine. This method can block when publishing is backed up.
func (*CloudWatch) Description ¶
func (c *CloudWatch) Description() string
func (*CloudWatch) IsDropping ¶ added in v1.247350.0
func (c *CloudWatch) IsDropping(metricName string) bool
func (*CloudWatch) ProcessRollup ¶
func (c *CloudWatch) ProcessRollup(rawDimensions []*cloudwatch.Dimension) [][]*cloudwatch.Dimension
ProcessRollup creates the dimension sets based on the dimensions available in the original metric.
func (*CloudWatch) SampleConfig ¶
func (c *CloudWatch) SampleConfig() string
func (*CloudWatch) Shutdown ¶ added in v1.300025.0
func (c *CloudWatch) Shutdown(ctx context.Context) error
func (*CloudWatch) WriteToCloudWatch ¶
func (c *CloudWatch) WriteToCloudWatch(req interface{})
type Config ¶ added in v1.300025.0
type Config struct { Region string `mapstructure:"region"` EndpointOverride string `mapstructure:"endpoint_override,omitempty"` AccessKey string `mapstructure:"access_key,omitempty"` SecretKey string `mapstructure:"secret_key,omitempty"` RoleARN string `mapstructure:"role_arn,omitempty"` Profile string `mapstructure:"profile,omitempty"` Token string `mapstructure:"token,omitempty"` ForceFlushInterval time.Duration `mapstructure:"force_flush_interval"` MaxDatumsPerCall int `mapstructure:"max_datums_per_call"` MaxValuesPerDatum int `mapstructure:"max_values_per_datum"` RollupDimensions [][]string `mapstructure:"rollup_dimensions,omitempty"` DropOriginalConfigs map[string]bool `mapstructure:"drop_original_metrics,omitempty"` Namespace string `mapstructure:"namespace"` // ResourceToTelemetrySettings is the option for converting resource // attributes to telemetry attributes. // "Enabled" - A boolean field to enable/disable this option. Default is `false`. // If enabled, all the resource attributes will be converted to metric labels by default. ResourceToTelemetrySettings resourcetotelemetry.Settings `mapstructure:"resource_to_telemetry_conversion"` // MiddlewareID is an ID for an extension that can be used to configure the AWS client. MiddlewareID *component.ID `mapstructure:"middleware,omitempty"` }
Config represent a configuration for the CloudWatch metrics exporter.
type MetricDatumBatch ¶
type MetricDatumBatch struct { MaxDatumsPerCall int Partition map[string][]*cloudwatch.MetricDatum BeginTime time.Time Size int Count int // contains filtered or unexported fields }