Documentation ¶
Overview ¶
Package configgrpc defines the configuration settings to create a gRPC client and server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // The target to which the exporter is going to send traces or metrics, // using the gRPC protocol. The valid syntax is described at // https://github.com/grpc/grpc/blob/master/doc/naming.md. Endpoint string `mapstructure:"endpoint"` // The compression key for supported compression types within collector. Compression configcompression.Type `mapstructure:"compression"` // TLSSetting struct exposes TLS client configuration. TLSSetting configtls.ClientConfig `mapstructure:"tls"` // The keepalive parameters for gRPC client. See grpc.WithKeepaliveParams. // (https://godoc.org/google.golang.org/grpc#WithKeepaliveParams). Keepalive *KeepaliveClientConfig `mapstructure:"keepalive"` // ReadBufferSize for gRPC client. See grpc.WithReadBufferSize. // (https://godoc.org/google.golang.org/grpc#WithReadBufferSize). ReadBufferSize int `mapstructure:"read_buffer_size"` // WriteBufferSize for gRPC gRPC. See grpc.WithWriteBufferSize. // (https://godoc.org/google.golang.org/grpc#WithWriteBufferSize). WriteBufferSize int `mapstructure:"write_buffer_size"` // WaitForReady parameter configures client to wait for ready state before sending data. // (https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md) WaitForReady bool `mapstructure:"wait_for_ready"` // The headers associated with gRPC requests. Headers map[string]configopaque.String `mapstructure:"headers"` // Sets the balancer in grpclb_policy to discover the servers. Default is pick_first. // https://github.com/grpc/grpc-go/blob/master/examples/features/load_balancing/README.md BalancerName string `mapstructure:"balancer_name"` // WithAuthority parameter configures client to rewrite ":authority" header // (godoc.org/google.golang.org/grpc#WithAuthority) Authority string `mapstructure:"authority"` // Auth configuration for outgoing RPCs. Auth *configauth.Authentication `mapstructure:"auth"` }
ClientConfig defines common settings for a gRPC client configuration.
func NewDefaultClientConfig ¶
func NewDefaultClientConfig() *ClientConfig
NewDefaultClientConfig returns a new instance of ClientConfig with default values.
func (*ClientConfig) ToClientConn ¶
func (gcs *ClientConfig) ToClientConn(_ context.Context, host component.Host, settings component.TelemetrySettings, extraOpts ...grpc.DialOption) (*grpc.ClientConn, error)
ToClientConn creates a client connection to the given target. By default, it's a non-blocking dial (the function won't wait for connections to be established, and connecting happens in the background). To make it a blocking dial, use grpc.WithBlock() dial option.
type KeepaliveClientConfig ¶
type KeepaliveClientConfig struct { Time time.Duration `mapstructure:"time"` Timeout time.Duration `mapstructure:"timeout"` PermitWithoutStream bool `mapstructure:"permit_without_stream"` }
KeepaliveClientConfig exposes the keepalive.ClientParameters to be used by the exporter. Refer to the original data-structure for the meaning of each parameter: https://godoc.org/google.golang.org/grpc/keepalive#ClientParameters
func NewDefaultKeepaliveClientConfig ¶
func NewDefaultKeepaliveClientConfig() *KeepaliveClientConfig
NewDefaultKeepaliveClientConfig returns a new instance of KeepaliveClientConfig with default values.
type KeepaliveEnforcementPolicy ¶
type KeepaliveEnforcementPolicy struct { MinTime time.Duration `mapstructure:"min_time"` PermitWithoutStream bool `mapstructure:"permit_without_stream"` }
KeepaliveEnforcementPolicy allow configuration of the keepalive.EnforcementPolicy. The same default values as keepalive.EnforcementPolicy are applicable and get applied by the server. See https://godoc.org/google.golang.org/grpc/keepalive#EnforcementPolicy for details.
func NewDefaultKeepaliveEnforcementPolicy ¶
func NewDefaultKeepaliveEnforcementPolicy() *KeepaliveEnforcementPolicy
NewDefaultKeepaliveEnforcementPolicy creates and returns a new instance of KeepaliveEnforcementPolicy with default settings.
type KeepaliveServerConfig ¶
type KeepaliveServerConfig struct { ServerParameters *KeepaliveServerParameters `mapstructure:"server_parameters"` EnforcementPolicy *KeepaliveEnforcementPolicy `mapstructure:"enforcement_policy"` }
KeepaliveServerConfig is the configuration for keepalive.
func NewDefaultKeepaliveServerConfig ¶
func NewDefaultKeepaliveServerConfig() *KeepaliveServerConfig
NewDefaultKeepaliveServerConfig returns a new instance of KeepaliveServerConfig with default values.
type KeepaliveServerParameters ¶
type KeepaliveServerParameters struct { MaxConnectionIdle time.Duration `mapstructure:"max_connection_idle"` MaxConnectionAge time.Duration `mapstructure:"max_connection_age"` MaxConnectionAgeGrace time.Duration `mapstructure:"max_connection_age_grace"` Time time.Duration `mapstructure:"time"` Timeout time.Duration `mapstructure:"timeout"` }
KeepaliveServerParameters allow configuration of the keepalive.ServerParameters. The same default values as keepalive.ServerParameters are applicable and get applied by the server. See https://godoc.org/google.golang.org/grpc/keepalive#ServerParameters for details.
func NewDefaultKeepaliveServerParameters ¶
func NewDefaultKeepaliveServerParameters() *KeepaliveServerParameters
NewDefaultKeepaliveServerParameters creates and returns a new instance of KeepaliveServerParameters with default settings.
type ServerConfig ¶
type ServerConfig struct { // Server net.Addr config. For transport only "tcp" and "unix" are valid options. NetAddr confignet.AddrConfig `mapstructure:",squash"` // Configures the protocol to use TLS. // The default value is nil, which will cause the protocol to not use TLS. TLSSetting *configtls.ServerConfig `mapstructure:"tls"` // MaxRecvMsgSizeMiB sets the maximum size (in MiB) of messages accepted by the server. MaxRecvMsgSizeMiB uint64 `mapstructure:"max_recv_msg_size_mib"` // MaxConcurrentStreams sets the limit on the number of concurrent streams to each ServerTransport. // It has effect only for streaming RPCs. MaxConcurrentStreams uint32 `mapstructure:"max_concurrent_streams"` // ReadBufferSize for gRPC server. See grpc.ReadBufferSize. // (https://godoc.org/google.golang.org/grpc#ReadBufferSize). ReadBufferSize int `mapstructure:"read_buffer_size"` // WriteBufferSize for gRPC server. See grpc.WriteBufferSize. // (https://godoc.org/google.golang.org/grpc#WriteBufferSize). WriteBufferSize int `mapstructure:"write_buffer_size"` // Keepalive anchor for all the settings related to keepalive. Keepalive *KeepaliveServerConfig `mapstructure:"keepalive"` // Auth for this receiver Auth *configauth.Authentication `mapstructure:"auth"` // Include propagates the incoming connection's metadata to downstream consumers. // Experimental: *NOTE* this option is subject to change or removal in the future. IncludeMetadata bool `mapstructure:"include_metadata"` }
ServerConfig defines common settings for a gRPC server configuration.
func NewDefaultServerConfig ¶
func NewDefaultServerConfig() *ServerConfig
NewDefaultServerConfig returns a new instance of ServerConfig with default values.
func (*ServerConfig) ToServer ¶
func (gss *ServerConfig) ToServer(_ context.Context, host component.Host, settings component.TelemetrySettings, extraOpts ...grpc.ServerOption) (*grpc.Server, error)
ToServer returns a grpc.Server for the configuration