Documentation ¶
Index ¶
- Constants
- func NewClient(opts ...Option) *httpClient
- type Compression
- type Option
- func WithCompression(compression Compression) Option
- func WithEndpoint(endpoint string) Option
- func WithHeaders(headers map[string]string) Option
- func WithInsecure() Option
- func WithJsonProtocol() Option
- func WithProtobufProtocol() Option
- func WithRetry(rc RetryConfig) Option
- func WithTLSClientConfig(tlsCfg *tls.Config) Option
- func WithTimeout(duration time.Duration) Option
- func WithURLPath(urlPath string) Option
- type RetryConfig
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
WithURLPath allows one to override the default URL path used for sending logs. If unset, default ("/v1/logs") will be used.
type RetryConfig ¶
RetryConfig defines configuration for retrying batches in case of export failure using an exponential backoff.