Documentation
¶
Overview ¶
Package observability provides structured operation logging and gRPC request correlation.
Index ¶
- func EnsureRequestID(ctx context.Context) context.Context
- func Logger(ctx context.Context, logger *slog.Logger) *slog.Logger
- func RequestID(ctx context.Context) string
- func Start(ctx context.Context, logger *slog.Logger, component, operation string, ...) func(error, ...any)
- func StartDebug(ctx context.Context, logger *slog.Logger, component, operation string, ...) func(error, ...any)
- func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func StreamServerInterceptor(logger *slog.Logger) grpc.StreamServerInterceptor
- func UnaryClientInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, ...) error
- func UnaryServerInterceptor(logger *slog.Logger) grpc.UnaryServerInterceptor
- func WithRequestID(ctx context.Context, requestID string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureRequestID ¶
EnsureRequestID preserves an existing request ID or creates one.
func Start ¶
func Start(ctx context.Context, logger *slog.Logger, component, operation string, attrs ...any) func(error, ...any)
Start records an info-level operation start and returns its completion recorder.
func StartDebug ¶
func StartDebug(ctx context.Context, logger *slog.Logger, component, operation string, attrs ...any) func(error, ...any)
StartDebug records a debug-level operation start and returns its completion recorder. Failures are promoted according to error_kind so internal faults remain visible at error level.
func StreamClientInterceptor ¶
func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)
StreamClientInterceptor propagates request correlation IDs to streaming gRPC calls.
func StreamServerInterceptor ¶
func StreamServerInterceptor(logger *slog.Logger) grpc.StreamServerInterceptor
StreamServerInterceptor logs and correlates streaming gRPC requests.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
UnaryClientInterceptor propagates request correlation IDs to unary gRPC calls.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(logger *slog.Logger) grpc.UnaryServerInterceptor
UnaryServerInterceptor logs and correlates unary gRPC requests.
Types ¶
This section is empty.