Learn R Programming

otel (version 0.2.0)

counter_add: Increase an OpenTelemetry counter

Description

Increase an OpenTelemetry counter

Usage

counter_add(name, value = 1L, attributes = NULL, context = NULL, meter = NULL)

Value

The counter object (otel_counter), invisibly.

Arguments

name

Name of the counter.

value

Value to add to the counter, defaults to 1.

attributes

Additional attributes to add.

context

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

meter

Meter object (otel_meter). Otherwise it is passed to get_meter() to get a meter.

See Also

Other OpenTelemetry metrics instruments: gauge_record(), histogram_record(), up_down_counter_add()

Other OpenTelemetry metrics API: gauge_record(), histogram_record(), is_measuring_enabled(), up_down_counter_add()

Examples

Run this code
otel::counter_add("total-session-count", 1)

Run the code above in your browser using DataLab