otlphttp

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 23 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.

Deprecated: This package was moved to exporters/otlp/otlptrace/otlphttp and exporters/otlp/otlpmetric/otlphttp.

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
	// DefaultTimeout is a default max waiting time for the backend to process
	// each span or metrics batch.
	DefaultTimeout time.Duration = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewDriver

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

NewDriver creates a new HTTP driver.

Types

type Option

type Option interface {
	otlpconfig.HTTPOption
}

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 otlp.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 WithInsecureMetrics added in v0.20.0

func WithInsecureMetrics() Option

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

func WithInsecureTraces added in v0.20.0

func WithInsecureTraces() Option

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

func WithMarshal added in v0.19.0

func WithMarshal(m otlp.Marshaler) Option

WithMarshal tells the driver which wire format to use when sending to the collector. If unset, MarshalProto will be used

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 WithMetricsCompression added in v0.20.0

func WithMetricsCompression(compression otlp.Compression) Option

WithMetricsCompression tells the driver to compress the sent metrics data.

func WithMetricsEndpoint added in v0.20.0

func WithMetricsEndpoint(endpoint string) Option

WithMetricsEndpoint allows one to set the address of the collector endpoint that the driver will use to send metrics. If unset, it will instead try to use the Endpoint configuration. Note that the endpoint must not contain any URL path.

func WithMetricsHeaders added in v0.20.0

func WithMetricsHeaders(headers map[string]string) Option

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

func WithMetricsTLSClientConfig added in v0.20.0

func WithMetricsTLSClientConfig(tlsCfg *tls.Config) Option

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

func WithMetricsTimeout added in v0.20.0

func WithMetricsTimeout(duration time.Duration) Option

WithMetricsTimeout tells the driver the max waiting time for the backend to process each metrics batch. If unset, the default will be 10 seconds.

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 WithTimeout added in v0.20.0

func WithTimeout(duration time.Duration) Option

WithTimeout tells the driver the max waiting time for the backend to process each spans or metrics batch. If unset, the default will be 10 seconds.

func WithTracesCompression added in v0.20.0

func WithTracesCompression(compression otlp.Compression) Option

WithTracesCompression tells the driver to compress the sent traces data.

func WithTracesEndpoint added in v0.20.0

func WithTracesEndpoint(endpoint string) Option

WithTracesEndpoint allows one to set the address of the collector endpoint that the driver will use to send spans. If unset, it will instead try to use the Endpoint configuration. Note that the endpoint must not contain any URL path.

func WithTracesHeaders added in v0.20.0

func WithTracesHeaders(headers map[string]string) Option

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

func WithTracesTLSClientConfig added in v0.20.0

func WithTracesTLSClientConfig(tlsCfg *tls.Config) Option

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

func WithTracesTimeout added in v0.20.0

func WithTracesTimeout(duration time.Duration) Option

WithTracesTimeout tells the driver the max waiting time for the backend to process each spans batch. If unset, the default will be 10 seconds.

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