Documentation ¶
Index ¶
- func NewClient(opts ...Option) *grpcClient
- type Option
- func WithCompressor(compressor string) Option
- func WithDialOption(opts ...grpc.DialOption) Option
- func WithEndpoint(endpoint string) Option
- func WithGRPCConn(conn *grpc.ClientConn) Option
- func WithHeaders(headers map[string]string) Option
- func WithInsecure() Option
- func WithReconnectionPeriod(rp time.Duration) Option
- func WithRetry(settings RetryConfig) Option
- func WithServiceConfig(serviceConfig string) Option
- func WithTLSCredentials(creds credentials.TransportCredentials) Option
- func WithTimeout(duration time.Duration) Option
- type RetryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option applies an option to the gRPC driver.
func WithCompressor ¶
WithCompressor sets the compressor for the gRPC grpcClient 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"`.
This option has no effect if WithGRPCConn is used.
func WithDialOption ¶
func WithDialOption(opts ...grpc.DialOption) Option
WithDialOption sets explicit grpc.DialOptions to use when making a connection. The options here are appended to the internal grpc.DialOptions used so they will take precedence over any other internal grpc.DialOptions they might conflict with.
This option has no effect if WithGRPCConn is used.
func WithEndpoint ¶
WithEndpoint sets the target endpoint the exporter will connect to. If unset, localhost:4317 will be used as a default.
This option has no effect if WithGRPCConn is used.
func WithGRPCConn ¶
func WithGRPCConn(conn *grpc.ClientConn) Option
WithGRPCConn sets conn as the gRPC ClientConn used for all communication.
This option takes precedence over any other option that relates to establishing or persisting a gRPC connection to a target endpoint. Any other option of those types passed will be ignored.
It is the callers responsibility to close the passed conn. The grpcClient Shutdown method will not close this connection.
func WithHeaders ¶
WithHeaders will send the provided headers with each gRPC requests.
func WithInsecure ¶
func WithInsecure() Option
WithInsecure disables grpcClient 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, grpcClient security is required unless WithInsecure is used.
This option has no effect if WithGRPCConn is used.
func WithReconnectionPeriod ¶
WithReconnectionPeriod set the minimum amount of time between connection attempts to the target endpoint.
This option has no effect if WithGRPCConn is used.
func WithRetry ¶
func WithRetry(settings RetryConfig) Option
WithRetry sets the retry policy for transient retryable errors that may be returned by the target endpoint when exporting a batch of logs.
If the target endpoint responds with not only a retryable error, but explicitly returns a backoff time in the response. That time will take precedence over these settings.
These settings do not define any network retry strategy. That is entirely handled by the gRPC ClientConn.
If unset, the default retry policy will be used. It will retry the export 5 seconds after receiving a retryable error and increase exponentially after each error for no more than a total time of 1 minute.
func WithServiceConfig ¶
WithServiceConfig defines the default gRPC service config used.
This option has no effect if WithGRPCConn is 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.
This option has no effect if WithGRPCConn is used.
func WithTimeout ¶
WithTimeout sets the max amount of time a grpcClient will attempt to export a batch of logs. This takes precedence over any retry settings defined with WithRetry, once this time limit has been reached the export is abandoned and the batch of logs is dropped.
If unset, the default timeout will be set to 10 seconds.
type RetryConfig ¶
RetryConfig defines configuration for retrying export of logs batches that failed to be received by the target endpoint.
This configuration does not define any network retry strategy. That is entirely handled by the gRPC ClientConn.