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
- func NewDriver(opts ...Option) otlp.ProtocolDriver
- type Compression
- type Option
- func WithBackoff(duration time.Duration) Option
- func WithCompression(compression Compression) Option
- func WithEndpoint(endpoint string) Option
- func WithHeaders(headers map[string]string) Option
- func WithInsecure() Option
- func WithMaxAttempts(maxAttempts int) Option
- func WithMetricsURLPath(urlPath string) Option
- func WithTLSClientConfig(tlsCfg *tls.Config) Option
- func WithTracesURLPath(urlPath string) Option
Constants ¶
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) // contains filtered or unexported methods }
Option applies an option to the HTTP driver.
func WithBackoff ¶
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 ¶
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 ¶
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 ¶
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 ¶
WithMetricsURLPath allows one to override the default URL path used for sending metrics. If unset, DefaultMetricsPath will be used.
func WithTLSClientConfig ¶
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 ¶
WithTracesURLPath allows one to override the default URL path used for sending traces. If unset, DefaultTracesPath will be used.