package stats

import "google.golang.org/grpc/internal/stats"

Package stats provides internal stats related functionality.

Index

Functions

func SetLabels

func SetLabels(ctx context.Context, labels *Labels) context.Context

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

func GetLabels(ctx context.Context) *Labels

GetLabels returns the Labels stored in the context, or nil if there is one.

type MetricsRecorderList

type MetricsRecorderList struct {
	// 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.

Source Files

labels.go metrics_recorder_list.go

Version
v1.70.0 (latest)
Published
Jan 23, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
5 minutes ago

Tools for package owners.