obs

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

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 Fields

func Fields(ctx context.Context) map[string]string

Fields returns tenant observability fields for ctx.

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

func LoggerWithTenant(ctx context.Context, logger *slog.Logger) *slog.Logger

LoggerWithTenant returns logger enriched with tenant fields from ctx.

func Redact

func Redact(fields map[string]string) map[string]string

Redact removes sensitive values from a string map.

func RedactSlogAttrs

func RedactSlogAttrs(attrs ...slog.Attr) []slog.Attr

RedactSlogAttrs returns a redacted copy of attrs.

func SlogAttrs

func SlogAttrs(ctx context.Context) []slog.Attr

SlogAttrs returns tenant observability attributes for slog.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL