Documentation ¶
Overview ¶
Package awsemfexporter implements an OpenTelemetry Collector exporter that sends EmbeddedMetricFormat to AWS CloudWatch Logs in the region the collector is running in using the PutLogEvents API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
NewFactory creates a factory for AWS EMF exporter.
Types ¶
type Config ¶
type Config struct { config.ExporterSettings `mapstructure:",squash"` // AWSSessionSettings contains the common configuration options // for creating AWS session to communicate with backend awsutil.AWSSessionSettings `mapstructure:",squash"` // LogGroupName is the name of CloudWatch log group which defines group of log streams // that share the same retention, monitoring, and access control settings. LogGroupName string `mapstructure:"log_group_name"` // LogStreamName is the name of CloudWatch log stream which is a sequence of log events // that share the same source. LogStreamName string `mapstructure:"log_stream_name"` // Namespace is a container for CloudWatch metrics. // Metrics in different namespaces are isolated from each other. Namespace string `mapstructure:"namespace"` // DimensionRollupOption is the option for metrics dimension rollup. Three options are available, default option is "ZeroAndSingleDimensionRollup". // "ZeroAndSingleDimensionRollup" - Enable both zero dimension rollup and single dimension rollup // "SingleDimensionRollupOnly" - Enable single dimension rollup // "NoDimensionRollup" - No dimension rollup (only keep original metrics which contain all dimensions) DimensionRollupOption string `mapstructure:"dimension_rollup_option"` // LogRetention is the option to set the log retention policy for the CloudWatch Log Group. Defaults to Never Expire if not specified or set to 0 // Possible values are 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, or 3653 LogRetention int64 `mapstructure:"log_retention"` // ParseJSONEncodedAttributeValues is an array of attribute keys whose corresponding values are JSON-encoded as strings. // Those strings will be decoded to its original json structure. ParseJSONEncodedAttributeValues []string `mapstructure:"parse_json_encoded_attr_values"` // MetricDeclarations is the list of rules to be used to set dimensions for exported metrics. MetricDeclarations []*MetricDeclaration `mapstructure:"metric_declarations"` // MetricDescriptors is the list of override metric descriptors that are sent to the CloudWatch MetricDescriptors []MetricDescriptor `mapstructure:"metric_descriptors"` // OutputDestination is an option to specify the EMFExporter output. Default option is "cloudwatch" // "cloudwatch" - direct the exporter output to CloudWatch backend // "stdout" - direct the exporter output to stdout // TODO: we can support directing output to a file (in the future) while customer specifies a file path here. OutputDestination string `mapstructure:"output_destination"` // EKSFargateContainerInsightsEnabled is an option to reformat certin metric labels so that they take the form of a high level object // The end result will make the labels look like those coming out of ECS and be more easily injected into cloudwatch // Note that at the moment in order to use this feature the value "kubernetes" must also be added to the ParseJSONEncodedAttributeValues array in order to be used EKSFargateContainerInsightsEnabled bool `mapstructure:"eks_fargate_container_insights_enabled"` // ResourceToTelemetrySettings is the option for converting resource attrihutes 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"` // contains filtered or unexported fields }
Config defines configuration for AWS EMF exporter.
type LabelMatcher ¶
type LabelMatcher struct { // List of label names to filter by. Their corresponding values are concatenated using // the separator and matched against the specified regular expression. LabelNames []string `mapstructure:"label_names"` // (Optional) Separator placed between concatenated source label values. (Default: ';') Separator string `mapstructure:"separator"` // Regex string to be used to match against values of the concatenated labels. Regex string `mapstructure:"regex"` // contains filtered or unexported fields }
LabelMatcher defines a label filtering rule against the labels of incoming metrics. Only metrics that match the rules will be used by the surrounding MetricDeclaration.
type MetricDeclaration ¶
type MetricDeclaration struct { // Dimensions is a list of dimension sets (which are lists of dimension names) to be // included in exported metrics. If the metric does not contain any of the specified // dimensions, the metric would be dropped (will only show up in logs). Dimensions [][]string `mapstructure:"dimensions"` // MetricNameSelectors is a list of regex strings to be matched against metric names // to determine which metrics should be included with this metric declaration rule. MetricNameSelectors []string `mapstructure:"metric_name_selectors"` // (Optional) List of label matchers that define matching rules to filter against // the labels of incoming metrics. LabelMatchers []*LabelMatcher `mapstructure:"label_matchers"` // contains filtered or unexported fields }
MetricDeclaration characterizes a rule to be used to set dimensions for certain incoming metrics, filtered by their metric names.
func (*MetricDeclaration) ExtractDimensions ¶
func (m *MetricDeclaration) ExtractDimensions(labels map[string]string) (dimensions [][]string)
ExtractDimensions filters through the dimensions defined in the given metric declaration and returns dimensions that only contains labels from in the given label set.
func (*MetricDeclaration) MatchesLabels ¶
func (m *MetricDeclaration) MatchesLabels(labels map[string]string) bool
MatchesLabels returns true if the given OTLP Metric's name matches any of the Metric Declaration's label matchers.
func (*MetricDeclaration) MatchesName ¶
func (m *MetricDeclaration) MatchesName(metricName string) bool
MatchesName returns true if the given OTLP Metric's name matches any of the Metric Declaration's metric name selectors.
type MetricDescriptor ¶
type MetricDescriptor struct { // MetricName is the name of the metric MetricName string `mapstructure:"metric_name"` // Unit defines the override value of metric descriptor `unit` Unit string `mapstructure:"unit"` // Overwrite set to true means the existing metric descriptor will be overwritten or a new metric descriptor will be created; false means // the descriptor will only be configured if empty. Overwrite bool `mapstructure:"overwrite"` }