Collects metrics measurements in memory. This is useful for testing your instrumented R package or application.
with_otel_record() uses this meter provider.
Use with_otel_record() in your tests to record telemetry and check
that it is correct.
meter_provider_memory$new() returns an otel::otel_meter_provider
object. mp$get_metrics() returns a named list of recorded metrics.
meter_provider_memory$options() returns a named list, the current
values for all options.
mp <- meter_provider_memory$new(opts = NULL)
mp$get_metrics()
meter_provider_memory$options()
mp$get_metrics() erases the internal buffer of the meter provider.
opts: Named list of options. See below.
buffer_size: buffer size, this is the maximum number of spans or
metrics measurements that the provider can record.
Must be positive. Value is set from
the opts argument, or
the OTEL_R_EXPORTER_MEMORY_METRICS_BUFFER_SIZE environment variable, or
the OTEL_R_EXPORTER_MEMORY_BUFFER_SIZE environment variable, or
the default is 100.
export_interval: the time interval between the
start of two export attempts, in milliseconds. Value is set from
the opts argument, or
the OTEL_METRIC_EXPORT_INTERVAL environment variable, or
the default is 60000.
export_timeout: Maximum allowed time to export data, in
milliseconds. Value is set from
the opts argument, or
the OTEL_METRIC_EXPORT_TIMEOUT environment variable, or
the default is 30000.
aggregation_temporality: possible values:
"unspecified", "delta", "cumulative", "lowmemory". See the OpenTelemetry data model.
Value is set from
the opts argument, or
the OTEL_R_EXPORTER_OTLP_AGGREGATION_TEMPORALITY environment variable, or
the default is "cumulative".
meter_provider_memory$options()
Run the code above in your browser using DataLab