app

package
v0.0.0-...-57f4fd1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter receives bindings from the scheduler, connects to the RLP for log data, and streams it out to a syslog endpoint.

func NewAdapter

func NewAdapter(
	logsEgressAPIAddr string,
	logsEgressAPIAddrWithAZ string,
	logsEgressAPITLSConfig *tls.Config,
	adapterServerTLSConfig *tls.Config,
	metricClient MetricClient,
	logClient LogClient,
	sourceIndex string,
	opts ...AdapterOption,
) *Adapter

NewAdapter returns an Adapter

func (*Adapter) HealthAddr

func (a *Adapter) HealthAddr() string

func (*Adapter) ServerAddr

func (a *Adapter) ServerAddr() string

func (*Adapter) Start

func (a *Adapter) Start() error

Start starts the adapter health endpoint and gRPC service.

func (*Adapter) Stop

func (a *Adapter) Stop()

type AdapterOption

type AdapterOption func(*Adapter)

AdapterOption is a type that will manipulate a config

func WithAdapterServerAddr

func WithAdapterServerAddr(addr string) AdapterOption

WithAdapterServerAddr sets the address for the gRPC server to bind to.

func WithHealthAddr

func WithHealthAddr(addr string) AdapterOption

WithHealthAddr sets the address for the health endpoint to bind to.

func WithLogsEgressAPIConnCount

func WithLogsEgressAPIConnCount(m int) AdapterOption

WithLogsEgressAPIConnCount sets the maximum number of connections to the Loggregator API

func WithLogsEgressAPIConnTTL

func WithLogsEgressAPIConnTTL(d int) AdapterOption

WithLogsEgressAPIConnTTL sets the number of seconds for a connection to the Loggregator API to live

func WithMaxBindings

func WithMaxBindings(i int) AdapterOption

WithMaxBindings sets the maximum bindings allowed per adapter.

func WithMetricsToSyslogEnabled

func WithMetricsToSyslogEnabled(enabled bool) AdapterOption

WithEnableMetricsToSyslog returns a AdapterOption to override the default setting for writing metrics to syslog. By default this feature is disabled.

func WithSyslogDialTimeout

func WithSyslogDialTimeout(d time.Duration) AdapterOption

WithSyslogDialTimeout sets the TCP dial timeout for connecting to a syslog drain

func WithSyslogIOTimeout

func WithSyslogIOTimeout(d time.Duration) AdapterOption

WithSyslogIOTimeout sets the TCP IO timeout for writing to a syslog drain

func WithSyslogKeepalive

func WithSyslogKeepalive(d time.Duration) AdapterOption

WithSyslogKeepalive configures the keepalive interval for HTTPS, TCP, and TLS syslog drains.

func WithSyslogSkipCertVerify

func WithSyslogSkipCertVerify(b bool) AdapterOption

WithSyslogSkipCertVerify sets the TCP InsecureSkipVerify property for syslog

type Config

type Config struct {
	SourceIndex            string        `env:"ADAPTER_INSTANCE_INDEX,  required"`
	CAFile                 string        `env:"CA_FILE_PATH,            required"`
	CertFile               string        `env:"CERT_FILE_PATH,          required"`
	KeyFile                string        `env:"KEY_FILE_PATH,           required"`
	CommonName             string        `env:"TLS_COMMON_NAME,         required"`
	RLPCAFile              string        `env:"LOGS_API_CA_FILE,        required"`
	RLPCertFile            string        `env:"LOGS_API_CERT_FILE_PATH, required"`
	RLPKeyFile             string        `env:"LOGS_API_KEY_FILE_PATH,  required"`
	RLPCommonName          string        `env:"LOGS_API_COMMON_NAME,    required"`
	LogsAPIAddr            string        `env:"LOGS_API_ADDR,           required"`
	LogsAPIAddrWithAZ      string        `env:"LOGS_API_ADDR_WITH_AZ,   required"`
	HealthHostport         string        `env:"HEALTH_HOSTPORT"`
	AdapterHostport        string        `env:"HOSTPORT"`
	PprofHostport          string        `env:"PPROF_HOSTPORT"`
	SyslogKeepalive        time.Duration `env:"SYSLOG_KEEPALIVE"`
	SyslogDialTimeout      time.Duration `env:"SYSLOG_DIAL_TIMEOUT"`
	SyslogIOTimeout        time.Duration `env:"SYSLOG_IO_TIMEOUT"`
	SyslogSkipCertVerify   bool          `env:"SYSLOG_SKIP_CERT_VERIFY"`
	MetricsToSyslogEnabled bool          `env:"METRICS_TO_SYSLOG_ENABLED"`
	MaxBindings            int           `env:"MAX_BINDINGS"`

	MetricIngressAddr     string        `env:"METRIC_INGRESS_ADDR,     required"`
	MetricIngressCN       string        `env:"METRIC_INGRESS_CN,       required"`
	MetricEmitterInterval time.Duration `env:"METRIC_EMITTER_INTERVAL"`
}

Config stores configuration settings for the adapter.

func LoadConfig

func LoadConfig() *Config

LoadConfig will load and validate the config from the current environment. If validation fails LoadConfig will log the error and exit the process with status code 1.

type LogClient

type LogClient interface {
	EmitLog(message string, opts ...loggregator.EmitLogOption)
}

LogClient is used to emit logs.

type MetricClient

type MetricClient interface {
	NewCounterMetric(string, ...pulseemitter.MetricOption) pulseemitter.CounterMetric
	NewGaugeMetric(string, string, ...pulseemitter.MetricOption) pulseemitter.GaugeMetric
}

MetricClient is used to emit metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL