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
- func NewDriver(opts ...Option) otlp.ProtocolDriver
- type Option
- func WithBackoff(duration time.Duration) Option
- func WithCompression(compression otlp.Compression) Option
- func WithEndpoint(endpoint string) Option
- func WithHeaders(headers map[string]string) Option
- func WithInsecure() Option
- func WithInsecureMetrics() Option
- func WithInsecureTraces() Option
- func WithMarshal(m otlp.Marshaler) Option
- func WithMaxAttempts(maxAttempts int) Option
- func WithMetricsCompression(compression otlp.Compression) Option
- func WithMetricsEndpoint(endpoint string) Option
- func WithMetricsHeaders(headers map[string]string) Option
- func WithMetricsTLSClientConfig(tlsCfg *tls.Config) Option
- func WithMetricsTimeout(duration time.Duration) Option
- func WithMetricsURLPath(urlPath string) Option
- func WithTLSClientConfig(tlsCfg *tls.Config) Option
- func WithTimeout(duration time.Duration) Option
- func WithTracesCompression(compression otlp.Compression) Option
- func WithTracesEndpoint(endpoint string) Option
- func WithTracesHeaders(headers map[string]string) Option
- func WithTracesTLSClientConfig(tlsCfg *tls.Config) Option
- func WithTracesTimeout(duration time.Duration) 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 // 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 ¶
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 ¶
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 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
WithMarshal tells the driver which wire format to use when sending to the collector. If unset, MarshalProto will be used
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 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
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
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
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
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 ¶
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 WithTimeout ¶ added in v0.20.0
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
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
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
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
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 ¶
WithTracesURLPath allows one to override the default URL path used for sending traces. If unset, DefaultTracesPath will be used.