Documentation
¶
Overview ¶
Package observability provides factory functions to initialize the application's observability subsystems: structured logging (zap), Prometheus metrics, and OpenTelemetry tracing.
Each Init* function returns a shutdown function (func(context.Context) error) suitable for use with the closer package. Call Init* functions exactly once at application startup; repeated calls may leak resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitLogger ¶
InitLogger creates and returns a zap.Logger configured for JSON output to stdout with ISO8601 timestamps and caller information. The logging level is parsed from cfg.Logging.Level. Stack traces are automatically attached at ErrorLevel and above.
func InitMetrics ¶
InitMetrics starts a Prometheus metrics HTTP server on a separate port when cfg.Metrics.Enabled is true. It registers the default promhttp handler at the configured path (default: /metrics). Returns a shutdown function that gracefully stops the server. If metrics are disabled, returns a no-op shutdown function.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sentry provides Sentry error tracking initialization.
|
Package sentry provides Sentry error tracking initialization. |
|
http
Package http provides Sentry HTTP middleware that wraps an http.Handler with Sentry's panic recovery and error reporting.
|
Package http provides Sentry HTTP middleware that wraps an http.Handler with Sentry's panic recovery and error reporting. |
|
mock
Package mock provides a MockSentry test server that records HTTP requests made by the Sentry SDK.
|
Package mock provides a MockSentry test server that records HTTP requests made by the Sentry SDK. |
|
zap
Package zap provides a zap.Logger wrapper that forwards log entries (ErrorLevel by default) to Sentry via a custom zapcore.Core.
|
Package zap provides a zap.Logger wrapper that forwards log entries (ErrorLevel by default) to Sentry via a custom zapcore.Core. |