Documentation
¶
Overview ¶
Package promgrpc is an instrumentation package that allows capturing metrics of your gRPC based services, both the server and the client side. The main goal of version 4 was to make it modular without sacrificing the simplicity of use.
It is still possible to integrate the package in just a few lines. However, if necessary, metrics can be added, removed or modified freely.
Design ¶
The package does not introduce any new concepts to an already complicated environment. Instead, it focuses on providing implementations of interfaces exported by gRPC and Prometheus libraries.
It causes no side effects nor has global state. Instead, it comes with handy one-liners to reduce integration overhead.
The package achieved high modularity by using Inversion of Control. We can define three layers of abstraction, where each is configurable or if necessary replaceable.
Collectors serve one purpose, storing metrics. These are types well known from Prometheus ecosystem, like counters, gauges, histograms or summaries. This package comes with a set of predefined functions that create a specific instances for each use case. For example:
func NewRequestsTotalCounterVec(Subsystem, ...CollectorOption) *prometheus.CounterVec
Level higher consist of stats handlers. This layer is responsible for metrics collection. It is aware of a collector and knows how to use it to record event occurrences. Each implementation satisfies stats.Handler and prometheus.Collector interface and knows how to monitor a single dimension, e.g. a total number of received/sent requests:
func NewClientRequestsTotalStatsHandler(*prometheus.GaugeVec, ...StatsHandlerOption) *ClientRequestsTotalStatsHandler func NewServerRequestsTotalStatsHandler(*prometheus.GaugeVec, ...StatsHandlerOption) *ServerRequestsTotalStatsHandler
Above all, there is a coordinator. StatsHandler combines multiple stats handlers into a single instance.
Metrics ¶
The package comes with eighteen predefined metrics — nine for server and nine for client side:
grpc_client_connections grpc_client_message_received_size_histogram_bytes grpc_client_message_sent_size_histogram_bytes grpc_client_messages_received_total grpc_client_messages_sent_total grpc_client_request_duration_histogram_seconds grpc_client_requests_in_flight grpc_client_requests_sent_total grpc_client_responses_received_total grpc_server_connections grpc_server_message_received_size_histogram_bytes grpc_server_message_sent_size_histogram_bytes grpc_server_messages_received_total grpc_server_messages_sent_total grpc_server_request_duration_histogram_seconds grpc_server_requests_in_flight grpc_server_requests_received_total grpc_server_responses_sent_total
Configuration ¶
The package does not require any configuration whatsoever but makes it possible. It is beneficial for different reasons.
Having all metrics enabled could not be desirable. Some, like histograms, can create significant overhead on the producer side. If performance is critical, it advisable to reduce the set of metrics. To do that, implement a custom version of coordinator constructor, ClientStatsHandler and/or ServerStatsHandler.
Another good reason to change default settings is backward compatibility. Migration of Grafana dashboards is not an easy nor quick task. If the discrepancy is small and, e.g. the only necessary adjustment is changing the namespace, it is achievable by passing CollectorWithNamespace to a collector constructor. It is the same very known pattern from the gRPC package, with some enhancements. What makes it different is that both StatsHandlerOption and CollectorOption have a shareable variant, called ShareableCollectorOption and ShareableStatsHandlerOption respectively. Thanks to that, it is possible to pass options related to stats handlers and collectors to coordinator constructors. Constructors take care of moving options to the correct receivers.
Mixing both strategies described above will give even greater freedom. However, if that is even not enough, it is possible to reimplement an entire stack for a given metric or metrics.
Example ¶
reg := prometheus.NewRegistry() ssh := promgrpc.ServerStatsHandler( promgrpc.CollectorWithNamespace("example"), promgrpc.CollectorWithConstLabels(prometheus.Labels{"service": "foo"}), ) csh := promgrpc.ClientStatsHandler( promgrpc.CollectorWithConstLabels(prometheus.Labels{"service": "bar"}), ) srv := grpc.NewServer(grpc.StatsHandler(ssh)) imp := newDemoServer() test.RegisterTestServiceServer(srv, imp) reg.MustRegister(ssh) reg.MustRegister(csh)
Output:
Index ¶
- func NewClientConnectionsGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
- func NewClientMessageReceivedSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
- func NewClientMessageSentSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
- func NewClientMessagesReceivedTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewClientMessagesSentTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewClientRequestDurationHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
- func NewClientRequestsInFlightGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
- func NewClientRequestsTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewClientResponsesTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewServerConnectionsGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
- func NewServerMessageReceivedSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
- func NewServerMessageSentSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
- func NewServerMessagesReceivedTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewServerMessagesSentTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewServerRequestDurationHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
- func NewServerRequestsInFlightGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
- func NewServerRequestsTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- func NewServerResponsesTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
- type ClientConnectionsStatsHandler
- func (h *ClientConnectionsStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientConnectionsStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientConnectionsStatsHandler) HandleConn(ctx context.Context, stat stats.ConnStats)
- func (h *ClientConnectionsStatsHandler) HandleRPC(_ context.Context, _ stats.RPCStats)
- func (h *ClientConnectionsStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientConnectionsStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientMessageReceivedSizeStatsHandler
- func (h *ClientMessageReceivedSizeStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientMessageReceivedSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientMessageReceivedSizeStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientMessageReceivedSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientMessageReceivedSizeStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientMessageReceivedSizeStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientMessageSentSizeStatsHandler
- func (h *ClientMessageSentSizeStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientMessageSentSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientMessageSentSizeStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientMessageSentSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientMessageSentSizeStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientMessageSentSizeStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientMessagesReceivedTotalStatsHandler
- func (h *ClientMessagesReceivedTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientMessagesReceivedTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientMessagesReceivedTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientMessagesReceivedTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientMessagesReceivedTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientMessagesReceivedTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientMessagesSentTotalStatsHandler
- func (h *ClientMessagesSentTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientMessagesSentTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientMessagesSentTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientMessagesSentTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientMessagesSentTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientMessagesSentTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientRequestDurationStatsHandler
- func (h *ClientRequestDurationStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientRequestDurationStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientRequestDurationStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientRequestDurationStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientRequestDurationStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientRequestDurationStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientRequestsInFlightStatsHandler
- func (h *ClientRequestsInFlightStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientRequestsInFlightStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientRequestsInFlightStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientRequestsInFlightStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientRequestsInFlightStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientRequestsInFlightStatsHandler) TagRPC(ctx context.Context, inf *stats.RPCTagInfo) context.Context
- type ClientRequestsTotalStatsHandler
- func (h *ClientRequestsTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientRequestsTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientRequestsTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientRequestsTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientRequestsTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientRequestsTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ClientResponsesTotalStatsHandler
- func (h *ClientResponsesTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ClientResponsesTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ClientResponsesTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ClientResponsesTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ClientResponsesTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ClientResponsesTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type CollectorOption
- type HandleRPCLabelFunc
- type ServerConnectionsStatsHandler
- func (h *ServerConnectionsStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerConnectionsStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerConnectionsStatsHandler) HandleConn(ctx context.Context, stat stats.ConnStats)
- func (h *ServerConnectionsStatsHandler) HandleRPC(_ context.Context, _ stats.RPCStats)
- func (h *ServerConnectionsStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerConnectionsStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerMessageReceivedSizeStatsHandler
- func (h *ServerMessageReceivedSizeStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerMessageReceivedSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerMessageReceivedSizeStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerMessageReceivedSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerMessageReceivedSizeStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerMessageReceivedSizeStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerMessageSentSizeStatsHandler
- func (h *ServerMessageSentSizeStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerMessageSentSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerMessageSentSizeStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerMessageSentSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerMessageSentSizeStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerMessageSentSizeStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerMessagesReceivedTotalStatsHandler
- func (h *ServerMessagesReceivedTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerMessagesReceivedTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerMessagesReceivedTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerMessagesReceivedTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerMessagesReceivedTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerMessagesReceivedTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerMessagesSentTotalStatsHandler
- func (h *ServerMessagesSentTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerMessagesSentTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerMessagesSentTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerMessagesSentTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerMessagesSentTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerMessagesSentTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerRequestDurationStatsHandler
- func (h *ServerRequestDurationStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerRequestDurationStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerRequestDurationStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerRequestDurationStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerRequestDurationStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerRequestDurationStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerRequestsInFlightStatsHandler
- func (h *ServerRequestsInFlightStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerRequestsInFlightStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerRequestsInFlightStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerRequestsInFlightStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerRequestsInFlightStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerRequestsInFlightStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerRequestsTotalStatsHandler
- func (h *ServerRequestsTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerRequestsTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerRequestsTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerRequestsTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerRequestsTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerRequestsTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ServerResponsesTotalStatsHandler
- func (h *ServerResponsesTotalStatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *ServerResponsesTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *ServerResponsesTotalStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *ServerResponsesTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *ServerResponsesTotalStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (h *ServerResponsesTotalStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type ShareableCollectorOption
- type ShareableOption
- type ShareableStatsHandlerOption
- type StatsHandler
- func (h *StatsHandler) Collect(in chan<- prometheus.Metric)
- func (h *StatsHandler) Describe(in chan<- *prometheus.Desc)
- func (h *StatsHandler) HandleConn(ctx context.Context, sts stats.ConnStats)
- func (h *StatsHandler) HandleRPC(ctx context.Context, sts stats.RPCStats)
- func (h *StatsHandler) TagConn(ctx context.Context, inf *stats.ConnTagInfo) context.Context
- func (h *StatsHandler) TagRPC(ctx context.Context, inf *stats.RPCTagInfo) context.Context
- type StatsHandlerCollector
- type StatsHandlerOption
- type TagRPCLabelFunc
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientConnectionsGaugeVec ¶
func NewClientConnectionsGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
func NewClientMessageReceivedSizeHistogramVec ¶
func NewClientMessageReceivedSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
func NewClientMessageSentSizeHistogramVec ¶
func NewClientMessageSentSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
func NewClientMessagesReceivedTotalCounterVec ¶
func NewClientMessagesReceivedTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
func NewClientMessagesSentTotalCounterVec ¶
func NewClientMessagesSentTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
func NewClientRequestDurationHistogramVec ¶
func NewClientRequestDurationHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
func NewClientRequestsInFlightGaugeVec ¶
func NewClientRequestsInFlightGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
func NewClientRequestsTotalCounterVec ¶
func NewClientRequestsTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
func NewClientResponsesTotalCounterVec ¶
func NewClientResponsesTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
NewClientResponsesTotalCounterVec allocates a new Prometheus CounterVec for the client and given set of options.
func NewServerConnectionsGaugeVec ¶
func NewServerConnectionsGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
func NewServerMessageReceivedSizeHistogramVec ¶
func NewServerMessageReceivedSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
func NewServerMessageSentSizeHistogramVec ¶
func NewServerMessageSentSizeHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
func NewServerMessagesReceivedTotalCounterVec ¶
func NewServerMessagesReceivedTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
func NewServerMessagesSentTotalCounterVec ¶
func NewServerMessagesSentTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
func NewServerRequestDurationHistogramVec ¶
func NewServerRequestDurationHistogramVec(opts ...CollectorOption) *prometheus.HistogramVec
func NewServerRequestsInFlightGaugeVec ¶
func NewServerRequestsInFlightGaugeVec(opts ...CollectorOption) *prometheus.GaugeVec
func NewServerRequestsTotalCounterVec ¶
func NewServerRequestsTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
func NewServerResponsesTotalCounterVec ¶
func NewServerResponsesTotalCounterVec(opts ...CollectorOption) *prometheus.CounterVec
NewServerResponsesTotalCounterVec allocates a new Prometheus CounterVec for the server and given set of options.
Types ¶
type ClientConnectionsStatsHandler ¶
type ClientConnectionsStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientConnectionsStatsHandler ¶
func NewClientConnectionsStatsHandler(vec *prometheus.GaugeVec) *ClientConnectionsStatsHandler
NewClientConnectionsStatsHandler ...
func (*ClientConnectionsStatsHandler) Collect ¶
func (h *ClientConnectionsStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientConnectionsStatsHandler) Describe ¶
func (h *ClientConnectionsStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientConnectionsStatsHandler) HandleConn ¶
func (h *ClientConnectionsStatsHandler) HandleConn(ctx context.Context, stat stats.ConnStats)
HandleConn HandleRPC processes the RPC stats.
type ClientMessageReceivedSizeStatsHandler ¶
type ClientMessageReceivedSizeStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientMessageReceivedSizeStatsHandler ¶
func NewClientMessageReceivedSizeStatsHandler(vec prometheus.ObserverVec, opts ...StatsHandlerOption) *ClientMessageReceivedSizeStatsHandler
NewMessageReceivedSizeStatsHandler ...
func (*ClientMessageReceivedSizeStatsHandler) Collect ¶
func (h *ClientMessageReceivedSizeStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientMessageReceivedSizeStatsHandler) Describe ¶
func (h *ClientMessageReceivedSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientMessageReceivedSizeStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientMessageReceivedSizeStatsHandler) HandleRPC ¶
func (h *ClientMessageReceivedSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ClientMessageSentSizeStatsHandler ¶
type ClientMessageSentSizeStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientMessageSentSizeStatsHandler ¶
func NewClientMessageSentSizeStatsHandler(vec prometheus.ObserverVec, opts ...StatsHandlerOption) *ClientMessageSentSizeStatsHandler
NewMessageSentSizeStatsHandler ...
func (*ClientMessageSentSizeStatsHandler) Collect ¶
func (h *ClientMessageSentSizeStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientMessageSentSizeStatsHandler) Describe ¶
func (h *ClientMessageSentSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientMessageSentSizeStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientMessageSentSizeStatsHandler) HandleRPC ¶
func (h *ClientMessageSentSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ClientMessagesReceivedTotalStatsHandler ¶
type ClientMessagesReceivedTotalStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientMessagesReceivedTotalStatsHandler ¶
func NewClientMessagesReceivedTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ClientMessagesReceivedTotalStatsHandler
NewClientMessagesReceivedTotalStatsHandler ... The GaugeVec must have zero, one, two, three or four non-const non-curried labels. For those, the only allowed labelsFn names are "fail_fast", "handler", "service" and "user_agent".
func (*ClientMessagesReceivedTotalStatsHandler) Collect ¶
func (h *ClientMessagesReceivedTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientMessagesReceivedTotalStatsHandler) Describe ¶
func (h *ClientMessagesReceivedTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientMessagesReceivedTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientMessagesReceivedTotalStatsHandler) HandleRPC ¶
func (h *ClientMessagesReceivedTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ClientMessagesSentTotalStatsHandler ¶
type ClientMessagesSentTotalStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientMessagesSentTotalStatsHandler ¶
func NewClientMessagesSentTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ClientMessagesSentTotalStatsHandler
NewClientMessagesSentTotalStatsHandler ... The GaugeVec must have zero, one, two, three or four non-const non-curried labels. For those, the only allowed labelsFn names are "fail_fast", "handler", "service".
func (*ClientMessagesSentTotalStatsHandler) Collect ¶
func (h *ClientMessagesSentTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientMessagesSentTotalStatsHandler) Describe ¶
func (h *ClientMessagesSentTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientMessagesSentTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientMessagesSentTotalStatsHandler) HandleRPC ¶
func (h *ClientMessagesSentTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ClientRequestDurationStatsHandler ¶
type ClientRequestDurationStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientRequestDurationStatsHandler ¶
func NewClientRequestDurationStatsHandler(vec prometheus.ObserverVec, opts ...StatsHandlerOption) *ClientRequestDurationStatsHandler
NewClientRequestDurationStatsHandler ...
func (*ClientRequestDurationStatsHandler) Collect ¶
func (h *ClientRequestDurationStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientRequestDurationStatsHandler) Describe ¶
func (h *ClientRequestDurationStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientRequestDurationStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientRequestDurationStatsHandler) HandleRPC ¶
func (h *ClientRequestDurationStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC processes the RPC stats.
type ClientRequestsInFlightStatsHandler ¶
type ClientRequestsInFlightStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientRequestsInFlightStatsHandler ¶
func NewClientRequestsInFlightStatsHandler(vec *prometheus.GaugeVec, opts ...StatsHandlerOption) *ClientRequestsInFlightStatsHandler
NewClientRequestsInFlightStatsHandler ...
func (*ClientRequestsInFlightStatsHandler) Collect ¶
func (h *ClientRequestsInFlightStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientRequestsInFlightStatsHandler) Describe ¶
func (h *ClientRequestsInFlightStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientRequestsInFlightStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientRequestsInFlightStatsHandler) HandleRPC ¶
func (h *ClientRequestsInFlightStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC processes the RPC stats.
func (*ClientRequestsInFlightStatsHandler) TagConn ¶
func (h *ClientRequestsInFlightStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
TagConn implements stats Handler interface.
func (*ClientRequestsInFlightStatsHandler) TagRPC ¶
func (h *ClientRequestsInFlightStatsHandler) TagRPC(ctx context.Context, inf *stats.RPCTagInfo) context.Context
type ClientRequestsTotalStatsHandler ¶
type ClientRequestsTotalStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientRequestsTotalStatsHandler ¶
func NewClientRequestsTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ClientRequestsTotalStatsHandler
NewClientRequestsTotalStatsHandler ... The GaugeVec must have zero, one, two, three or four non-const non-curried labels. For those, the only allowed labelsFn names are "fail_fast", "handler", "service".
func (*ClientRequestsTotalStatsHandler) Collect ¶
func (h *ClientRequestsTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientRequestsTotalStatsHandler) Describe ¶
func (h *ClientRequestsTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientRequestsTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientRequestsTotalStatsHandler) HandleRPC ¶
func (h *ClientRequestsTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ClientResponsesTotalStatsHandler ¶
type ClientResponsesTotalStatsHandler struct {
// contains filtered or unexported fields
}
ClientResponsesTotalStatsHandler is responsible for counting number of incoming (server side) or outgoing (client side) requests.
func NewClientResponsesTotalStatsHandler ¶
func NewClientResponsesTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ClientResponsesTotalStatsHandler
NewClientResponsesTotalStatsHandler ...
func (*ClientResponsesTotalStatsHandler) Collect ¶
func (h *ClientResponsesTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ClientResponsesTotalStatsHandler) Describe ¶
func (h *ClientResponsesTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ClientResponsesTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ClientResponsesTotalStatsHandler) HandleRPC ¶
func (h *ClientResponsesTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type CollectorOption ¶
type CollectorOption interface {
// contains filtered or unexported methods
}
CollectorOption configures a collector.
type HandleRPCLabelFunc ¶
HandleRPCLabelFunc type represents a function signature that can be passed into a stats handler and used instead of default one. That way caller gets the ability to modify the way labels are assembled.
type ServerConnectionsStatsHandler ¶
type ServerConnectionsStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerConnectionsStatsHandler ¶
func NewServerConnectionsStatsHandler(vec *prometheus.GaugeVec) *ServerConnectionsStatsHandler
NewConnectionsStatsHandler ...
func (*ServerConnectionsStatsHandler) Collect ¶
func (h *ServerConnectionsStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerConnectionsStatsHandler) Describe ¶
func (h *ServerConnectionsStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerConnectionsStatsHandler) HandleConn ¶
func (h *ServerConnectionsStatsHandler) HandleConn(ctx context.Context, stat stats.ConnStats)
HandleRPC processes the RPC stats.
type ServerMessageReceivedSizeStatsHandler ¶
type ServerMessageReceivedSizeStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerMessageReceivedSizeStatsHandler ¶
func NewServerMessageReceivedSizeStatsHandler(vec prometheus.ObserverVec, opts ...StatsHandlerOption) *ServerMessageReceivedSizeStatsHandler
NewServerMessageReceivedSizeStatsHandler ...
func (*ServerMessageReceivedSizeStatsHandler) Collect ¶
func (h *ServerMessageReceivedSizeStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerMessageReceivedSizeStatsHandler) Describe ¶
func (h *ServerMessageReceivedSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerMessageReceivedSizeStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerMessageReceivedSizeStatsHandler) HandleRPC ¶
func (h *ServerMessageReceivedSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ServerMessageSentSizeStatsHandler ¶
type ServerMessageSentSizeStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerMessageSentSizeStatsHandler ¶
func NewServerMessageSentSizeStatsHandler(vec prometheus.ObserverVec, opts ...StatsHandlerOption) *ServerMessageSentSizeStatsHandler
NewServerMessageSentSizeStatsHandler ...
func (*ServerMessageSentSizeStatsHandler) Collect ¶
func (h *ServerMessageSentSizeStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerMessageSentSizeStatsHandler) Describe ¶
func (h *ServerMessageSentSizeStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerMessageSentSizeStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerMessageSentSizeStatsHandler) HandleRPC ¶
func (h *ServerMessageSentSizeStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ServerMessagesReceivedTotalStatsHandler ¶
type ServerMessagesReceivedTotalStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerMessagesReceivedTotalStatsHandler ¶
func NewServerMessagesReceivedTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ServerMessagesReceivedTotalStatsHandler
NewServerMessagesReceivedTotalStatsHandler ... The GaugeVec must have zero, one, two, three or four non-const non-curried labels. For those, the only allowed labelsFn names are "fail_fast", "handler", "service" and "user_agent".
func (*ServerMessagesReceivedTotalStatsHandler) Collect ¶
func (h *ServerMessagesReceivedTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerMessagesReceivedTotalStatsHandler) Describe ¶
func (h *ServerMessagesReceivedTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerMessagesReceivedTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerMessagesReceivedTotalStatsHandler) HandleRPC ¶
func (h *ServerMessagesReceivedTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ServerMessagesSentTotalStatsHandler ¶
type ServerMessagesSentTotalStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerMessagesSentTotalStatsHandler ¶
func NewServerMessagesSentTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ServerMessagesSentTotalStatsHandler
NewServerMessagesSentTotalStatsHandler ... The GaugeVec must have zero, one, two, three or four non-const non-curried labels. For those, the only allowed labelsFn names are "fail_fast", "handler", "service".
func (*ServerMessagesSentTotalStatsHandler) Collect ¶
func (h *ServerMessagesSentTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerMessagesSentTotalStatsHandler) Describe ¶
func (h *ServerMessagesSentTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerMessagesSentTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerMessagesSentTotalStatsHandler) HandleRPC ¶
func (h *ServerMessagesSentTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ServerRequestDurationStatsHandler ¶
type ServerRequestDurationStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerRequestDurationStatsHandler ¶
func NewServerRequestDurationStatsHandler(vec prometheus.ObserverVec, opts ...StatsHandlerOption) *ServerRequestDurationStatsHandler
NewServerRequestDurationStatsHandler ...
func (*ServerRequestDurationStatsHandler) Collect ¶
func (h *ServerRequestDurationStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerRequestDurationStatsHandler) Describe ¶
func (h *ServerRequestDurationStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerRequestDurationStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerRequestDurationStatsHandler) HandleRPC ¶
func (h *ServerRequestDurationStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC processes the RPC stats.
type ServerRequestsInFlightStatsHandler ¶
type ServerRequestsInFlightStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerRequestsInFlightStatsHandler ¶
func NewServerRequestsInFlightStatsHandler(vec *prometheus.GaugeVec, opts ...StatsHandlerOption) *ServerRequestsInFlightStatsHandler
NewServerRequestsInFlightStatsHandler ...
func (*ServerRequestsInFlightStatsHandler) Collect ¶
func (h *ServerRequestsInFlightStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerRequestsInFlightStatsHandler) Describe ¶
func (h *ServerRequestsInFlightStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerRequestsInFlightStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerRequestsInFlightStatsHandler) HandleRPC ¶
func (h *ServerRequestsInFlightStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC processes the RPC stats.
type ServerRequestsTotalStatsHandler ¶
type ServerRequestsTotalStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerRequestsTotalStatsHandler ¶
func NewServerRequestsTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ServerRequestsTotalStatsHandler
NewServerRequestsTotalStatsHandler ... The GaugeVec must have zero, one, two, three or four non-const non-curried labels. For those, the only allowed labelsFn names are "fail_fast", "handler", "service".
func (*ServerRequestsTotalStatsHandler) Collect ¶
func (h *ServerRequestsTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerRequestsTotalStatsHandler) Describe ¶
func (h *ServerRequestsTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerRequestsTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerRequestsTotalStatsHandler) HandleRPC ¶
func (h *ServerRequestsTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ServerResponsesTotalStatsHandler ¶
type ServerResponsesTotalStatsHandler struct {
// contains filtered or unexported fields
}
ServerResponsesTotalStatsHandler is responsible for counting number of incoming (server side) or outgoing (client side) requests.
func NewServerResponsesTotalStatsHandler ¶
func NewServerResponsesTotalStatsHandler(vec *prometheus.CounterVec, opts ...StatsHandlerOption) *ServerResponsesTotalStatsHandler
NewServerResponsesTotalStatsHandler ...
func (*ServerResponsesTotalStatsHandler) Collect ¶
func (h *ServerResponsesTotalStatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*ServerResponsesTotalStatsHandler) Describe ¶
func (h *ServerResponsesTotalStatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*ServerResponsesTotalStatsHandler) HandleConn ¶
HandleConn implements stats Handler interface.
func (*ServerResponsesTotalStatsHandler) HandleRPC ¶
func (h *ServerResponsesTotalStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
HandleRPC implements stats Handler interface.
type ShareableCollectorOption ¶
type ShareableCollectorOption interface { ShareableOption CollectorOption }
ShareableCollectorOption is CollectorOption extended with shareable capability.
func CollectorWithConstLabels ¶
func CollectorWithConstLabels(constLabels prometheus.Labels) ShareableCollectorOption
CollectorWithConstLabels returns a ShareableCollectorOption which adds a set of constant labels to a collector.
func CollectorWithNamespace ¶
func CollectorWithNamespace(namespace string) ShareableCollectorOption
CollectorWithNamespace returns a ShareableCollectorOption which sets namespace of a collector.
func CollectorWithUserAgent ¶
func CollectorWithUserAgent(name, version string) ShareableCollectorOption
CollectorWithUserAgent ...
type ShareableOption ¶
type ShareableOption interface {
// contains filtered or unexported methods
}
ShareableOption is a simple wrapper for shareable method. It makes it possible to distinguish options reserved for direct usage, from those that are applicable on a set of objects.
type ShareableStatsHandlerOption ¶
type ShareableStatsHandlerOption interface { ShareableOption StatsHandlerOption }
ShareableStatsHandlerOption is StatsHandlerOption extended with shareable capability.
type StatsHandler ¶
type StatsHandler struct {
// contains filtered or unexported fields
}
StatsHandler wraps set of stats handlers and coordinate their execution. Additionally, it tags RPC requests with a common set of labels. That way it reduces context manipulation overhead and improves overall performance.
func ClientStatsHandler ¶
func ClientStatsHandler(opts ...ShareableOption) *StatsHandler
ClientStatsHandler instantiates a default client-side coordinator together with every metric specific stats handler provided by this package.
func NewStatsHandler ¶
func NewStatsHandler(handlers ...StatsHandlerCollector) *StatsHandler
NewStatsHandler allocates a new coordinator. It allows passing a various number of handlers that later it will iterate through.
func ServerStatsHandler ¶
func ServerStatsHandler(opts ...ShareableOption) *StatsHandler
ServerStatsHandler instantiates a default server-side coordinator together with every metric specific stats handler provided by this package.
func (*StatsHandler) Collect ¶
func (h *StatsHandler) Collect(in chan<- prometheus.Metric)
Collect implements prometheus Collector interface.
func (*StatsHandler) Describe ¶
func (h *StatsHandler) Describe(in chan<- *prometheus.Desc)
Describe implements prometheus Collector interface.
func (*StatsHandler) HandleConn ¶
func (h *StatsHandler) HandleConn(ctx context.Context, sts stats.ConnStats)
HandleConn implements stats Handler interface.
func (*StatsHandler) HandleRPC ¶
func (h *StatsHandler) HandleRPC(ctx context.Context, sts stats.RPCStats)
HandleRPC implements stats Handler interface.
func (*StatsHandler) TagConn ¶
func (h *StatsHandler) TagConn(ctx context.Context, inf *stats.ConnTagInfo) context.Context
TagConn implements stats Handler interface.
func (*StatsHandler) TagRPC ¶
func (h *StatsHandler) TagRPC(ctx context.Context, inf *stats.RPCTagInfo) context.Context
TagRPC implements stats Handler interface.
type StatsHandlerCollector ¶
type StatsHandlerCollector interface { stats.Handler prometheus.Collector }
StatsHandlerCollector is a simple wrapper for stats Handler and prometheus Collector interfaces.
type StatsHandlerOption ¶
type StatsHandlerOption interface {
// contains filtered or unexported methods
}
StatsHandlerOption configures a stats handler behaviour.
func StatsHandlerWithHandleRPCLabelsFunc ¶
func StatsHandlerWithHandleRPCLabelsFunc(fn HandleRPCLabelFunc) StatsHandlerOption
StatsHandlerWithHandleRPCLabelsFunc allows to inject custom HandleRPCLabelFunc to a stats handler. It is not shareable because there little to no chance that all stats handlers need the same set of labels.
func StatsHandlerWithTagRPCLabelsFunc ¶
func StatsHandlerWithTagRPCLabelsFunc(fn TagRPCLabelFunc) StatsHandlerOption
StatsHandlerWithTagRPCLabelsFunc allows to inject custom TagRPCLabelFunc to a stats handler. It is not shareable because of performance reasons. If all stats handlers require the same set of additional labels, it is better to implement a custom coordinator (e.g. by embedding StatsHandler) with self-defined TagRPC method. That way, it is guaranteed that new tagging execute only once and default implementation be overridden.
type TagRPCLabelFunc ¶
Source Files
¶
- collector.go
- doc.go
- label.go
- metric_client_connections.go
- metric_client_message_received_size_histogram_bytes.go
- metric_client_message_sent_size_histogram_bytes.go
- metric_client_messages_received_total.go
- metric_client_messages_sent_total.go
- metric_client_request_duration_histogram_seconds.go
- metric_client_requests_in_flight.go
- metric_client_requests_total.go
- metric_client_responses_total.go
- metric_server_connections.go
- metric_server_message_received_size_histogram_bytes.go
- metric_server_message_sent_size_histogram_bytes.go
- metric_server_messages_received_total.go
- metric_server_messages_sent_total.go
- metric_server_request_duration_histogram_seconds.go
- metric_server_requests_in_flight.go
- metric_server_requests_total.go
- metric_server_responses_total.go
- options.go
- promgrpc.go
- stats_handler.go