package stats
import "google.golang.org/grpc/internal/stats"
Package stats provides internal stats related functionality.
Index ¶
- func NewCombinedHandler(handlers ...stats.Handler) stats.Handler
- func SetLabels(ctx context.Context, labels *Labels) context.Context
- type Labels
- type MetricsRecorderList
- func NewMetricsRecorderList(shs []stats.Handler) *MetricsRecorderList
- func (l *MetricsRecorderList) RecordFloat64Count(handle *estats.Float64CountHandle, incr float64, labels ...string)
- func (l *MetricsRecorderList) RecordFloat64Histo(handle *estats.Float64HistoHandle, incr float64, labels ...string)
- func (l *MetricsRecorderList) RecordInt64Count(handle *estats.Int64CountHandle, incr int64, labels ...string)
- func (l *MetricsRecorderList) RecordInt64Gauge(handle *estats.Int64GaugeHandle, incr int64, labels ...string)
- func (l *MetricsRecorderList) RecordInt64Histo(handle *estats.Int64HistoHandle, incr int64, labels ...string)
- func (l *MetricsRecorderList) RecordInt64UpDownCount(handle *estats.Int64UpDownCountHandle, incr int64, labels ...string)
- func (l *MetricsRecorderList) RegisterAsyncReporter(reporter estats.AsyncMetricReporter, metrics ...estats.AsyncMetric) func()
Functions ¶
func NewCombinedHandler ¶
NewCombinedHandler combines multiple stats.Handlers into a single handler.
It returns nil if no handlers are provided. If only one handler is provided, it is returned directly without wrapping.
func SetLabels ¶
SetLabels sets the Labels in the context.
Types ¶
type Labels ¶
type Labels struct {
// TelemetryLabels are the telemetry labels to record.
TelemetryLabels map[string]string
}
Labels are the labels for metrics.
func GetLabels ¶
GetLabels returns the Labels stored in the context, or nil if there is one.
type MetricsRecorderList ¶
type MetricsRecorderList struct {
internal.EnforceMetricsRecorderEmbedding
// contains filtered or unexported fields
}
MetricsRecorderList forwards Record calls to all of its metricsRecorders.
It eats any record calls where the label values provided do not match the number of label keys.
func NewMetricsRecorderList ¶
func NewMetricsRecorderList(shs []stats.Handler) *MetricsRecorderList
NewMetricsRecorderList creates a new metric recorder list with all the stats handlers provided which implement the MetricsRecorder interface. If no stats handlers provided implement the MetricsRecorder interface, the MetricsRecorder list returned is a no-op.
func (*MetricsRecorderList) RecordFloat64Count ¶
func (l *MetricsRecorderList) RecordFloat64Count(handle *estats.Float64CountHandle, incr float64, labels ...string)
RecordFloat64Count records the measurement alongside labels on the float count associated with the provided handle.
func (*MetricsRecorderList) RecordFloat64Histo ¶
func (l *MetricsRecorderList) RecordFloat64Histo(handle *estats.Float64HistoHandle, incr float64, labels ...string)
RecordFloat64Histo records the measurement alongside labels on the float histo associated with the provided handle.
func (*MetricsRecorderList) RecordInt64Count ¶
func (l *MetricsRecorderList) RecordInt64Count(handle *estats.Int64CountHandle, incr int64, labels ...string)
RecordInt64Count records the measurement alongside labels on the int count associated with the provided handle.
func (*MetricsRecorderList) RecordInt64Gauge ¶
func (l *MetricsRecorderList) RecordInt64Gauge(handle *estats.Int64GaugeHandle, incr int64, labels ...string)
RecordInt64Gauge records the measurement alongside labels on the int gauge associated with the provided handle.
func (*MetricsRecorderList) RecordInt64Histo ¶
func (l *MetricsRecorderList) RecordInt64Histo(handle *estats.Int64HistoHandle, incr int64, labels ...string)
RecordInt64Histo records the measurement alongside labels on the int histo associated with the provided handle.
func (*MetricsRecorderList) RecordInt64UpDownCount ¶
func (l *MetricsRecorderList) RecordInt64UpDownCount(handle *estats.Int64UpDownCountHandle, incr int64, labels ...string)
RecordInt64UpDownCount records the measurement alongside labels on the int count associated with the provided handle.
func (*MetricsRecorderList) RegisterAsyncReporter ¶
func (l *MetricsRecorderList) RegisterAsyncReporter(reporter estats.AsyncMetricReporter, metrics ...estats.AsyncMetric) func()
RegisterAsyncReporter forwards the registration to all underlying metrics recorders.
It returns a cleanup function that, when called, invokes the cleanup function returned by each underlying recorder, ensuring the reporter is unregistered from all of them.
Source Files ¶
labels.go metrics_recorder_list.go stats.go
- Version
- v1.82.0-dev
- Published
- Apr 15, 2026
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 37 minutes ago –
Tools for package owners.