otlplogshttp

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func NewClient

func NewClient(opts ...Option) *httpClient

NewClient creates a new HTTP logs httpClient.

Types

type Compression

type Compression otlpconfig.Compression

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

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option applies an option to the HTTP httpClient.

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 logs. If unset, it will instead try to use the default endpoint (localhost:4318). 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 WithJsonProtocol

func WithJsonProtocol() Option

WithJsonProtocol will apply http/json protocol to Http client

func WithProtobufProtocol

func WithProtobufProtocol() Option

WithProtobufProtocol will apply http/protobuf protocol to Http client

func WithRetry

func WithRetry(rc RetryConfig) Option

WithRetry configures the retry policy for transient errors that may occurs when exporting logs. An exponential back-off algorithm is used to ensure endpoints are not overwhelmed with retries. If unset, the default retry policy will retry after 5 seconds and increase exponentially after each error for a total of 1 minute.

func WithTLSClientConfig

func WithTLSClientConfig(tlsCfg *tls.Config) Option

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

func WithTimeout

func WithTimeout(duration time.Duration) Option

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

func WithURLPath

func WithURLPath(urlPath string) Option

WithURLPath allows one to override the default URL path used for sending logs. If unset, default ("/v1/logs") will be used.

type RetryConfig

type RetryConfig retry.Config

RetryConfig defines configuration for retrying batches in case of export failure using an exponential backoff.

Jump to

Keyboard shortcuts

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