Documentation
¶
Overview ¶
Package obs provides tenant observability fields, redaction helpers, and slog helpers.
The optional OpenTelemetry integration is available from github.com/DarkInno/saas/obs/otel.
Index ¶
- Constants
- func Fields(ctx context.Context) map[string]string
- func LogAttrs(ctx context.Context, logger *slog.Logger, level slog.Level, msg string, ...)
- func LoggerWithTenant(ctx context.Context, logger *slog.Logger) *slog.Logger
- func Redact(fields map[string]string) map[string]string
- func RedactSlogAttrs(attrs ...slog.Attr) []slog.Attr
- func SlogAttrs(ctx context.Context) []slog.Attr
Constants ¶
View Source
const ( // TenantIDField is the standard observability field for tenant ID. TenantIDField = "tenant_id" // TenantSideField is the standard observability field for tenant side. TenantSideField = "tenant_side" // DeploymentUnitIDField is the standard observability field for the resolved // logical deployment unit. It deliberately excludes geographic labels and // host-owned endpoint metadata. DeploymentUnitIDField = "deployment_unit_id" )
Variables ¶
This section is empty.
Functions ¶
func LogAttrs ¶
func LogAttrs(ctx context.Context, logger *slog.Logger, level slog.Level, msg string, attrs ...slog.Attr)
LogAttrs logs attrs with tenant fields from ctx and redacts sensitive attrs.
func LoggerWithTenant ¶
LoggerWithTenant returns logger enriched with tenant fields from ctx.
func RedactSlogAttrs ¶
RedactSlogAttrs returns a redacted copy of attrs.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.