Documentation
¶
Index ¶
Constants ¶
const ( // ProviderSegment represents Segment. ProviderSegment = "segment" // ProviderPostHog represents PostHog. ProviderPostHog = "posthog" )
Variables ¶
This section is empty.
Functions ¶
func NewEventReporter ¶
func NewEventReporter(ctx context.Context, cfg *Config, logger logging.Logger, tracerProvider tracing.TracerProvider, metricsProvider metrics.Provider) (analytics.EventReporter, error)
NewEventReporter provides an analytics.EventReporter from a config.
func RegisterEventReporter ¶
RegisterEventReporter registers an analytics.EventReporter with the injector.
Types ¶
type Config ¶
type Config struct {
ProxySources ProxySourcesConfig `envPrefix:"PROXY_SOURCES_" json:"proxySources" yaml:"proxySources"`
SourceConfig
}
Config is the configuration structure.
func (*Config) EnsureDefaults ¶
func (cfg *Config) EnsureDefaults()
EnsureDefaults sets sensible defaults for zero-valued fields.
type ProxySourcesConfig ¶
type ProxySourcesConfig struct {
IOS *SourceConfig `env:",init" envPrefix:"IOS_" json:"ios" yaml:"ios"`
Web *SourceConfig `env:",init" envPrefix:"WEB_" json:"web" yaml:"web"`
}
ProxySourcesConfig holds per-source analytics config for the analytics proxy gRPC service. Sources are codified: ios and web.
func (ProxySourcesConfig) ToMap ¶
func (p ProxySourcesConfig) ToMap() map[string]*SourceConfig
ToMap returns a map of source name to config for use by the multisource reporter. Skips nil entries.
type SourceConfig ¶
type SourceConfig struct {
Segment *segment.Config `env:",init" envPrefix:"SEGMENT_" json:"segment" yaml:"segment"`
Posthog *posthog.Config `env:",init" envPrefix:"POSTHOG_" json:"posthog" yaml:"posthog"`
Provider string `env:"PROVIDER" json:"provider" yaml:"provider"`
CircuitBreaker circuitbreakingcfg.Config `envPrefix:"CIRCUIT_BREAKER_" json:"circuitBreaker" yaml:"circuitBreaker"`
}
SourceConfig is the per-source analytics config (provider + credentials). Used for proxy sources; no ProxySources to avoid recursion.
func (*SourceConfig) EnsureDefaults ¶
func (cfg *SourceConfig) EnsureDefaults()
EnsureDefaults sets sensible defaults for zero-valued fields.
func (*SourceConfig) NewCollector ¶
func (cfg *SourceConfig) NewCollector( ctx context.Context, logger logging.Logger, tracerProvider tracing.TracerProvider, metricsProvider metrics.Provider, ) (analytics.EventReporter, error)
NewCollector provides a collector.
func (*SourceConfig) ValidateWithContext ¶
func (cfg *SourceConfig) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates a SourceConfig: the provider must be known and the matching credentials block present, so a proxy source with no provider/key can't pass validation and silently degrade to a noop at runtime.