otlploggrpc

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, res *resource.Resource, opt ...Option) (*otlplog.Exporter, error)

New exporter

func NewClient

func NewClient(opts ...Option) otlplog.Client

NewClient creates a new gRPC trace client.

Types

type Option

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

Option applies an option to the gRPC driver.

func WithCompressor

func WithCompressor(compressor string) Option

WithCompressor will set the compressor for the gRPC client to use when sending requests. It is the responsibility of the caller to ensure that the compressor set has been registered with google.golang.org/grpc/encoding. This can be done by encoding.RegisterCompressor. Some compressors auto-register on import, such as gzip, which can be registered by calling `import _ "google.golang.org/grpc/encoding/gzip"`.

func WithDialOption

func WithDialOption(opts ...grpc.DialOption) Option

WithDialOption opens support to any grpc.DialOption to be used. If it conflicts with some other configuration the GRPC specified via the collector the ones here will take preference since they are set last.

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint allows one to set the endpoint that the exporter will connect to the collector on. If unset, it will instead try to use connect to DefaultCollectorHost:DefaultCollectorPort.

func WithGRPCConn

func WithGRPCConn(conn *grpc.ClientConn) Option

WithGRPCConn allows reusing existing gRPC connection when it has already been established for other services. When set, other dial options will be ignored.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders will send the provided headers with gRPC requests.

func WithInsecure

func WithInsecure() Option

WithInsecure disables client transport security for the exporter's gRPC connection just like grpc.WithInsecure() https://pkg.go.dev/google.golang.org/grpc#WithInsecure does. Note, by default, client security is required unless WithInsecure is used.

func WithReconnectionPeriod

func WithReconnectionPeriod(rp time.Duration) Option

WithReconnectionPeriod allows one to set the delay between next connection attempt after failing to connect with the collector.

func WithRetry

func WithRetry(settings RetryConfig) Option

WithRetry configures the retry policy for transient errors that may occurs when exporting traces. 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 WithServiceConfig

func WithServiceConfig(serviceConfig string) Option

WithServiceConfig defines the default gRPC service config used.

func WithTLSCredentials

func WithTLSCredentials(creds credentials.TransportCredentials) Option

WithTLSCredentials allows the connection to use TLS credentials when talking to the server. It takes in grpc.TransportCredentials instead of say a Certificate file or a tls.Certificate, because the retrieving of these credentials can be done in many ways e.g. plain file, in code tls.Config or by certificate rotation, so it is up to the caller to decide what to use.

func WithTimeout

func WithTimeout(duration time.Duration) Option

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

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