Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions content/en/docs/instrumentation/ruby/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ aliases: [/docs/instrumentation/ruby/getting_started]
weight: 1
---

[OpenTelemetry for Ruby][repository] can be used to add automatic and manual instrumentation to your applications.
Automatic instrumentation is enabled by adding [instrumentation packages][auto].
Manual instrumentation can be added using the [OpenTelemetry API][manual].
[OpenTelemetry for Ruby][repository] can be used to add automatic and manual
instrumentation to your applications. Automatic instrumentation is enabled by
adding [instrumentation packages][auto]. Manual instrumentation can be added
using the [OpenTelemetry API][manual].

### Requirements

These instructions will explain how to set up automatic and manual instrumentation for a Ruby service.
In order to follow along, you will need:
These instructions will explain how to set up automatic and manual instrumentation
for a Ruby service. In order to follow along, you will need:

- MRI Ruby >= `2.7`, jruby >= `9.3.2.0`, or truffleruby >= 22.1
- Docker Compose

> jruby only targets compatibility with MRI Ruby 2.6.8; which is EOL. This project does not officially support MRI Ruby 2.6.8, and provides jruby support on a best-effort basis until the jruby project supports compatibility with more modern Ruby runtimes.

> jruby only targets compatibility with MRI Ruby 2.6.8; which is EOL. This project
> does not officially support MRI Ruby 2.6.8, and provides jruby support on a best-effort
> basis until the jruby project supports compatibility with more modern Ruby runtimes.
>
> truffleruby is tested, but support is best-effort at this time.

### Installation
Expand All @@ -30,7 +33,8 @@ gem 'opentelemetry-exporter-otlp'
gem 'opentelemetry-instrumentation-all'
```

The inclusion of `opentelemetry-instrumentation-all` provides [instrumentations][auto] for Rails, Sinatra, several HTTP libraries, and more.
The inclusion of `opentelemetry-instrumentation-all` provides [instrumentations][auto]
for Rails, Sinatra, several HTTP libraries, and more.

### Initialization

Expand All @@ -51,15 +55,23 @@ OpenTelemetry::SDK.configure do |c|
end
```

The call `c.use_all()` enables all instrumentations in the `instrumentation/all` package. If you have more advanced configuration needs, see [configuring specific instrumentation libraries][config].
The call `c.use_all()` enables all instrumentations in the `instrumentation/all` package.
If you have more advanced configuration needs, see [configuring specific instrumentation libraries][config].

Now that you have setup your application to perform tracing, you'll need to configure the SDK to export the traces somewhere. Our example loaded the `OTLP` exporter, which the SDK tries to use by default. Next, we'll use the OpenTelemetry Collector to receive these traces and visualize them using Jaeger and Zipkin!
Now that you have setup your application to perform tracing, you'll need to configure
the SDK to export the traces somewhere. Our example loaded the `OTLP` exporter, which
the SDK tries to use by default. Next, we'll use the OpenTelemetry Collector to receive
these traces and visualize them using Jaeger and Zipkin!

### Exporting Traces

The following section assumes you are new to OpenTelemetry or do not currently use a vendor that supports distributed tracing using OTLP. Please refer to your vendor's product documentation if you would like to export your traces to a vendor for analysis and visualization.
The following section assumes you are new to OpenTelemetry or do not currently use
a vendor that supports distributed tracing using OTLP. Please refer to your vendor's
product documentation if you would like to export your traces to a vendor for analysis
and visualization.

For the purposes of this tutorial you will configure an OpenTelemetry collector that will receive the traces and visualize them using Jaeger or Zipkin UI.
For the purposes of this tutorial you will configure an OpenTelemetry collector that
will receive the traces and visualize them using Jaeger or Zipkin UI.

First, start up an example system:

Expand All @@ -76,9 +88,12 @@ Set the [`OTEL_EXPORTER_OTLP_ENDPOINT`][sdk-env] environment variable to `http:/
$ export OTEL_EXPORTER_OTLP_ENDPOINT=http://0.0.0.0:4318
```

Now, start up your application and perform a few operations to generate tracing data, e.g. navigate around your web app or kick off background tasks.
Now, start up your application and perform a few operations to generate tracing
data, e.g. navigate around your web app or kick off background tasks.

Lastly, open a browser and navigate to the [Jaeger UI](http://localhost:16686) or [Zipkin UI](http://localhost:9411) and search for traces related to your service, which were generated by the auto-instrumentation features of OpenTelemetry!
Lastly, open a browser and navigate to the [Jaeger UI](http://localhost:16686)
or [Zipkin UI](http://localhost:9411) and search for traces related to your service,
which were generated by the auto-instrumentation features of OpenTelemetry!

### What next?

Expand Down