accumulator

package
v1.3000030.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddScopeMetricsIntoOtelMetrics

func AddScopeMetricsIntoOtelMetrics(populateDataPoints dataPointPopulator, otelMetrics pmetric.Metrics, measurement string, fields map[string]interface{}, tags map[string]string, t time.Time)

AddDataPointsIntoMetrics will use Telegraf's field (which holds subset metrics from the main metrics) and convert to OTEL's datapoint Example:

	Metric {                                                  -->  Metrics {
	   Name: cpu                         				      -->    ResourceMetrics: [{
	   TagList: [{key: mytag, value: myvalue}]			      -->       Resource: {
	   FieldList: [										      -->         Attributes: [{key: mytag, value: myvalue}]
	       {key: cpu_usage_user, value: 0.005},               -->       }
	   ]                                                      -->       ScopeMetrics: [{
	   Time: 1646946605										  -->         Metrics: [
	   Type: Gauge                                            -->           {Name: cpu_usage_user
	                                                          -->            DataType: Gauge
	}														  -->            DataPoints: [{
                       									      -->              Attributes: [{key: mytag, value: myvalue}]
                       									      -->              Timestamp: 1646946605
                       									      --> 			   Type: Double
                        									  -->              Val: 0.005
                   											  -->            }]
                   											  -->         }]
                   											  -->       }]
                   											  -->    }]
                   											  --> }

func ConvertTelegrafToOtelMetrics

func ConvertTelegrafToOtelMetrics(measurement string, fields map[string]interface{}, tags map[string]string, tp telegraf.ValueType, t time.Time) (pmetric.Metrics, error)

Types

type OtelAccumulator

type OtelAccumulator interface {
	// Accumulator Interface https://github.com/influxdata/telegraf/blob/381dc2272390cd9de1ce2b047a953f8337b55647/accumulator.go
	telegraf.Accumulator

	// GetOtelMetrics return the final OTEL metric that were gathered by scrape controller for each plugin
	GetOtelMetrics() pmetric.Metrics
}

OtelAccumulator implements the telegraf.Accumulator interface, but works as an OTel plugin by passing the metrics onward to the next consumer

func NewAccumulator

func NewAccumulator(input *models.RunningInput, ctx context.Context, consumer consumer.Metrics, logger *zap.Logger) OtelAccumulator

type TestRunningInput

type TestRunningInput struct{}

func (*TestRunningInput) Description

func (t *TestRunningInput) Description() string

func (*TestRunningInput) Gather

func (*TestRunningInput) SampleConfig

func (t *TestRunningInput) SampleConfig() string

type TestServiceRunningInput

type TestServiceRunningInput struct{}

func (*TestServiceRunningInput) Description

func (t *TestServiceRunningInput) Description() string

func (*TestServiceRunningInput) Gather

func (*TestServiceRunningInput) SampleConfig

func (t *TestServiceRunningInput) SampleConfig() string

func (*TestServiceRunningInput) Start

func (*TestServiceRunningInput) Stop

func (t *TestServiceRunningInput) Stop()

Jump to

Keyboard shortcuts

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