otlp

package
v0.0.0-...-b0852c1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConversionAsGauge     = "AsGauge"
	ConversionAsHistogram = "AsHistogram"
)
View Source
const (
	BackendName = `otlp`
)

Variables

This section is empty.

Functions

func NewClientFromViper

func NewClientFromViper(v *viper.Viper, logger logrus.FieldLogger, pool *transport.TransportPool) (gostatsd.Backend, error)

Types

type Backend

type Backend struct {
	CompressPayload bool
	// contains filtered or unexported fields
}

Backend contains additional meta data in order to export values as OTLP metrics. The zero value is not safe to use.

func (*Backend) Name

func (*Backend) Name() string

func (*Backend) SendEvent

func (b *Backend) SendEvent(ctx context.Context, event *gostatsd.Event) error

func (*Backend) SendMetricsAsync

func (bd *Backend) SendMetricsAsync(ctx context.Context, mm *gostatsd.MetricMap, cb gostatsd.SendCallback)

type Config

type Config struct {
	gostatsd.TimerSubtypes `mapstructure:"disabled_timer_aggregations"`
	// MetricsEndpoint (Required) is the FQDN with path for the metrics ingestion endpoint
	MetricsEndpoint string `mapstructure:"metrics_endpoint"`
	// LogsEndpoint (Required) is the FQDN with path for the logs ingestion endpoint
	LogsEndpoint string `mapstructure:"logs_endpoint"`
	// MaxRequests (Optional, default: cpu.count * 2) is the upper limit on the number of inflight requests
	MaxRequests int `mapstructure:"max_requests"`
	// MaxRetries (Optional, default: 3) is the maximum number of retries to send a batch
	MaxRetries int `mapstructure:"max_retries"`
	// CompressPayload (Optional, default: true) is used to enable payload compression
	CompressPayload bool `mapstructure:"compress_payload"`
	// MetricsPerBatch (Optional, default: 1000) is the maximum number of metrics to send in a single batch.
	MetricsPerBatch int `mapstructure:"metrics_per_batch"`
	// ResourceKeys (Optional) is used to extract values from provided tags
	// to apply to all values within a resource instead within each attribute.
	// Strongly encouraged to allow down stream consumers to
	// process based on values defined at the top level resource.
	ResourceKeys []string `mapstructure:"resource_keys"`
	// Conversion (Optional, Default: AsGauge) controls if timers and histograms are captured as histograms or gauges.
	// The options will enable the following:
	// - AsGauge     : This will emit timers withe their calculated suffixes
	//                  and histograms as gauges with the suffix `histogram`
	// - AsHistogram : This will emit timers as histograms with no buckets defined,
	//                  and histograms sets the bucket values.
	Conversion string `mapstructure:"conversion"`
	// Transport (Optional, Default: "default") is used to reference to configured transport
	// to be used for this backend
	Transport string `mapstructure:"transport"`
	// UserAgent (Optional, default: "gostatsd") allows you to set the
	// user agent header when making requests.
	UserAgent string `mapstructure:"user_agent"`
	// EventTitleAttributeKey (Optional, default: "title")
	// OTLP backend sends event in log format, this is the key used to store the title from the event in the log attributes
	EventTitleAttributeKey string `mapstructure:"event_title_attribute_key"`
	// EventPropertiesAttributeKey (Optional, default: "properties")
	// OTLP backend sends event in log format, this is the key used to store the properties from the event in the log attributes
	EventPropertiesAttributeKey string `mapstructure:"event_properties_attribute_key"`
}

func NewConfig

func NewConfig(v *viper.Viper) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() (errs error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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