observability

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package observability provides structured operation logging and gRPC request correlation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureRequestID

func EnsureRequestID(ctx context.Context) context.Context

EnsureRequestID preserves an existing request ID or creates one.

func Logger

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

Logger returns logger enriched with context correlation fields.

func RequestID

func RequestID(ctx context.Context) string

RequestID returns the request correlation ID carried by ctx.

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.

func WithRequestID

func WithRequestID(ctx context.Context, requestID string) context.Context

WithRequestID adds a request correlation ID to ctx.

Types

This section is empty.

Jump to

Keyboard shortcuts

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