createObservableGauge<T extends num> method

APIObservableGauge<T> createObservableGauge<T extends num>({
  1. required String name,
  2. String? unit,
  3. String? description,
  4. ObservableCallback<T>? callback,
})

Creates an ObservableGauge with the given name.

An ObservableGauge is an asynchronous Instrument which reports non-additive value(s) when the instrument is being observed.

name The name of the instrument unit Optional unit of the instrument (e.g., "ms" for milliseconds) description Optional description of the instrument callback Optional callback to provide measurements when the instrument is observed

Implementation

APIObservableGauge<T> createObservableGauge<T extends num>({
  required String name,
  String? unit,
  String? description,
  ObservableCallback<T>? callback,
}) {
  if (name.isEmpty) {
    throw ArgumentError('ObservableGauge name must not be empty');
  }

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