Documentation ¶
Index ¶
- func WithLookup(lookup func(string) ([]net.IP, error)) func(*IPBalancer)
- func WithRetryWait(d time.Duration) func(*ClientManager)
- type Balancer
- type ClientManager
- type ClientManagerOpts
- type ClientPool
- type ConnectionBuilder
- type Connector
- type IPBalancer
- type IPBalancerOption
- type LogClient
- type LogsProviderClient
- type MetricClient
- type Subscriber
- type SubscriberOption
- type SyslogConnector
- type ValidClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithLookup ¶
func WithLookup(lookup func(string) ([]net.IP, error)) func(*IPBalancer)
WithLookup sets the behavior of looking up IPs
func WithRetryWait ¶
func WithRetryWait(d time.Duration) func(*ClientManager)
Types ¶
type Balancer ¶
Balancer cycles through a collection of host ports. It will return an error when there is no host port available.
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
ClientManager manages loggregator egress clients and connections.
func NewClientManager ¶
func NewClientManager( connector ConnectionBuilder, connCount int, ttl time.Duration, check time.Duration, opts ...ClientManagerOpts, ) *ClientManager
NewClientManager returns a ClientManager after opening the specified number of connections.
func (*ClientManager) Next ¶
func (c *ClientManager) Next() LogsProviderClient
Next returns the next available loggregator egress client. Next will block until a healthy client is available.
type ClientManagerOpts ¶
type ClientManagerOpts func(*ClientManager)
type ClientPool ¶
type ClientPool interface {
Next() LogsProviderClient
}
type ConnectionBuilder ¶
type ConnectionBuilder interface {
Connect() (io.Closer, LogsProviderClient, error)
}
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector connects to loggregator egress API
func NewConnector ¶
NewConnector returns a new Connector
type IPBalancer ¶
type IPBalancer struct {
// contains filtered or unexported fields
}
IPBalancer provides IPs resolved from a DNS address in random order
func NewIPBalancer ¶
func NewIPBalancer(addr string, opts ...IPBalancerOption) *IPBalancer
NewIPBalancer returns an IPBalancer
func (*IPBalancer) NextHostPort ¶
func (b *IPBalancer) NextHostPort() (string, error)
NextHostPort returns hostport resolved from the balancer's addr. It returns error for an invalid addr or if lookup failed or doesn't resolve to anything.
type IPBalancerOption ¶
type IPBalancerOption func(*IPBalancer)
IPBalancerOption is a type that will manipulate a config
type LogClient ¶
type LogClient interface {
EmitLog(message string, opts ...loggregator.EmitLogOption)
}
LogClient is used to emit logs.
type LogsProviderClient ¶
type LogsProviderClient interface { BatchedReceiver( ctx context.Context, in *loggregator_v2.EgressBatchRequest, opts ...grpc.CallOption, ) (loggregator_v2.Egress_BatchedReceiverClient, error) Valid() bool Invalidate() }
LogsProviderClient describes the gRPC interface for communicating with Loggregator.
type MetricClient ¶
type MetricClient interface {
NewCounterMetric(string, ...pulseemitter.MetricOption) pulseemitter.CounterMetric
}
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber streams loggregator egress to the syslog drain.
func NewSubscriber ¶
func NewSubscriber( ctx context.Context, p ClientPool, c SyslogConnector, e MetricClient, opts ...SubscriberOption, ) *Subscriber
NewSubscriber returns a new Subscriber.
func (*Subscriber) Start ¶
func (s *Subscriber) Start(binding *v1.Binding) func()
Start begins to stream logs from a loggregator egress client to the syslog egress writer. Start does not block. Start returns a function that can be called to stop streaming logs.
type SubscriberOption ¶
type SubscriberOption func(s *Subscriber)
func WithLogClient ¶
func WithLogClient(logClient LogClient, sourceIndex string) SubscriberOption
WithLogClient returns a SubscriberOption that will set up logging for any information about a binding.
func WithMetricsToSyslogEnabled ¶
func WithMetricsToSyslogEnabled(enabled bool) SubscriberOption
WithEnableMetricsToSyslog returns a SubscriberOption to override the default setting for writing metrics to syslog. By default this feature is disabled.
func WithStreamOpenTimeout ¶
func WithStreamOpenTimeout(d time.Duration) SubscriberOption
type SyslogConnector ¶
type ValidClient ¶
type ValidClient struct {
// contains filtered or unexported fields
}
func (*ValidClient) BatchedReceiver ¶
func (v *ValidClient) BatchedReceiver( ctx context.Context, in *loggregator_v2.EgressBatchRequest, opts ...grpc.CallOption, ) (loggregator_v2.Egress_BatchedReceiverClient, error)
func (*ValidClient) Invalidate ¶
func (v *ValidClient) Invalidate()
func (*ValidClient) Valid ¶
func (v *ValidClient) Valid() bool