Middleware

📄️ Overview
Kratos has a series of built-in middleware to deal with common purpose such as logging or metrics. You could also implement Middleware interface to develop your custom middleware to process common business such as the user authentication etc.

📄️ Authentication
Auth middleware is used to authenticate requests. Only those authenticated could be processed.

📄️ Circuit Breaker
Circuit breaker middleware for providing client-side breaker functionality, with sre breaker algorithm implemented by default。

📄️ Logging
Logging middleware is used to print the details of requests received or initiated by the service.

📄️ Metrics
Metrics middleware is used to monitor performance metrics for services, counting request time and request counts.

📄️ Rate Limiter
Rate limiter middleware for server-side traffic control, with bbr limiter algorithm implemented by default.

📄️ Recovery
Recovery middleware is used for abnormal recovery and prevents the program from exiting directly in the event of an exception to the service.

📄️ Tracing
We use OpenTelemetry for distributed tracing.

📄️ Validate
Validate middleware uses proto-gen-validate generated code for parameter validation. You could write parameter validation rules in proto files and generate codes, in order to automatically parameter validation.