config

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ADDR                           = "127.0.0.1:32084"
	DEFAULT_DATASOURCE_URL                 = "mongodb://localhost:27017"
	DEFAULT_DB                             = "etre_dev"
	DEFAULT_DB_CONNECT_TIMEOUT             = "5s"
	DEFAULT_DB_QUERY_TIMEOUT               = "2s"
	DEFAULT_DB_MIN_CONN                    = 10
	DEFAULT_DB_MAX_CONN                    = 1000
	DEFAULT_CDC_WRITE_RETRY_COUNT          = 2
	DEFAULT_CDC_WRITE_RETRY_WAIT           = 2
	DEFAULT_CDC_FALLBACK_FILE              = "/tmp/etre-cdc.json"
	DEFAULT_CHANGESTREAM_BUFFER_SIZE       = 100
	DEFAULT_CHANGESTREAM_MAX_CLIENTS       = 100
	DEFAULT_ENTITY_TYPE                    = "host"
	DEFAULT_QUERY_LATENCY_SLA              = "1s"
	DEFAULT_QUERY_PROFILE_SAMPLE_RATE      = 0.2
	DEFAULT_QUERY_PROFILE_REPORT_THRESHOLD = "500ms"
)
View Source
const CDC_COLLECTION = "cdc"

Variables

This section is empty.

Functions

func Validate added in v0.11.0

func Validate(config Config) error

Types

type ACL

type ACL struct {
	Role              string   `yaml:"role"`
	Admin             bool     `yaml:"admin"`
	Read              []string `yaml:"read"`
	Write             []string `yaml:"write"`
	TraceKeysRequired []string `yaml:"trace_keys_required"`
}

type CDCConfig

type CDCConfig struct {
	Disabled bool `yaml:"disabled"`

	Datasource DatasourceConfig `yaml:"datasource"`

	// If set, CDC events will attempt to be written to this file if they cannot
	// be written to mongo.
	FallbackFile string `yaml:"fallback_file"`
	// Number of times CDC events will retry writing to mongo in the event of an error.
	WriteRetryCount int `yaml:"write_retry_count"`
	// Wait time in milliseconds between write retry events.
	WriteRetryWait int `yaml:"write_retry_wait"` // milliseconds

	ChangeStream ChangeStreamConfig `yaml:"change_stream"`
}

type ChangeStreamConfig added in v0.11.0

type ChangeStreamConfig struct {
	MaxClients uint `yaml:"max_clients"`

	// BufferSize is the number of etre.CDCEvent to buffer per-client. If the
	// buffer fills because the client is slow to receive events, the server
	// drops the client.
	BufferSize uint `yaml:"buffer_size"`
}

type Config

type Config struct {
	Server     ServerConfig     `yaml:"server"`
	Datasource DatasourceConfig `yaml:"datasource"`
	Entity     EntityConfig     `yaml:"entity"`
	CDC        CDCConfig        `yaml:"cdc"`
	Security   SecurityConfig   `yaml: "security"`
	Metrics    MetricsConfig    `yaml:"metrics"`
}

func Default

func Default() Config

func Load

func Load(file string) (Config, error)

type DatasourceConfig

type DatasourceConfig struct {
	URL            string `yaml:"url"`
	Database       string `yaml:"database"`
	ConnectTimeout string `yaml:"connect_timeout"`
	QueryTimeout   string `yaml:"query_timeout"`
	MinConnections uint64 `yaml:"min_connections"`
	MaxConnections uint64 `yaml:"max_connections"`

	// Certs
	TLSCert string `yaml:"tls_cert"`
	TLSKey  string `yaml:"tls_key"`
	TLSCA   string `yaml:"tls_ca"`

	// Credentials
	Username  string `yaml:"username"`
	Password  string `yaml:"password"`
	Source    string `yaml:"source"`
	Mechanism string `yaml:"mechanism"`
}

func (DatasourceConfig) WithDefaults added in v0.11.0

type EntityConfig

type EntityConfig struct {
	Types []string `yaml:"types"`
}

type MetricsConfig

type MetricsConfig struct {
	QueryLatencySLA             string  `yaml:"query_latency_sla"` // duration string
	QueryProfileSampleRate      float64 `yaml:"query_profile_sample_rate"`
	QueryProfileReportThreshold string  `yaml:"query_profile_report_threshold"` // duration string
}

type SecurityConfig added in v0.11.0

type SecurityConfig struct {
	ACL []ACL `yaml:"acl"`
}

type ServerConfig

type ServerConfig struct {
	Addr    string `yaml:"addr"`
	TLSCert string `yaml:"tls_cert"`
	TLSKey  string `yaml:"tls_key"`
	TLSCA   string `yaml:"tls_ca"`
}

Jump to

Keyboard shortcuts

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