Skip to content

Value

Not applicable.

Details

Usually you do not need to deal with otel_gauge objects directly. gauge_record() automatically sets up a meter and creates a gauge instrument, as needed.

A gauge object is created by calling the create_gauge() method of an otel_meter_provider().

You can use the record() method to record the current value.

In R gauge values are represented by doubles.

Methods

gauge$record()

Update the statistics with the specified amount.

Usage

gauge$record(value, attributes = NULL, span_context = NULL, ...)

Arguments

  • value: A numeric value. The current absolute value.

  • attributes: Additional attributes to add.

  • span_context: Span context. If missing, the active context is used, if any.

Value

The gauge object itself, invisibly.

Examples

mp <- get_default_meter_provider()
mtr <- mp$get_meter()
gge <- mtr$create_gauge("response-time")
gge$record(1.123)