Exporters
In order to visualize and analyze your traces, you will need to export them to a backend such as Jaeger or Zipkin. OpenTelemetry Ruby provides exporters for some common open source backends.
Below you will find some introductions on how to set up backends and the matching exporters.
OTLP endpoint¶
To send trace data to a OTLP endpoint (like the collector or
Jaeger) you'll want to use an exporter package, such as
opentelemetry-exporter-otlp
:
{{< tabpane lang=shell persistLang=false >}}
{{< tab bundler >}} bundle add opentelemetry-exporter-otlp {{< /tab >}}
{{< tab gem >}} gem install opentelemetry-exporter-otlp {{< /tab >}}
{{< /tabpane>}}
Next, configure the exporter to point at an OTLP endpoint. For example you can
update config/initializers/opentelemetry.rb
from the
Getting Started by adding
require 'opentelemetry-exporter-otlp'
to the code:
If you now run your application it will use OTLP to export traces:
By default traces are sent to an OTLP endpoint listening on localhost:4318. You
can change the endpoint by setting the OTEL_EXPORTER_OTLP_ENDPOINT
accordingly:
To try out the OTLP exporter quickly and see your traces visualized at the receiving end, you can run Jaeger in a docker container:
Zipkin¶
To set up Zipkin as quickly as possible, run it in a docker container:
Install the exporter package as a dependency for your application:
{{< tabpane lang=shell persistLang=false >}}
{{< tab bundle >}} bundle add opentelemetry-exporter-zipkin {{< /tab >}}
{{< tab gem >}} gem install opentelemetry-exporter-zipkin {{< /tab >}}
{{< /tabpane>}}
Update your OpenTelemetry configuration to use the exporter and to send data to your Zipkin backend:
If you now run your application, set the environment variable
OTEL_TRACES_EXPORTER
to zipkin:
By default traces are sent to a Zipkin endpoint listening on port
localhost:9411. You can change the endpoint by setting the
OTEL_EXPORTER_ZIPKIN_ENDPOINT
accordingly: