Learn R Programming

otelsdk

OpenTelemetry SDK for R packages and projects

OpenTelemetry is an observability framework. OpenTelemetry is a collection of tools, APIs, and SDKs used to instrument, generate, collect, and export telemetry data such as metrics, logs, and traces, for analysis in order to understand your software’s performance and behavior.

For an introduction to OpenTelemetry, see the OpenTelemetry website docs.

To learn how to instrument your R code, see Getting Started in the otel package.

To learn how to collect telemetry data from an instrumented R package or project, see Collecting Telemetry Data.

For project status, installation instructions and more, read on.

Features

  • Lightweight packages. otel is a small R package without dependencies and compiled code. otelsdk needs a C++11 compiler and otel.
  • Minimal performance impact when tracing is disabled. otel functions do not evaluate their arguments in this case.
  • Zero-code instrumentation support. Add tracing to (some) functions of selected packages automatically.
  • Configuration via environment variables.
  • Minimal extra code. Add tracing to a function with a single extra function call.
  • Production mode: otel functions do not crash your production app in production mode.
  • Development mode: otel functions error early in development mode.

The otel and otelsdk R packages

Use the otel package as a dependency if you want to instrument your R package or project for OpenTelemetry.

Use the otelsdk package to produce OpenTelemetry output from an R package or project that was instrumented with the otel package.

Reference Documentation

Status

The current status of the major functional components for OpenTelemetry R is as follows:

TracesMetricsLogs
DevelopmentDevelopmentDevelopment

Version support

otel and otelsdk support R 3.6.0 and higher on Unix and R 4.3.0 or higher on Windows.

Installation

You can install the otel from CRAN:

install.packages("otelsdk")

Compiling from source

To compile otelsdk from source, you need to install the protobuf library first:

  • On Windows install the correct version of Rtools.

  • On Linux install the appropriate package from your distribution.

  • On macOS, you can use CRAN’s protobuf build or Homebrew. If you are using CRAN’s build, then you must uninstall or unlink Homebrew protobuf:

    brew unlink protobuf

Repositories

License

MIT © Posit, PBC

Copy Link

Version

Install

install.packages('otelsdk')

Monthly Downloads

39,463

Version

0.2.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Gabor Csardi

Last Published

October 7th, 2025

Functions in otelsdk (0.2.2)

with_otel_record

Record OpenTelemetry output, for testing purposes
tracer_provider_memory

In-memory tracer provider for testing
Time Interval Options

Time Interval Options
tracer_provider_http

Tracer provider to export traces over HTTP
tracer_provider_file

Tracer provider to write traces into a JSONL file
tracer_provider_stdstream

Tracer provider to write to the standard output or standard error or to a file
otelsdk-package

otelsdk: 'R' 'SDK' and Exporters for 'OpenTelemetry'
logger_provider_http

Logger provider to log over HTTP
File Size Options

File Size Options
logger_provider_file

Logger provider to write log messages into a JSONL file.
meter_provider_http

Meter provider to send collected metrics over HTTP
Collecting Telemetry Data

Collecting Telemetry Data
Environment Variables

Environment variables to configure otelsdk
meter_provider_file

Meter provider to collect metrics in JSONL files
meter_provider_stdstream

Meter provider to write to the standard output or standard error or to a file
meter_provider_memory

In-memory meter provider for testing
logger_provider_stdstream

Logger provider to write to the standard output or standard error or to a file