metrics: add histogram support

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2022-03-12 00:42:36 +01:00
parent d61f0e9d76
commit 8e490c0bae
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF

View File

@ -22,6 +22,7 @@ type ServerInterceptors interface {
Registerer Registerer
interceptors.ServerInterceptors interceptors.ServerInterceptors
prometheus.Collector prometheus.Collector
EnableHandlingTimeHistogram(opts ...grpc_prometheus.HistogramOption)
} }
type ClientInterceptors interface { type ClientInterceptors interface {
@ -33,6 +34,12 @@ type metrics struct {
c *grpc_prometheus.ClientMetrics c *grpc_prometheus.ClientMetrics
} }
func (m *metrics) EnableHandlingTimeHistogram(opts ...grpc_prometheus.HistogramOption) {
if m.s != nil {
m.s.EnableHandlingTimeHistogram(opts...)
}
}
func (m *metrics) Describe(descs chan<- *prometheus.Desc) { func (m *metrics) Describe(descs chan<- *prometheus.Desc) {
if m.s != nil { if m.s != nil {
m.s.Describe(descs) m.s.Describe(descs)