opentelemetry-exporter-zipkin gem provides Zipkin exporters for OpenTelemetry for Ruby. Using
opentelemetry-exporter-zipkin, an application can configure OpenTelemetry to export collected tracing data to Zipkin. One exporter is included: the
Exporter exports in HTTP JSON format over TCP to a Zipkin backend
What is OpenTelemetry?
OpenTelemetry is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.
OpenTelemetry provides a single set of APIs, libraries, agents, and collector services to capture distributed traces and metrics from your application. You can analyze them using Prometheus, Jaeger, and other observability tools.
How does this gem fit in?
opentelemetry-exporter-zipkin gem is a plugin that provides Zipkin Tracing export. To export to Zipkin, an application can include this gem along with
opentelemetry-sdk, and configure the
SDK to use the provided Zipkin exporter as a span processor.
Generally, libraries that produce telemetry data should avoid depending directly on specific exporter, deferring that choice to the application developer.
How do I get started?
Install the gem using:
gem install opentelemetry-sdk gem install opentelemetry-exporter-zipkin
Or, if you use bundler, include
opentelemetry-sdk in your
Then, configure the SDK to use a zipkin exporter as a span processor, and use the OpenTelemetry interfaces to produces traces and other information. Following is a basic example for the
require 'opentelemetry/sdk' require 'opentelemetry/exporter/zipkin' # Select the zipkin exporter via environmental variables ENV['OTEL_TRACES_EXPORTER'] = 'zipkin' ENV['OTEL_SERVICE_NAME'] = 'zipkin-example' ENV['OTEL_SERVICE_VERSION'] = '0.15.0' # The zipkin expects an exporter running on localhost:9411 - you may override this if needed: # ENV['OTEL_EXPORTER_ZIPKIN_ENDPOINT'] = 'http://some.other.host:12345' # 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
For additional examples, see the examples on github.
How can I configure the Zipkin exporter?
The collector exporter can be configured explicitly in code, or via environment variables as shown above. The configuration parameters, environment variables, and defaults are shown below.
| Parameter | Environment variable | Default | | ———– | ————————————–| ————————– | |
"http://localhost:9411" | |
nil | |
10 | | |
How can I get involved?
opentelemetry-exporter-zipkin gem source is on github, along with related gems including
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on in GitHub Discussions or attending our weekly meeting. See the meeting calendar for dates and times. For more information on this and other language SIGs, see the OpenTelemetry community page.
opentelemetry-exporter-zipkin gem is distributed under the Apache 2.0 license. See LICENSE for more information.