usagemetrics

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func ContextWithHandle(ctx context.Context) context.Context

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL