package
0.10.0
Repository: https://github.com/kittipat1413/go-common.git
Documentation: pkg.go.dev

# Functions

CircuitBreaker creates a Gin middleware that wraps route handlers with a circuit breaker.
GetRequestIDFromContext retrieves the request ID from the context.
Recovery returns a Gin middleware that recovers from panics during request handling and logs the error.
RequestID returns a Gin middleware that injects a unique request ID into each HTTP request's context.
RequestLogger returns a Gin middleware that logs detailed information about HTTP requests and responses.
Trace is a Gin middleware that integrates OpenTelemetry tracing into the request lifecycle.
WithCircuitBreakerErrorHandler sets a custom error handler for circuit breaker failures.
WithCircuitBreakerFilter adds one or more filters to determine whether the circuit breaker applies to specific requests.
WithCircuitBreakerSettings allows customizing the circuit breaker settings.
WithCircuitBreakerStatusThreshold sets the status code threshold for error detection.
WithRecoveryHandler sets a custom error handler for the Recovery middleware.
WithLogger sets a custom logger for the Recovery middleware.
WithRequestIDGenerator allows setting a custom ID generator function.
WithRequestIDHeader allows setting a custom header name for the request ID.
WithRequestLogger allows setting a custom logger for the request logger middleware.
WithRequestLoggerFilter adds one or more filters to the list of filters used by the request logger middleware.
WithSpanNameFormatter sets a custom function to format the span name for each request.
WithTraceFilter adds one or more filters to the list of filters used by the middleware.
WithTracePropagators specifies propagators to use for extracting information from the HTTP requests.
WithTracerProvider specifies a tracer provider to use for creating a tracer.

# Constants

DefaultRequestIDHeader is the default header name where the request ID is stored.

# Type aliases

CircuitBreakerFilter is a function that determines whether a request should be wrapped by the circuit breaker.
CircuitBreakerOption is a function that configures circuitBreakerOptions.
RecoveryOptions is a function that configures recoveryOptions.
RequestIDGenerator is a function type that generates a unique ID.
RequestIDOption is a function that configures the requestIDOptions.
RequestLoggerFilter is a function that determines whether a request should be logged.
RequestLoggerOption is a function that configures requestLoggerOptions.
SpanNameFormatter is used to set the span name based on the http.Request.
TraceFilter is a function that determines whether a request should be traced.
TraceOption specifies instrumentation configuration options.