Documentation ¶
Index ¶
- Variables
- func ContextWithHandle(ctx context.Context) context.Context
- func FromContext(ctx context.Context) *dispatch.ResponseMeta
- func SetInContext(ctx context.Context, metadata *dispatch.ResponseMeta)
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
Constants ¶
This section is empty.
Variables ¶
var ( // DispatchedCountLabels are the labels that DispatchedCountHistogram will // have have by default. DispatchedCountLabels = []string{"method", "cached"} // DispatchedCountHistogram is the metric that SpiceDB uses to keep track // of the number of downstream dispatches that are performed to answer a // single query. DispatchedCountHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{ Namespace: "spicedb", Subsystem: "services", Name: "dispatches", Help: "Histogram of cluster dispatches performed by the instance.", Buckets: []float64{1, 5, 10, 25, 50, 100, 250}, }, DispatchedCountLabels) )
Functions ¶
func ContextWithHandle ¶
ContextWithHandle creates a new context with a location to store metadata returned from a dispatched request.
This should only be called in middleware or testing functions.
func FromContext ¶
func FromContext(ctx context.Context) *dispatch.ResponseMeta
FromContext returns any metadata that was stored in the context.
This is useful for testing that a handler is properly setting the context.
func SetInContext ¶
func SetInContext(ctx context.Context, metadata *dispatch.ResponseMeta)
SetInContext should be called in a gRPC handler to correctly set the response metadata for the dispatched request.
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor implements a gRPC Middleware for reporting usage metrics in both the trailer of the request, as well as to the registered prometheus metrics
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor implements a gRPC Middleware for reporting usage metrics in both the trailer of the request, as well as to the registered prometheus metrics.
Types ¶
This section is empty.