config

package
v0.0.0-...-e5f8ed5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BQConfig

type BQConfig struct {
	// GCP Project
	Project string
	// GCP Dataset
	Dataset string
	// GCP Table
	Table string
}

BQConfig captures GCP BigQuery information for writing Observation Service logs to

type Config

type Config struct {
	Port              int `envconfig:"PORT" default:"9001"`
	DeploymentConfig  DeploymentConfig
	NewRelicConfig    newrelic.Config
	SentryConfig      sentry.Config
	LogConsumerConfig LogConsumerConfig
	LogProducerConfig LogProducerConfig
	MonitoringConfig  MonitoringConfig
}

Config captures the config related to starting Observation Service

func Load

func Load(filepaths ...string) (*Config, error)

Load parses multiple file configs specified via filepaths and returns a Config struct

func (*Config) ListenAddress

func (c *Config) ListenAddress() string

ListenAddress returns the Observation API port

type DeploymentConfig

type DeploymentConfig struct {
	// ProjectName describes the CaraML project Timber services are deployed for
	ProjectName string `default:""`
	// ServiceName describes the CaraML Timber service name
	ServiceName string `default:""`
	// LogLevel captures the selected supported logging level
	LogLevel commonconfig.LogLevel `split_words:"false" default:"INFO"`
	// Maximum no. of go-routines that is allowed
	MaxGoRoutines int `default:"1000"`
}

DeploymentConfig captures the config related to the deployment of Timber Services

type FluentdConfig

type FluentdConfig struct {
	// The type of Data Sink for Observation logs flushed via Fluentd
	Kind FluentdProducerSinkKind `default:""`
	// Fluentd Host to connect to
	Host string `default:"localhost"`
	// Fluentd Port to connect to
	Port int `default:"24224"`
	// Fluentd Tag to match messages
	Tag string `default:"observation-service"`
	// BufferLimit specifies maximum no. of events that can be buffered on memory
	BufferLimit int `default:"8192"`

	// BQConfig captures the config related to initializing a BQ Sink
	BQConfig *BQConfig
}

FluentdConfig captures necessary configuration to flush ObservationLog to multiple sinks

type FluentdProducerSinkKind

type FluentdProducerSinkKind = string

FluentdProducerSinkKind captures the sink config for flushing Observation Service logs via Fluentd

const (
	// LoggerNoopSinkFluentdProducer is a Fluentd No-Op ObservationLog Producer
	LoggerNoopSinkFluentdProducer FluentdProducerSinkKind = ""
	// LoggerBQSinkFluentdProducer is a Fluentd ObservationLog BigQuery Producer
	LoggerBQSinkFluentdProducer FluentdProducerSinkKind = "bq"
)

type KafkaConfig

type KafkaConfig struct {
	// Kafka Brokers to connect to, comma-delimited, in the form of "<broker_host>:<broker_port>"
	Brokers string
	// Kafka Topic to produce to/consume from
	Topic string
	// Largest record batch size allowed by Kafka (after compression if compression is enabled)
	MaxMessageBytes int `default:"1048588"`
	// The compression type for all data generated by the Producer
	CompressionType string `default:"none"`
	// ConnectTimeoutMS is the maximum duration (ms) the Kafka Producer/Consumer will block for to get Metadata, before timing out
	ConnectTimeoutMS int `default:"1000"`
	// PollInterval is the maximum duration (ms) the Kafka Consumer will block for, before timing out
	PollInterval int `default:"1000"`
	// What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server
	AutoOffsetReset string `default:"latest"`
}

KafkaConfig captures all configurable parameters when configuring a Kafka Consumer and Producer

type LogConsumerConfig

type LogConsumerConfig struct {
	// The type of Data Source for Observation logs
	Kind ObservationLoggerConsumerKind `default:""`

	// KafkaConfig captures the config related to initializing a Kafka Consumer
	KafkaConfig *KafkaConfig
}

LogConsumerConfig captures the config related to consuming ObservationLog via a background process

type LogProducerConfig

type LogProducerConfig struct {
	// The type of Data Sink for Observation logs
	Kind ObservationLoggerProducerKind `default:""`
	// Maximum no. of Observation logs to be stored in Go channel
	QueueLength int `default:"100000"`

	// KafkaConfig captures the config related to initializing a Kafka Producer
	KafkaConfig *KafkaConfig
	// FluentdConfig captures the config related to initializing a Fluentd instance
	FluentdConfig *FluentdConfig
}

LogProducerConfig captures the config related to producing ObservationLog

type MetricSinkKind

type MetricSinkKind = string

MetricSinkKind captures type of metrics sink

const (
	// PrometheusMetricSink represents the Prometheus Metric Storage
	PrometheusMetricSink MetricSinkKind = "prometheus"
	// NoopMetricSink represents no Metric Storage
	NoopMetricSink MetricSinkKind = ""
)

type MonitoringConfig

type MonitoringConfig struct {
	// The type of Metrics Sink for Observation logs
	Kind MetricSinkKind `default:""`
}

MonitoringConfig captures the config for monitoring metrics

type ObservationLoggerConsumerKind

type ObservationLoggerConsumerKind = string

ObservationLoggerConsumerKind captures the consumer config for reading Observation Service logs

const (
	// LoggerNoopConsumer is a No-Op ObservationLog Consumer
	LoggerNoopConsumer ObservationLoggerConsumerKind = ""
	// LoggerKafkaConsumer is a Kafka ObservationLog Consumer
	LoggerKafkaConsumer ObservationLoggerConsumerKind = "kafka"
)

type ObservationLoggerProducerKind

type ObservationLoggerProducerKind = string

ObservationLoggerProducerKind captures the producer config for flushing Observation Service logs

const (
	// LoggerNoopProducer is a No-Op ObservationLog Producer
	LoggerNoopProducer ObservationLoggerProducerKind = ""
	// LoggerStdOutProducer is a Standard Output ObservationLog Producer
	LoggerStdOutProducer ObservationLoggerProducerKind = "stdout"
	// LoggerKafkaProducer is a Kafka ObservationLog Producer
	LoggerKafkaProducer ObservationLoggerProducerKind = "kafka"
	// LoggerFluentdProducer is a Fluentd ObservationLog Producer
	LoggerFluentdProducer ObservationLoggerProducerKind = "fluentd"
)

Jump to

Keyboard shortcuts

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