app

package
v0.0.0-...-3ce1eab Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addrs

type Addrs struct {
	GRPC   string
	Health string
}

Addrs stores listener addresses of the router process.

type Agent

type Agent struct {
	GRPCAddress string `env:"AGENT_GRPC_ADDRESS"`
}

Agent stores the configuration for connecting to the Agent over gRPC.

type Config

type Config struct {
	GRPC GRPC

	// persistence
	MaxRetainedLogMessages       uint32 `env:"ROUTER_MAX_RETAINED_LOG_MESSAGES"`
	SinkInactivityTimeoutSeconds int    `env:"ROUTER_SINK_INACTIVITY_TIMEOUT_SECONDS"`

	// health
	PProfPort                       uint32 `env:"ROUTER_PPROF_PORT"`
	HealthAddr                      string `env:"ROUTER_HEALTH_ADDR"`
	Agent                           Agent
	MetricBatchIntervalMilliseconds uint   `env:"ROUTER_METRIC_BATCH_INTERVAL_MILLISECONDS"`
	MetricSourceID                  string `env:"ROUTER_METRIC_SOURCE_ID"`
}

Config stores all configurations options for the Router.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads from the environment to create a Config.

type GRPC

type GRPC struct {
	Port         uint16   `env:"ROUTER_PORT"`
	CertFile     string   `env:"ROUTER_CERT_FILE"`
	KeyFile      string   `env:"ROUTER_KEY_FILE"`
	CAFile       string   `env:"ROUTER_CA_FILE"`
	CipherSuites []string `env:"ROUTER_CIPHER_SUITES"`
}

GRPC stores the configuration for the router as a server using a PORT with mTLS certs and as a client also using mTSL certs for emitting metrics.

type Router

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

Router routes envelopes from producers to any subscribers.

func NewRouter

func NewRouter(grpc GRPC, opts ...RouterOption) *Router

NewRouter creates a new Router with the given options. Each provided RouterOption will manipulate the Router behavior.

func (*Router) Addrs

func (d *Router) Addrs() Addrs

Addrs returns a copy of the listeners' addresses.

func (*Router) Start

func (d *Router) Start()

Start enables the Router to start receiving envelope, accepting subscriptions and routing data.

func (*Router) Stop

func (d *Router) Stop()

Stop closes the gRPC and health listeners.

type RouterOption

type RouterOption func(*Router)

RouterOption is used to configure a new Router.

func WithMetricReporting

func WithMetricReporting(
	healthAddr string,
	agent Agent,
	metricBatchIntervalMilliseconds uint,
	sourceID string,
) RouterOption

WithMetricReporting returns a RouterOption that enables Router to emit metrics about itself.

func WithPersistence

func WithPersistence(
	maxRetainedLogMessages uint32,
	sinkInactivityTimeoutSeconds int,
) RouterOption

WithPersistence turns on recent log storage.

Jump to

Keyboard shortcuts

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