Documentation
¶
Index ¶
- func GetGlobalLogger(component string) zerolog.Logger
- type Config
- type LogFormat
- type Options
- type Telemetry
- func (t *Telemetry) CaptureEvent(ctx context.Context, event string, properties map[string]any)
- func (t *Telemetry) CaptureException(ctx context.Context, err error)
- func (t *Telemetry) GetLogger(component string) zerolog.Logger
- func (t *Telemetry) GetLoggerWithTrace(ctx context.Context, component string) zerolog.Logger
- func (t *Telemetry) RecoverAndFlush(repanic bool)
- func (t *Telemetry) Shutdown(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGlobalLogger ¶
GetGlobalLogger returns a component-specific logger using the global console logger.
Types ¶
type Config ¶
type Config struct {
// Endpoint is the OTLP collector endpoint.
Endpoint string `env:"OTEL_EXPORTER_OTLP_ENDPOINT" envDefault:"jaeger:4317"`
// TraceSampleRate is the sampling rate for traces (0.0 to 1.0).
TraceSampleRate float64 `env:"OTEL_TRACE_SAMPLE_RATE" envDefault:"1.0"`
// Log level configuration ("debug", "info", "warn", "error").
LogLevel string `env:"LOG_LEVEL" envDefault:"info"`
// Log format configuration ("json", "pretty").
LogFormat string `env:"LOG_FORMAT" envDefault:"json"`
// SentryDsn is the Sentry DSN.
SentryDsn string `env:"SENTRY_DSN"`
// SentryEnvironment is to determine if shard is running in development or production (DEV/PROD).
SentryEnvironment string `env:"SENTRY_ENVIRONMENT"`
// PosthogAPIKey is the PostHog API key.
PosthogAPIKey string `env:"POSTHOG_API_KEY"`
}
type LogFormat ¶
type LogFormat uint8
LogFormat represents the log output format.
func ParseLogFormat ¶
ParseLogFormat converts a string to LogFormat enum.
type Telemetry ¶
type Telemetry struct {
Logger zerolog.Logger
Tracer trace.Tracer
// contains filtered or unexported fields
}
func (*Telemetry) CaptureEvent ¶ added in v0.0.5
CaptureEvent captures an event and sends it to PostHog.
func (*Telemetry) CaptureException ¶ added in v0.0.5
CaptureException captures an exception and sends it to Sentry.
func (*Telemetry) GetLoggerWithTrace ¶
GetLoggerWithTrace returns a component-specific logger enriched with trace context.
func (*Telemetry) RecoverAndFlush ¶ added in v0.0.5
RecoverAndFlush recovers from a panic and flushes buffered events to Sentry.
Click to show internal directories.
Click to hide internal directories.