Documentation ¶
Index ¶
- Variables
- type Endpoint
- type Middleware
- func Chain[TIn, TOut any](outer Middleware[TIn, TOut], others ...Middleware[TIn, TOut]) Middleware[TIn, TOut]
- func EndpointLogging[TIn, TOut any]() Middleware[TIn, TOut]
- func EndpointMetrics[TIn, TOut any](mp metric.MeterProvider) Middleware[TIn, TOut]
- func EndpointTracing[TIn, TOut any](tp trace.TracerProvider) Middleware[TIn, TOut]
Constants ¶
This section is empty.
Variables ¶
var TracerName = "github.com/jan-xyz/box"
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
Endpoint is the generic representation of any endpoint which takes a request and returns a reponse.
type Middleware ¶
Middleware is an Endpoint middleware which can be used to wrap around endpoints and decorate them with auxillary functionality, like request logging, instrumentation, context enrichment etc.
func Chain ¶
func Chain[TIn, TOut any](outer Middleware[TIn, TOut], others ...Middleware[TIn, TOut]) Middleware[TIn, TOut]
Chain is a convenience function to chain multiple [Middleware]s together and finally wraps an Endpoint.
func EndpointLogging ¶ added in v0.2.0
func EndpointLogging[TIn, TOut any]() Middleware[TIn, TOut]
EndpointLogging logs the requests and response and errors.
func EndpointMetrics ¶ added in v0.2.2
func EndpointMetrics[TIn, TOut any](mp metric.MeterProvider) Middleware[TIn, TOut]
EndpointMetrics records RED metrics for your Endpoint. It adds an Endpoint dimension to it. the default dimension value is "Endpoint".
func EndpointTracing ¶ added in v0.2.0
func EndpointTracing[TIn, TOut any](tp trace.TracerProvider) Middleware[TIn, TOut]
EndpointTracing adds tracing for the endpoint. The Span name defaults to "Endpoint".