Documentation
¶
Index ¶
- func LoggingInterceptor(l *zerolog.Logger) connect.Interceptor
- func NewRequestGate(authn *GRPCAuthN, limiter *HatchetRateLimiter, l *zerolog.Logger) connect.RequestGateFunc
- func NewTelemetryInterceptor() connect.Interceptor
- func RecoveryInterceptor(a errors.Alerter, l *zerolog.Logger) connect.Interceptor
- type ErrorInterceptor
- type GRPCAuthN
- type HatchetApiTokenRateLimiter
- type HatchetRateLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoggingInterceptor ¶ added in v0.108.4
func LoggingInterceptor(l *zerolog.Logger) connect.Interceptor
LoggingInterceptor logs the start and finish of every call. The messages, field names and levels are a contract with log queries and alerts: grpc.code carries the canonical gRPC code name and grpc.error the gRPC rendering of the error.
func NewRequestGate ¶ added in v0.108.4
func NewRequestGate(authn *GRPCAuthN, limiter *HatchetRateLimiter, l *zerolog.Logger) connect.RequestGateFunc
NewRequestGate authenticates a call and applies the per-token rate limit once the request headers are in, before any message is read or decoded. A rejected call never reaches the interceptor chain, so the gate logs and traces it the way the chain would have.
func NewTelemetryInterceptor ¶ added in v0.108.4
func NewTelemetryInterceptor() connect.Interceptor
NewTelemetryInterceptor traces and times every unary and streaming call. It continues the caller's trace, and it must be the outermost interceptor so that the span covers the rest of the chain and records the error the client receives.
func RecoveryInterceptor ¶ added in v0.108.4
RecoveryInterceptor converts a panic in a handler into an internal error, for unary and streaming calls.
Types ¶
type ErrorInterceptor ¶
type ErrorInterceptor struct {
// contains filtered or unexported fields
}
func NewErrorInterceptor ¶
func NewErrorInterceptor(a errors.Alerter, l *zerolog.Logger) *ErrorInterceptor
func (*ErrorInterceptor) Interceptor ¶ added in v0.108.4
func (e *ErrorInterceptor) Interceptor() connect.Interceptor
Interceptor converts errors without a code into internal errors, for unary and streaming calls.
type GRPCAuthN ¶
type GRPCAuthN struct {
// contains filtered or unexported fields
}
func NewAuthN ¶
func NewAuthN(config *server.ServerConfig) *GRPCAuthN
func (*GRPCAuthN) Middleware ¶
Middleware validates the bearer token in header and returns ctx carrying the tenant, the token id and the call source. It runs from the request gate, before any message is read.
type HatchetApiTokenRateLimiter ¶
type HatchetApiTokenRateLimiter struct {
// contains filtered or unexported fields
}
type HatchetRateLimiter ¶
type HatchetRateLimiter struct {
// contains filtered or unexported fields
}
func NewHatchetRateLimiter ¶
func (*HatchetRateLimiter) GetOrCreateTenantRateLimiter ¶
func (rl *HatchetRateLimiter) GetOrCreateTenantRateLimiter(rateLimitToken string) *HatchetApiTokenRateLimiter