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 th
(descriptor MetricDescriptor)
| 314 | // an init() function), and is not thread-safe. If multiple metrics are |
| 315 | // registered with the same name, this function will panic. |
| 316 | func RegisterInt64AsyncGauge(descriptor MetricDescriptor) *Int64AsyncGaugeHandle { |
| 317 | registerMetric(descriptor.Name, descriptor.Default) |
| 318 | descriptor.Type = MetricTypeIntAsyncGauge |
| 319 | descPtr := &descriptor |
| 320 | metricsRegistry[descriptor.Name] = descPtr |
| 321 | return (*Int64AsyncGaugeHandle)(descPtr) |
| 322 | } |
| 323 | |
| 324 | // snapshotMetricsRegistryForTesting snapshots the global data of the metrics |
| 325 | // registry. Returns a cleanup function that sets the metrics registry to its |