package stats

Import Path
	google.golang.org/grpc/experimental/stats (on go.dev)

Dependency Relation
	imports 4 packages, and imported by 5 packages

Involved Source Files metricregistry.go Package stats contains experimental metrics/stats API's.
Package-Level Type Names (total 17)
/* sort by: | */
AsyncMetric is a marker interface for asynchronous metric types. ( AsyncMetric) Descriptor() *MetricDescriptor *Int64AsyncGaugeHandle func MetricsRecorder.RegisterAsyncReporter(reporter AsyncMetricReporter, descriptors ...AsyncMetric) func() func UnimplementedMetricsRecorder.RegisterAsyncReporter(AsyncMetricReporter, ...AsyncMetric) func() func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RegisterAsyncReporter(reporter AsyncMetricReporter, metrics ...AsyncMetric) func()
AsyncMetricReporter is an interface for types that record metrics asynchronously for the set of descriptors they are registered with. The AsyncMetricsRecorder parameter is used to record values for these metrics. Implementations must make unique recordings across all registered AsyncMetricReporters. Meaning, they should not report values for a metric with the same attributes as another AsyncMetricReporter will report. Implementations must be concurrent-safe. Report records metric values using the provided recorder. AsyncMetricReporterFunc func MetricsRecorder.RegisterAsyncReporter(reporter AsyncMetricReporter, descriptors ...AsyncMetric) func() func UnimplementedMetricsRecorder.RegisterAsyncReporter(AsyncMetricReporter, ...AsyncMetric) func() func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RegisterAsyncReporter(reporter AsyncMetricReporter, metrics ...AsyncMetric) func()
AsyncMetricReporterFunc is an adapter to allow the use of ordinary functions as AsyncMetricReporters. Report calls f(r). AsyncMetricReporterFunc : AsyncMetricReporter
AsyncMetricsRecorder records on asynchronous metrics derived from metric registry. RecordInt64AsyncGauge records the measurement alongside labels on the int count associated with the provided handle asynchronously func AsyncMetricReporter.Report(AsyncMetricsRecorder) error func AsyncMetricReporterFunc.Report(r AsyncMetricsRecorder) error func (*Int64AsyncGaugeHandle).Record(recorder AsyncMetricsRecorder, value int64, labels ...string)
Float64CountHandle is a typed handle for a float count metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the float64 count handle typecast to a pointer to a MetricDescriptor. Record records the float64 count value on the metrics recorder provided. func RegisterFloat64Count(descriptor MetricDescriptor) *Float64CountHandle func MetricsRecorder.RecordFloat64Count(handle *Float64CountHandle, incr float64, labels ...string) func UnimplementedMetricsRecorder.RecordFloat64Count(*Float64CountHandle, float64, ...string) func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RecordFloat64Count(handle *Float64CountHandle, incr float64, labels ...string)
Float64HistoHandle is a typed handle for a float histogram metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the float64 histo handle typecast to a pointer to a MetricDescriptor. Record records the float64 histo value on the metrics recorder provided. func RegisterFloat64Histo(descriptor MetricDescriptor) *Float64HistoHandle func MetricsRecorder.RecordFloat64Histo(handle *Float64HistoHandle, incr float64, labels ...string) func UnimplementedMetricsRecorder.RecordFloat64Histo(*Float64HistoHandle, float64, ...string) func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RecordFloat64Histo(handle *Float64HistoHandle, incr float64, labels ...string)
Int64AsyncGaugeHandle is a typed handle for an int gauge metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the int64 gauge handle typecast to a pointer to a MetricDescriptor. Record records the int64 gauge value on the metrics recorder provided. *Int64AsyncGaugeHandle : AsyncMetric func RegisterInt64AsyncGauge(descriptor MetricDescriptor) *Int64AsyncGaugeHandle func AsyncMetricsRecorder.RecordInt64AsyncGauge(handle *Int64AsyncGaugeHandle, incr int64, labels ...string)
Int64CountHandle is a typed handle for a int count metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the int64 count handle typecast to a pointer to a MetricDescriptor. Record records the int64 count value on the metrics recorder provided. func RegisterInt64Count(descriptor MetricDescriptor) *Int64CountHandle func MetricsRecorder.RecordInt64Count(handle *Int64CountHandle, incr int64, labels ...string) func UnimplementedMetricsRecorder.RecordInt64Count(*Int64CountHandle, int64, ...string) func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RecordInt64Count(handle *Int64CountHandle, incr int64, labels ...string)
Int64GaugeHandle is a typed handle for an int gauge metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the int64 gauge handle typecast to a pointer to a MetricDescriptor. Record records the int64 histo value on the metrics recorder provided. func RegisterInt64Gauge(descriptor MetricDescriptor) *Int64GaugeHandle func MetricsRecorder.RecordInt64Gauge(handle *Int64GaugeHandle, incr int64, labels ...string) func UnimplementedMetricsRecorder.RecordInt64Gauge(*Int64GaugeHandle, int64, ...string) func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RecordInt64Gauge(handle *Int64GaugeHandle, incr int64, labels ...string)
Int64HistoHandle is a typed handle for an int histogram metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the int64 histo handle typecast to a pointer to a MetricDescriptor. Record records the int64 histo value on the metrics recorder provided. func RegisterInt64Histo(descriptor MetricDescriptor) *Int64HistoHandle func MetricsRecorder.RecordInt64Histo(handle *Int64HistoHandle, incr int64, labels ...string) func UnimplementedMetricsRecorder.RecordInt64Histo(*Int64HistoHandle, int64, ...string) func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RecordInt64Histo(handle *Int64HistoHandle, incr int64, labels ...string)
Int64UpDownCountHandle is a typed handle for an int up-down counter metric. This handle is passed at the recording point in order to know which metric to record on. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. Descriptor returns the int64 up-down counter handle typecast to a pointer to a MetricDescriptor. Record records the int64 up-down counter value on the metrics recorder provided. The value 'v' can be positive to increment or negative to decrement. func RegisterInt64UpDownCount(descriptor MetricDescriptor) *Int64UpDownCountHandle func MetricsRecorder.RecordInt64UpDownCount(handle *Int64UpDownCountHandle, incr int64, labels ...string) func UnimplementedMetricsRecorder.RecordInt64UpDownCount(*Int64UpDownCountHandle, int64, ...string) func google.golang.org/grpc/internal/stats.(*MetricsRecorderList).RecordInt64UpDownCount(handle *Int64UpDownCountHandle, incr int64, labels ...string)
Metric was replaced by direct usage of strings.
MetricDescriptor is the data for a registered metric. Bounds are the bounds of this metric. This only applies to histogram metrics. If unset or set with length 0, stats handlers will fall back to default bounds. Whether this metric is on by default. The description of this metric. The required label keys for this metric. These are intended to metrics emitted from a stats handler. The name of this metric. This name must be unique across the whole binary (including any per call metrics). See https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions for metric naming conventions. The optional label keys for this metric. These are intended to attached to metrics emitted from a stats handler if configured. The type of metric. This is set by the metric registry, and not intended to be set by a component registering a metric. The unit (e.g. entries, seconds) of this metric. func DescriptorForMetric(metricName string) *MetricDescriptor func AsyncMetric.Descriptor() *MetricDescriptor func (*Float64CountHandle).Descriptor() *MetricDescriptor func (*Float64HistoHandle).Descriptor() *MetricDescriptor func (*Int64AsyncGaugeHandle).Descriptor() *MetricDescriptor func (*Int64CountHandle).Descriptor() *MetricDescriptor func (*Int64GaugeHandle).Descriptor() *MetricDescriptor func (*Int64HistoHandle).Descriptor() *MetricDescriptor func (*Int64UpDownCountHandle).Descriptor() *MetricDescriptor func RegisterFloat64Count(descriptor MetricDescriptor) *Float64CountHandle func RegisterFloat64Histo(descriptor MetricDescriptor) *Float64HistoHandle func RegisterInt64AsyncGauge(descriptor MetricDescriptor) *Int64AsyncGaugeHandle func RegisterInt64Count(descriptor MetricDescriptor) *Int64CountHandle func RegisterInt64Gauge(descriptor MetricDescriptor) *Int64GaugeHandle func RegisterInt64Histo(descriptor MetricDescriptor) *Int64HistoHandle func RegisterInt64UpDownCount(descriptor MetricDescriptor) *Int64UpDownCountHandle
Metrics is an experimental legacy alias of the now-stable stats.MetricSet. Metrics will be deleted in a future release.
MetricsRecorder records on metrics derived from metric registry. Implementors must embed UnimplementedMetricsRecorder. RecordFloat64Count records the measurement alongside labels on the float count associated with the provided handle. RecordFloat64Histo records the measurement alongside labels on the float histo associated with the provided handle. RecordInt64Count records the measurement alongside labels on the int count associated with the provided handle. RecordInt64Gauge records the measurement alongside labels on the int gauge associated with the provided handle. RecordInt64Histo records the measurement alongside labels on the int histo associated with the provided handle. RecordInt64UpDownCounter records the measurement alongside labels on the int count associated with the provided handle. RegisterAsyncReporter registers a reporter to produce metric values for only the listed descriptors. The returned function must be called when the metrics are no longer needed, which will remove the reporter. The returned method needs to be idempotent and concurrent safe. UnimplementedMetricsRecorder *google.golang.org/grpc/internal/stats.MetricsRecorderList MetricsRecorder : google.golang.org/grpc/internal.EnforceMetricsRecorderEmbedding func google.golang.org/grpc/balancer.ClientConn.MetricsRecorder() MetricsRecorder func (*Float64CountHandle).Record(recorder MetricsRecorder, incr float64, labels ...string) func (*Float64HistoHandle).Record(recorder MetricsRecorder, incr float64, labels ...string) func (*Int64CountHandle).Record(recorder MetricsRecorder, incr int64, labels ...string) func (*Int64GaugeHandle).Record(recorder MetricsRecorder, incr int64, labels ...string) func (*Int64HistoHandle).Record(recorder MetricsRecorder, incr int64, labels ...string) func (*Int64UpDownCountHandle).Record(recorder MetricsRecorder, v int64, labels ...string)
MetricType is the type of metric. const MetricTypeFloatCount const MetricTypeFloatHisto const MetricTypeIntAsyncGauge const MetricTypeIntCount const MetricTypeIntGauge const MetricTypeIntHisto const MetricTypeIntUpDownCount
UnimplementedMetricsRecorder must be embedded to have forward compatible implementations. EnforceMetricsRecorderEmbedding internal.EnforceMetricsRecorderEmbedding RecordFloat64Count provides a no-op implementation. RecordFloat64Histo provides a no-op implementation. RecordInt64Count provides a no-op implementation. RecordInt64Gauge provides a no-op implementation. RecordInt64Histo provides a no-op implementation. RecordInt64UpDownCount provides a no-op implementation. RegisterAsyncReporter provides a no-op implementation. UnimplementedMetricsRecorder : MetricsRecorder UnimplementedMetricsRecorder : google.golang.org/grpc/internal.EnforceMetricsRecorderEmbedding
Package-Level Functions (total 9)
DescriptorForMetric returns the MetricDescriptor from the global registry. Returns nil if MetricDescriptor not present.
NewMetrics is an experimental legacy alias of the now-stable stats.NewMetricSet. NewMetrics will be deleted in a future release.
RegisterFloat64Count registers the metric description onto the global registry. It returns a typed handle to use to recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
RegisterFloat64Histo registers the metric description onto the global registry. It returns a typed handle to use to recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
RegisterInt64AsyncGauge registers the metric description onto the global registry. It returns a typed handle to use for recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
RegisterInt64Count registers the metric description onto the global registry. It returns a typed handle to use to recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
RegisterInt64Gauge registers the metric description onto the global registry. It returns a typed handle to use to recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
RegisterInt64Histo registers the metric description onto the global registry. It returns a typed handle to use to recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
RegisterInt64UpDownCount registers the metric description onto the global registry. It returns a typed handle to use for recording data. NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple metrics are registered with the same name, this function will panic.
Package-Level Variables (only one)
DefaultMetrics are the default metrics registered through global metrics registry. This is written to at initialization time only, and is read only after initialization.
Package-Level Constants (total 7)
Type of metric supported by this instrument registry.
Type of metric supported by this instrument registry.
Type of metric supported by this instrument registry.
Type of metric supported by this instrument registry.
Type of metric supported by this instrument registry.
Type of metric supported by this instrument registry.
Type of metric supported by this instrument registry.