Documentation ¶
Index ¶
- Variables
- func AttrsFromRequest(req *http.Request, localAddress string) []attribute.KeyValue
- func AttrsFromResponse(resp *http.Response) []attribute.KeyValue
- func EnableClientHandledTimeHistogram(opts ...metric.Float64HistogramOption)
- func EnableClientStreamReceiveSizeHistogram(opts ...metric.Int64HistogramOption)
- func EnableClientStreamSendSizeHistogram(opts ...metric.Int64HistogramOption)
- func Meter() metric.Meter
- func ResetClientCounter(opts ...metric.InstrumentOption) error
- type ClientMetrics
- func (m *ClientMetrics) EnableClientHandledTimeHistogram(opts ...metric.Float64HistogramOption) (err error)
- func (m *ClientMetrics) EnableClientStreamReceiveSizeHistogram(opts ...metric.Int64HistogramOption) (err error)
- func (m *ClientMetrics) EnableClientStreamSendSizeHistogram(opts ...metric.Int64HistogramOption) (err error)
- func (m *ClientMetrics) ResetCounter(opts ...metric.InstrumentOption) (err error)
- func (m *ClientMetrics) UnaryClientInterceptor() ...
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultClientMetrics is the default instance of ClientMetrics. It is // intended to be used in conjunction the default Prometheus metrics // registry. DefaultClientMetrics = NewClientMetrics() // UnaryClientMetricInterceptor is a gRPC client-side interceptor that provides Metric monitoring for Unary RPCs. UnaryClientMetricInterceptor = DefaultClientMetrics.UnaryClientInterceptor() )
var ( // InstrumentationName is the name of this instrumentation package. InstrumentationName = "" /* 135-byte string literal not displayed */ // InstrumentationVersion is the version of this instrumentation package. InstrumentationVersion = otelcontrib.Version() // AttrsFilter is a filter before Report AttrsFilter = func(attrs ...attribute.KeyValue) []attribute.KeyValue { return attrs } )
Functions ¶
func AttrsFromRequest ¶
AttrsFromRequest generates attributes as specified by the OpenTelemetry specification for a span.
func AttrsFromResponse ¶
AttrsFromResponse generates attributes as specified by the OpenTelemetry specification for a span.
func EnableClientHandledTimeHistogram ¶
func EnableClientHandledTimeHistogram(opts ...metric.Float64HistogramOption)
EnableClientHandledTimeHistogram turns on recording of handling time of RPCs. Histogram metrics can be very expensive for Prometheus to retain and query. This function acts on the DefaultClientMetrics variable.
func EnableClientStreamReceiveSizeHistogram ¶
func EnableClientStreamReceiveSizeHistogram(opts ...metric.Int64HistogramOption)
EnableClientStreamReceiveSizeHistogram turns on recording of single message receive size of streaming RPCs. This function acts on the DefaultClientMetrics variable
func EnableClientStreamSendSizeHistogram ¶
func EnableClientStreamSendSizeHistogram(opts ...metric.Int64HistogramOption)
EnableClientStreamSendSizeHistogram turns on recording of single message receive size of streaming RPCs. This function acts on the DefaultClientMetrics variable
func ResetClientCounter ¶
func ResetClientCounter(opts ...metric.InstrumentOption) error
ResetClientCounter recreate recording of all counters of RPCs. This function acts on the DefaultClientMetrics variable.
Types ¶
type ClientMetrics ¶
type ClientMetrics struct { ClientHostport string // contains filtered or unexported fields }
ClientMetrics represents a collection of metrics to be registered on a Prometheus metrics registry for a gRPC client.
func NewClientMetrics ¶
func NewClientMetrics(opts ...metric.InstrumentOption) *ClientMetrics
NewClientMetrics returns a ClientMetrics object. Use a new instance of ClientMetrics when not using the default Prometheus metrics registry, for example when wanting to control which metrics are added to a registry as opposed to automatically adding metrics via init functions.
func (*ClientMetrics) EnableClientHandledTimeHistogram ¶
func (m *ClientMetrics) EnableClientHandledTimeHistogram(opts ...metric.Float64HistogramOption) (err error)
EnableClientHandledTimeHistogram turns on recording of handling time of RPCs. Histogram metrics can be very expensive for Prometheus to retain and query.
func (*ClientMetrics) EnableClientStreamReceiveSizeHistogram ¶
func (m *ClientMetrics) EnableClientStreamReceiveSizeHistogram(opts ...metric.Int64HistogramOption) (err error)
EnableClientStreamReceiveSizeHistogram turns on recording of single message receive size of streaming RPCs. Histogram metrics can be very expensive for Prometheus to retain and query.
func (*ClientMetrics) EnableClientStreamSendSizeHistogram ¶
func (m *ClientMetrics) EnableClientStreamSendSizeHistogram(opts ...metric.Int64HistogramOption) (err error)
EnableClientStreamSendSizeHistogram turns on recording of single message send size of streaming RPCs. Histogram metrics can be very expensive for Prometheus to retain and query.
func (*ClientMetrics) ResetCounter ¶
func (m *ClientMetrics) ResetCounter(opts ...metric.InstrumentOption) (err error)
ResetCounter recreate recording of all counters of RPCs.
func (*ClientMetrics) UnaryClientInterceptor ¶
func (m *ClientMetrics) UnaryClientInterceptor() func(req *http.Request, retry int, invoker http_.ClientInvoker, opts ...http_.DoWithBackoffOption) (resp *http.Response, err error)
UnaryClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Unary RPCs.