The Ruby OpenTelemetry client.
Please review the contribution instructions for important information on setting up your environment, running the tests, and opening pull requests.
The Ruby special interest group (SIG) meets regularly. See the OpenTelemetry community page repo for information on this and other language SIGs.
Find more about the approver role in community repository.
Find more about the maintainer role in community repository.
This repository includes multiple installable packages. The
package includes abstract classes and no-op implementations that comprise the OpenTelemetry API following
opentelemetry-sdk package is the reference implementation of the API.
Libraries that produce telemetry data should only depend on
and defer the choice of the SDK to the application developer. Applications may
opentelemetry-sdk or another package that implements the API.
Please note that this library is currently in beta for tracing.
The API and SDK packages are available on RubyGems.org, and can be installed via
gem install opentelemetry-api gem install opentelemetry-sdk
Bundler by adding the following to your
gem 'opentelemetry-api' gem 'opentelemetry-sdk'
To install development versions of these packages, follow the "Developer Setup" section (below).
require 'opentelemetry/sdk' # Configure the sdk with default export and context propagation formats # see SDK#configure for customizing the setup OpenTelemetry::SDK.configure # To start a trace you need to get a Tracer from the TracerProvider tracer = OpenTelemetry.tracer_provider.tracer('my_app_or_gem', '0.1.0') # create a span tracer.in_span('foo') do |span| # set an attribute span.set_attribute('platform', 'osx') # add an event span.add_event('event in bar') # create bar as child of foo tracer.in_span('bar') do |child_span| # inspect the span pp child_span end end
This repository contains instrumentation libraries for many popular Ruby gems, including Rails, Rack, Sinatra, and others, so you can start using OpenTelemetry with minimal changes to your application. See the instrumentation README for more.
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For help or feedback on this project, join us in GitHub Discussions.
Apache 2.0 - See LICENSE for more information.