Skip to content

Value

Not applicable.

Details

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

A histogram object is created by calling the create_histogram() method of an otel_meter_provider().

You can use the record() method to update the statistics with the specified amount.

In R histogram values are represented by doubles.

Methods

histogram$record()

Update the statistics with the specified amount.

Usage

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

Arguments

  • value: A numeric value to record.

  • attributes: Additional attributes to add.

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

Value

The histogram object itself, invisibly.

Examples

mp <- get_default_meter_provider()
mtr <- mp$get_meter()
hst <- mtr$create_histogram("response-time")
hst$record(1.123)