otlphttp

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

Package otlphttp implements a protocol driver that sends traces and metrics to the collector using HTTP with binary protobuf payloads.

This package is currently in a pre-GA phase. Backwards incompatible changes may be introduced in subsequent minor version releases as we work to track the evolving OpenTelemetry specification and user feedback.

Index

Constants

View Source
const (
	// DefaultMaxAttempts describes how many times the driver
	// should retry the sending of the payload in case of a
	// retryable error.
	DefaultMaxAttempts int = 5
	// DefaultTracesPath is a default URL path for endpoint that
	// receives spans.
	DefaultTracesPath string = "/v1/traces"
	// DefaultMetricsPath is a default URL path for endpoint that
	// receives metrics.
	DefaultMetricsPath string = "/v1/metrics"
	// DefaultBackoff is a default base backoff time used in the
	// exponential backoff strategy.
	DefaultBackoff time.Duration = 300 * time.Millisecond
)

Variables

This section is empty.

Functions

func NewDriver

func NewDriver(opts ...Option) otlp.ProtocolDriver

NewDriver creates a new HTTP driver.

Types

type Compression

type Compression int

Compression describes the compression used for payloads sent to the collector.

const (
	// NoCompression tells the driver to send payloads without
	// compression.
	NoCompression Compression = iota
	// GzipCompression tells the driver to send payloads after
	// compressing them with gzip.
	GzipCompression
)

type Option

type Option interface {
	Apply(*config)
}

Option applies an option to the HTTP driver.

func WithBackoff

func WithBackoff(duration time.Duration) Option

WithBackoff tells the driver to use the duration as a base of the exponential backoff strategy. If unset, DefaultBackoff will be used.

func WithCompression

func WithCompression(compression Compression) Option

WithCompression tells the driver to compress the sent data.

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint allows one to set the address of the collector endpoint that the driver will use to send metrics and spans. If unset, it will instead try to use DefaultCollectorHost:DefaultCollectorPort. Note that the endpoint must not contain any URL path.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders allows one to tell the driver to send additional HTTP headers with the payloads. Specifying headers like Content-Length, Content-Encoding and Content-Type may result in a broken driver.

func WithInsecure

func WithInsecure() Option

WithInsecure tells the driver to connect to the collector using the HTTP scheme, instead of HTTPS.

func WithMaxAttempts

func WithMaxAttempts(maxAttempts int) Option

WithMaxAttempts allows one to override how many times the driver will try to send the payload in case of retryable errors. If unset, DefaultMaxAttempts will be used.

func WithMetricsURLPath

func WithMetricsURLPath(urlPath string) Option

WithMetricsURLPath allows one to override the default URL path used for sending metrics. If unset, DefaultMetricsPath will be used.

func WithTLSClientConfig

func WithTLSClientConfig(tlsCfg *tls.Config) Option

WithTLSClientConfig can be used to set up a custom TLS configuration for the client used to send payloads to the collector. Use it if you want to use a custom certificate.

func WithTracesURLPath

func WithTracesURLPath(urlPath string) Option

WithTracesURLPath allows one to override the default URL path used for sending traces. If unset, DefaultTracesPath will be used.

Jump to

Keyboard shortcuts

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