From 6e09a15e21b6949dc7d3b897b2f7f93d69c63336 Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Fri, 13 Dec 2024 11:24:39 -0800 Subject: [PATCH] experimental/stats: re-add type aliases for migration (#7929) --- experimental/stats/metrics.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/experimental/stats/metrics.go b/experimental/stats/metrics.go index bf9e7f987b04..ee1423605ab4 100644 --- a/experimental/stats/metrics.go +++ b/experimental/stats/metrics.go @@ -19,6 +19,8 @@ // Package stats contains experimental metrics/stats API's. package stats +import "google.golang.org/grpc/stats" + // MetricsRecorder records on metrics derived from metric registry. type MetricsRecorder interface { // RecordInt64Count records the measurement alongside labels on the int @@ -37,3 +39,16 @@ type MetricsRecorder interface { // gauge associated with the provided handle. RecordInt64Gauge(handle *Int64GaugeHandle, incr int64, labels ...string) } + +// Metrics is an experimental legacy alias of the now-stable stats.MetricSet. +// Metrics will be deleted in a future release. +type Metrics = stats.MetricSet + +// Metric was replaced by direct usage of strings. +type Metric = string + +// NewMetrics is an experimental legacy alias of the now-stable +// stats.NewMetricSet. NewMetrics will be deleted in a future release. +func NewMetrics(metrics ...Metric) *Metrics { + return stats.NewMetricSet(metrics...) +}