createGauge<T extends num> method

APIGauge<T> createGauge<T extends num>({
  1. required String name,
  2. String? unit,
  3. String? description,
})

Creates a Gauge with the given name.

A Gauge is a synchronous Instrument which can be used to record non-additive value(s) when changes occur.

name The name of the instrument unit Optional unit of the instrument (e.g., "ms" for milliseconds) description Optional description of the instrument

Implementation

APIGauge<T> createGauge<T extends num>({
  required String name,
  String? unit,
  String? description,
}) {
  if (name.isEmpty) {
    throw ArgumentError('Gauge name must not be empty');
  }

  return GaugeCreate.create<T>(
    name: name,
    unit: unit,
    description: description,
    enabled: enabled,
    meter: this,
  );
}