Documentation ¶
Overview ¶
Package config loads application configuration.
Index ¶
- func ConfigureAggregation(v *viper.Viper)
- func ConfigureDedupe(v *viper.Viper)
- func ConfigureIngest(v *viper.Viper)
- func ConfigureNamespace(v *viper.Viper)
- func ConfigurePortal(v *viper.Viper)
- func ConfigureSink(v *viper.Viper)
- func DecodeHook() mapstructure.DecodeHookFunc
- func SetViperDefaults(v *viper.Viper, flags *pflag.FlagSet)
- type AggregationConfiguration
- type ClickHouseAggregationConfiguration
- type Configuration
- type DedupeConfiguration
- type DedupeDriverConfiguration
- type DedupeDriverMemoryConfiguration
- type DedupeDriverRedisConfiguration
- type EntitlementsConfiguration
- type ExportersMetricsTelemetryConfig
- type ExportersTraceTelemetryConfig
- type IngestConfiguration
- type KafkaIngestConfiguration
- type LogTelemetryConfiguration
- type MetricsTelemetryConfig
- type NamespaceConfiguration
- type OTLPExporterTelemetryConfig
- type OTLPExportersMetricsTelemetryConfig
- type OTLPExportersTraceTelemetryConfig
- type PortalCORSConfiguration
- type PortalConfiguration
- type PostgresConfig
- type PrometheusExportersMetricsTelemetryConfig
- type SinkConfiguration
- type TelemetryConfig
- type TraceTelemetryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureAggregation ¶
ConfigureAggregation configures some defaults in the Viper instance.
func ConfigureDedupe ¶
ConfigureDedupe configures some defaults in the Viper instance.
func ConfigureIngest ¶
Configure configures some defaults in the Viper instance.
func ConfigureNamespace ¶
ConfigureNamespace configures some defaults in the Viper instance.
func ConfigurePortal ¶
ConfigurePortal configures some defaults in the Viper instance.
func ConfigureSink ¶
Configure configures some defaults in the Viper instance.
func DecodeHook ¶
func DecodeHook() mapstructure.DecodeHookFunc
Types ¶
type AggregationConfiguration ¶
type AggregationConfiguration struct { ClickHouse ClickHouseAggregationConfiguration // Populate creates the materialized view with data from the events table // This is not safe to use in production as requires to stop ingestion PopulateMeter bool // CreateOrReplace is used to force the recreation of the materialized view // This is not safe to use in production as it will drop the existing views CreateOrReplaceMeter bool }
func (AggregationConfiguration) Validate ¶
func (c AggregationConfiguration) Validate() error
Validate validates the configuration.
type ClickHouseAggregationConfiguration ¶
type ClickHouseAggregationConfiguration struct { Address string TLS bool Username string Password string Database string }
func (ClickHouseAggregationConfiguration) Validate ¶
func (c ClickHouseAggregationConfiguration) Validate() error
type Configuration ¶
type Configuration struct { Address string Environment string Telemetry TelemetryConfig Aggregation AggregationConfiguration Entitlements EntitlementsConfiguration Dedupe DedupeConfiguration Ingest IngestConfiguration Meters []*models.Meter Namespace NamespaceConfiguration Portal PortalConfiguration Postgres PostgresConfig Sink SinkConfiguration }
Configuration holds any kind of Configuration that comes from the outside world and is necessary for running the application.
func (Configuration) Validate ¶
func (c Configuration) Validate() error
Validate validates the configuration.
type DedupeConfiguration ¶
type DedupeConfiguration struct { Enabled bool DedupeDriverConfiguration }
Requires mapstructurex.MapDecoderHookFunc to be high up in the decode hook chain.
func (*DedupeConfiguration) DecodeMap ¶
func (c *DedupeConfiguration) DecodeMap(v map[string]any) error
func (DedupeConfiguration) NewDeduplicator ¶
func (c DedupeConfiguration) NewDeduplicator() (dedupe.Deduplicator, error)
func (DedupeConfiguration) Validate ¶
func (c DedupeConfiguration) Validate() error
type DedupeDriverConfiguration ¶
type DedupeDriverConfiguration interface { DriverName() string NewDeduplicator() (dedupe.Deduplicator, error) Validate() error }
type DedupeDriverMemoryConfiguration ¶
Dedupe memory driver configuration
func (DedupeDriverMemoryConfiguration) DriverName ¶
func (DedupeDriverMemoryConfiguration) DriverName() string
func (DedupeDriverMemoryConfiguration) NewDeduplicator ¶
func (c DedupeDriverMemoryConfiguration) NewDeduplicator() (dedupe.Deduplicator, error)
func (DedupeDriverMemoryConfiguration) Validate ¶
func (c DedupeDriverMemoryConfiguration) Validate() error
type DedupeDriverRedisConfiguration ¶
type DedupeDriverRedisConfiguration struct { Address string Database int Username string Password string Expiration time.Duration Sentinel struct { Enabled bool MasterName string } TLS struct { Enabled bool InsecureSkipVerify bool } }
Dedupe redis driver configuration
func (DedupeDriverRedisConfiguration) DriverName ¶
func (DedupeDriverRedisConfiguration) DriverName() string
func (DedupeDriverRedisConfiguration) NewDeduplicator ¶
func (c DedupeDriverRedisConfiguration) NewDeduplicator() (dedupe.Deduplicator, error)
func (DedupeDriverRedisConfiguration) Validate ¶
func (c DedupeDriverRedisConfiguration) Validate() error
type EntitlementsConfiguration ¶
type EntitlementsConfiguration struct {
Enabled bool
}
func (EntitlementsConfiguration) Validate ¶
func (c EntitlementsConfiguration) Validate() error
Validate validates the configuration.
type ExportersMetricsTelemetryConfig ¶
type ExportersMetricsTelemetryConfig struct { Prometheus PrometheusExportersMetricsTelemetryConfig OTLP OTLPExportersMetricsTelemetryConfig }
func (ExportersMetricsTelemetryConfig) Validate ¶
func (c ExportersMetricsTelemetryConfig) Validate() error
Validate validates the configuration.
type ExportersTraceTelemetryConfig ¶
type ExportersTraceTelemetryConfig struct {
OTLP OTLPExportersTraceTelemetryConfig
}
func (ExportersTraceTelemetryConfig) Validate ¶
func (c ExportersTraceTelemetryConfig) Validate() error
Validate validates the configuration.
type IngestConfiguration ¶
type IngestConfiguration struct {
Kafka KafkaIngestConfiguration
}
func (IngestConfiguration) Validate ¶
func (c IngestConfiguration) Validate() error
Validate validates the configuration.
type KafkaIngestConfiguration ¶
type KafkaIngestConfiguration struct { Broker string SecurityProtocol string SaslMechanisms string SaslUsername string SaslPassword string Partitions int EventsTopicTemplate string StatsInterval pkgkafka.TimeDurationMilliSeconds // BrokerAddressFamily defines the IP address family to be used for network communication with Kafka cluster BrokerAddressFamily pkgkafka.BrokerAddressFamily // SocketKeepAliveEnable defines if TCP socket keep-alive is enabled to prevent closing idle connections // by Kafka brokers. SocketKeepAliveEnabled bool // TopicMetadataRefreshInterval defines how frequently the Kafka client needs to fetch metadata information // (brokers, topic, partitions, etc) from the Kafka cluster. // The 5 minutes default value is appropriate for mostly static Kafka clusters, but needs to be lowered // in case of large clusters where changes are more frequent. // This value must not be set to value lower than 10s. TopicMetadataRefreshInterval pkgkafka.TimeDurationMilliSeconds }
func (KafkaIngestConfiguration) CreateKafkaConfig ¶
func (c KafkaIngestConfiguration) CreateKafkaConfig() kafka.ConfigMap
CreateKafkaConfig creates a Kafka config map.
func (KafkaIngestConfiguration) Validate ¶
func (c KafkaIngestConfiguration) Validate() error
Validate validates the configuration.
type LogTelemetryConfiguration ¶
type LogTelemetryConfiguration struct { // Format specifies the output log format. // Accepted values are: json, text Format string // Level is the minimum log level that should appear on the output. // // Requires [mapstructure.TextUnmarshallerHookFunc] to be high up in the decode hook chain. Level slog.Level }
func (LogTelemetryConfiguration) NewHandler ¶
func (c LogTelemetryConfiguration) NewHandler(w io.Writer) slog.Handler
NewHandler creates a new slog.Handler.
func (LogTelemetryConfiguration) Validate ¶
func (c LogTelemetryConfiguration) Validate() error
Validate validates the configuration.
type MetricsTelemetryConfig ¶
type MetricsTelemetryConfig struct {
Exporters ExportersMetricsTelemetryConfig
}
func (MetricsTelemetryConfig) NewMeterProvider ¶
func (c MetricsTelemetryConfig) NewMeterProvider(ctx context.Context, res *resource.Resource) (*sdkmetric.MeterProvider, error)
func (MetricsTelemetryConfig) Validate ¶
func (c MetricsTelemetryConfig) Validate() error
Validate validates the configuration.
type NamespaceConfiguration ¶
Namespace configuration
func (NamespaceConfiguration) Validate ¶
func (c NamespaceConfiguration) Validate() error
type OTLPExporterTelemetryConfig ¶
type OTLPExporterTelemetryConfig struct {
Address string
}
func (OTLPExporterTelemetryConfig) DialExporter ¶
func (c OTLPExporterTelemetryConfig) DialExporter(ctx context.Context) (*grpc.ClientConn, error)
func (OTLPExporterTelemetryConfig) Validate ¶
func (c OTLPExporterTelemetryConfig) Validate() error
Validate validates the configuration.
type OTLPExportersMetricsTelemetryConfig ¶
type OTLPExportersMetricsTelemetryConfig struct { Enabled bool OTLPExporterTelemetryConfig `mapstructure:",squash"` }
func (OTLPExportersMetricsTelemetryConfig) NewExporter ¶
func (c OTLPExportersMetricsTelemetryConfig) NewExporter(ctx context.Context) (sdkmetric.Reader, error)
NewExporter creates a new sdkmetric.Reader.
func (OTLPExportersMetricsTelemetryConfig) Validate ¶
func (c OTLPExportersMetricsTelemetryConfig) Validate() error
Validate validates the configuration.
type OTLPExportersTraceTelemetryConfig ¶
type OTLPExportersTraceTelemetryConfig struct { Enabled bool OTLPExporterTelemetryConfig `mapstructure:",squash"` }
func (OTLPExportersTraceTelemetryConfig) NewExporter ¶
func (c OTLPExportersTraceTelemetryConfig) NewExporter(ctx context.Context) (sdktrace.SpanExporter, error)
NewExporter creates a new sdktrace.SpanExporter.
func (OTLPExportersTraceTelemetryConfig) Validate ¶
func (c OTLPExportersTraceTelemetryConfig) Validate() error
Validate validates the configuration.
type PortalCORSConfiguration ¶
type PortalCORSConfiguration struct {
Enabled bool `mapstructure:"enabled"`
}
type PortalConfiguration ¶
type PortalConfiguration struct { Enabled bool `mapstructure:"enabled"` CORS PortalCORSConfiguration `mapstructure:"cors"` TokenSecret string `mapstructure:"tokenSecret"` TokenExpiration time.Duration `mapstructure:"tokenExpiration"` }
func (PortalConfiguration) Validate ¶
func (c PortalConfiguration) Validate() error
Validate validates the configuration.
type PostgresConfig ¶
type PostgresConfig struct { // URL is the PostgreSQL database connection URL. URL string `yaml:"url"` }
func (PostgresConfig) Validate ¶
func (c PostgresConfig) Validate() error
Validate validates the configuration.
type PrometheusExportersMetricsTelemetryConfig ¶
type PrometheusExportersMetricsTelemetryConfig struct {
Enabled bool
}
func (PrometheusExportersMetricsTelemetryConfig) NewExporter ¶
func (c PrometheusExportersMetricsTelemetryConfig) NewExporter() (sdkmetric.Reader, error)
NewExporter creates a new sdkmetric.Reader.
func (PrometheusExportersMetricsTelemetryConfig) Validate ¶
func (c PrometheusExportersMetricsTelemetryConfig) Validate() error
Validate validates the configuration.
type SinkConfiguration ¶
type SinkConfiguration struct { GroupId string Dedupe DedupeConfiguration MinCommitCount int MaxCommitWait time.Duration NamespaceRefetch time.Duration }
func (SinkConfiguration) Validate ¶
func (c SinkConfiguration) Validate() error
type TelemetryConfig ¶
type TelemetryConfig struct { // Telemetry HTTP server address Address string Trace TraceTelemetryConfig Metrics MetricsTelemetryConfig Log LogTelemetryConfiguration }
func (TelemetryConfig) Validate ¶
func (c TelemetryConfig) Validate() error
Validate validates the configuration.
type TraceTelemetryConfig ¶
type TraceTelemetryConfig struct { Sampler string Exporters ExportersTraceTelemetryConfig }
func (TraceTelemetryConfig) GetSampler ¶
func (c TraceTelemetryConfig) GetSampler() sdktrace.Sampler
func (TraceTelemetryConfig) NewTracerProvider ¶
func (c TraceTelemetryConfig) NewTracerProvider(ctx context.Context, res *resource.Resource) (*sdktrace.TracerProvider, error)
func (TraceTelemetryConfig) Validate ¶
func (c TraceTelemetryConfig) Validate() error
Validate validates the configuration.