Documentation ¶
Index ¶
- Constants
- func DatapointToString(dp *sfxpb.DataPoint) string
- func LogRecordSliceToSignalFxV2(logger *zap.Logger, logs plog.LogRecordSlice, resourceAttrs pcommon.Map) ([]*sfxpb.Event, int)
- type Action
- type AggregationMethod
- type MetricOperator
- type MetricTranslator
- type MetricValueType
- type MetricsConverter
- type Rule
Constants ¶
const DefaultExcludeMetricsYaml = `` /* 3519-byte string literal not displayed */
DefaultExcludeMetricsYaml holds list of hard coded metrics that will added to the exclude list from the config. It includes non-default metrics collected by receivers. This list is determined by categorization of metrics in the SignalFx Agent. Metrics in the OpenTelemetry convention, that have equivalents in the SignalFx Agent that are categorized as non-default are also included in this list.
const ( // DefaultTranslationRulesYaml defines default translation rules that will be applied to metrics if // config.TranslationRules not specified explicitly. // Keep it in YAML format to be able to easily copy and paste it in config if modifications needed. DefaultTranslationRulesYaml = `` /* 12456-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func DatapointToString ¶ added in v0.38.0
Types ¶
type Action ¶
type Action string
Action is the enum to capture actions to perform on metrics.
const ( // ActionRenameDimensionKeys renames dimension keys using Rule.Mapping. // The rule can be applied only to particular metrics if MetricNames are provided, // otherwise applied to all metrics. ActionRenameDimensionKeys Action = "rename_dimension_keys" // ActionRenameMetrics renames metrics using Rule.Mapping. ActionRenameMetrics Action = "rename_metrics" // ActionMultiplyInt scales integer metrics by multiplying their values using // Rule.ScaleFactorsInt key/values as metric_name/multiplying_factor ActionMultiplyInt Action = "multiply_int" // ActionDivideInt scales integer metric by dividing their values using // Rule.ScaleFactorsInt key/values as metric_name/divisor ActionDivideInt Action = "divide_int" // ActionMultiplyFloat scales integer metric by multiplying their values using // Rule.ScaleFactorsFloat key/values as metric_name/multiplying_factor // This rule can only be applied to metrics that are a float value ActionMultiplyFloat Action = "multiply_float" // ActionConvertValues converts metric values from int to float or float to int // Rule.TypesMapping key/values as metric_name/new_type. ActionConvertValues Action = "convert_values" // ActionCopyMetrics copies metrics using Rule.Mapping. // Rule.DimensionKey and Rule.DimensionValues can be used to filter datapoints that must be copied, // if these fields are set, only metics having a dimension with key == Rule.DimensionKey and // value in Rule.DimensionValues will be copied. ActionCopyMetrics Action = "copy_metrics" // ActionSplitMetric splits a metric with Rule.MetricName into multiple metrics // based on a dimension specified in Rule.DimensionKey. // Rule.Mapping represents "dimension value" -> "new metric name" for the translation. // For example, having the following translation rule: // - action: split_metric // metric_name: k8s.pod.network.io // dimension_key: direction // mapping: // receive: pod_network_receive_bytes_total // transmit: pod_network_transmit_bytes_total // The following translations will be performed: // k8s.pod.network.io{direction="receive"} -> pod_network_receive_bytes_total{} // k8s.pod.network.io{direction="transmit"} -> pod_network_transmit_bytes_total{} ActionSplitMetric Action = "split_metric" // ActionAggregateMetric aggregates metrics excluding dimensions set in tr.WithoutDimensions. // This method is equivalent of "without" clause in Prometheus aggregation: // https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators // It takes datapoints with name tr.MetricName and aggregates them to a smaller set keeping the same name. // It drops the dimensions provided in tr.WithoutDimensions and keeps others as is. // tr.AggregationMethod is used to specify a method to aggregate the values. // For example, having the following translation rule: // - action: aggregate_metric // metric_name: machine_cpu_cores // aggregation_method: count // without_dimensions: // - cpu // The following translations will be performed: // Original datapoints: // machine_cpu_cores{cpu="cpu1",host="host1"} 0.22 // machine_cpu_cores{cpu="cpu2",host="host1"} 0.11 // machine_cpu_cores{cpu="cpu1",host="host2"} 0.33 // Transformed datapoints: // machine_cpu_cores{host="host1"} 2 // machine_cpu_cores{host="host2"} 1 ActionAggregateMetric Action = "aggregate_metric" // ActionCalculateNewMetric calculates a new metric based on two existing metrics. // It takes two operand metrics, an operator, and a metric name and produces a new metric with the given // metric name, but with the attributes of the first operand metric. // For example, for the following translation rule: // - action: calculate_new_metric // metric_name: memory.utilization // operand1_metric: memory.used // operand2_metric: memory.total // operator: / // the integer value of the 'memory.used' metric will be divided by the integer value of 'memory.total'. The // result will be a new float metric with the name 'memory.utilization' and the value of the quotient. The // new metric will also get any attributes of the 'memory.used' metric except for its value and metric name. // Currently only integer inputs are handled and only division is supported. ActionCalculateNewMetric Action = "calculate_new_metric" // ActionDropMetrics drops datapoints with metric name defined in "metric_names". ActionDropMetrics Action = "drop_metrics" // ActionDeltaMetric creates a new delta (cumulative) metric from an existing non-cumulative int or double // metric. It takes mappings of names of the existing metrics to the names of the new, delta metrics to be // created. All dimensions will be preserved. ActionDeltaMetric Action = "delta_metric" // ActionDropDimensions drops specified dimensions. If no corresponding metric names are provided, the // dimensions are dropped globally from all datapoints. If dimension values are provided, only datapoints // with matching dimension values are dropped. Below are the possible configurations. // - action: drop_dimensions // metric_names: // k8s.pod.phase: true // dimension_pairs: // dim_key1: // dim_key2: // dim_val1: true // dim_val2: true // - action: drop_dimensions // dimension_pairs: // dim_key1: ActionDropDimensions Action = "drop_dimensions" )
type AggregationMethod ¶
type AggregationMethod string
AggregationMethod is the enum used to capture aggregation method
const ( AggregationMethodCount AggregationMethod = "count" AggregationMethodAvg AggregationMethod = "avg" AggregationMethodSum AggregationMethod = "sum" )
Values for enum AggregationMethodCount.
type MetricOperator ¶
type MetricOperator string
const ( // MetricOperatorDivision is the MetricOperator division. MetricOperatorDivision MetricOperator = "/" )
type MetricTranslator ¶
type MetricTranslator struct {
// contains filtered or unexported fields
}
func NewMetricTranslator ¶
func NewMetricTranslator(rules []Rule, ttl int64) (*MetricTranslator, error)
func (*MetricTranslator) TranslateDataPoints ¶
func (mp *MetricTranslator) TranslateDataPoints(logger *zap.Logger, sfxDataPoints []*sfxpb.DataPoint) []*sfxpb.DataPoint
TranslateDataPoints transforms datapoints to a format compatible with signalfx backend sfxDataPoints represents one metric converted to signalfx protobuf datapoints
type MetricValueType ¶
type MetricValueType string
MetricValueType is the enum to capture valid metric value types that can be converted
const ( // MetricValueTypeInt represents integer metric value type MetricValueTypeInt MetricValueType = "int" // MetricValueTypeDouble represents double metric value type MetricValueTypeDouble MetricValueType = "double" )
type MetricsConverter ¶
type MetricsConverter struct {
// contains filtered or unexported fields
}
MetricsConverter converts MetricsData to sfxpb DataPoints. It holds an optional MetricTranslator to translate SFx metrics using translation rules.
func NewMetricsConverter ¶
func NewMetricsConverter( logger *zap.Logger, t *MetricTranslator, excludes []dpfilters.MetricFilter, includes []dpfilters.MetricFilter, nonAlphanumericDimChars string) (*MetricsConverter, error)
NewMetricsConverter creates a MetricsConverter from the passed in logger and MetricTranslator. Pass in a nil MetricTranslator to not use translation rules.
func (*MetricsConverter) ConvertDimension ¶
func (c *MetricsConverter) ConvertDimension(dim string) string
func (*MetricsConverter) MetricsToSignalFxV2 ¶ added in v0.45.0
func (c *MetricsConverter) MetricsToSignalFxV2(md pmetric.Metrics) []*sfxpb.DataPoint
MetricsToSignalFxV2 converts the passed in MetricsData to SFx datapoints, returning those datapoints and the number of time series that had to be dropped because of errors or warnings.
type Rule ¶
type Rule struct { // Action specifies the translation action to be applied on metrics. // This is a required field. Action Action `mapstructure:"action"` // Mapping specifies key/value mapping that is used by rename_dimension_keys, // rename_metrics, copy_metrics, and split_metric actions. Mapping map[string]string `mapstructure:"mapping"` // ScaleFactorsInt is used by multiply_int and divide_int action to scale // integer metric values, key/value format: metric_name/scale_factor ScaleFactorsInt map[string]int64 `mapstructure:"scale_factors_int"` // ScaleFactorsInt is used by multiply_float action to scale // float metric values, key/value format: metric_name/scale_factor ScaleFactorsFloat map[string]float64 `mapstructure:"scale_factors_float"` // MetricName is used by "split_metric" translation rule to specify a name // of a metric that will be split. MetricName string `mapstructure:"metric_name"` // DimensionKey is used by "split_metric" translation rule action to specify dimension key // that will be used to translate the metric datapoints. Datapoints that don't have // the specified dimension key will not be translated. // DimensionKey is also used by "copy_metrics" for filterring. DimensionKey string `mapstructure:"dimension_key"` // DimensionValues is used by "copy_metrics" to filter out datapoints with dimensions values // not matching values set in this field DimensionValues map[string]bool `mapstructure:"dimension_values"` // TypesMapping is represents metric_name/metric_type key/value pairs, // used by ActionConvertValues. TypesMapping map[string]MetricValueType `mapstructure:"types_mapping"` // AggregationMethod specifies method used by "aggregate_metric" translation rule AggregationMethod AggregationMethod `mapstructure:"aggregation_method"` // WithoutDimensions used by "aggregate_metric" translation rule to specify dimensions to be // excluded by aggregation. WithoutDimensions []string `mapstructure:"without_dimensions"` // AddDimensions used by "rename_metrics" translation rule to add dimensions that are necessary for // existing SFx content for desired metric name AddDimensions map[string]string `mapstructure:"add_dimensions"` // CopyDimensions used by "rename_metrics" translation rule to copy dimensions that are necessary for // existing SFx content for desired metric name. This will duplicate the dimension value and isn't a rename. CopyDimensions map[string]string `mapstructure:"copy_dimensions"` // MetricNames is used by "rename_dimension_keys" and "drop_metrics" translation rules. MetricNames map[string]bool `mapstructure:"metric_names"` Operand1Metric string `mapstructure:"operand1_metric"` Operand2Metric string `mapstructure:"operand2_metric"` Operator MetricOperator `mapstructure:"operator"` // DimensionPairs used by "drop_dimensions" translation rule to specify dimension pairs that // should be dropped. DimensionPairs map[string]map[string]bool `mapstructure:"dimension_pairs"` // contains filtered or unexported fields }