Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultTranslationRulesYaml defines default translation rules that will be applied to metrics if // config.SendCompatibleMetrics set to true and 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 = `` /* 3214-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func MetricDataToSignalFxV2 ¶
func MetricDataToSignalFxV2( logger *zap.Logger, metricTranslator *MetricTranslator, md consumerdata.MetricsData, ) (sfxDataPoints []*sfxpb.DataPoint, numDroppedTimeSeries int)
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. 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 dividing their values using // Rule.ScaleFactorsFloat key/values as metric_name/multiplying_factor ActionMultiplyFloat Action = "multiply_float" // ActionConvertValues converts float metrics values to integer values using // 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 by dimensions provided in tr.Dimensions. // It takes datapoints with name tr.MetricName and aggregates them to a smaller set keeping the same name. // It drops all other dimensions other then those that match tr.Dimensions. // If a datapoint doesn't have a dimension matchin tr.Dimensions, the datapoint will be dropped. // 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 // dimensions: // - host // 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" )
type AggregationMethod ¶
type AggregationMethod string
AggregationMethod is the enum used to capture aggregation method
const ( // AggregationMethodCount represents count aggregation method AggregationMethodCount AggregationMethod = "count" AggregationMethodSum AggregationMethod = "sum" )
type MetricTranslator ¶
type MetricTranslator struct {
// contains filtered or unexported fields
}
func NewMetricTranslator ¶
func NewMetricTranslator(rules []Rule) (*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
func (*MetricTranslator) TranslateDimension ¶
func (mp *MetricTranslator) TranslateDimension(orig string) string
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 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"` // Dimensions is used by "aggregate_metric" translation rule to specify dimension keys // that will be used to aggregate the metric across. // Datapoints that don't have all the dimensions will be dropped. Dimensions []string `mapstructure:"dimensions"` }
Click to show internal directories.
Click to hide internal directories.