Ruby
<!-- status: ga language: ruby -->
Ruby: near-zero-code instrumentation
Ruby has no agent that attaches without a code change; the standard route is the opentelemetry-instrumentation-all gem, enabled by one initializer line (Rails: config/initializers/opentelemetry.rb). Everything else, the endpoint, the key and the service name, comes from the standard OTEL_* variables.
Create a project, then an ingestion key (
wti_...) with theingest:tracesscope. The key is shown once.Point the SDK at the gateway and pass the key in the
x-watchtower-keyheader:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.example.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS=x-watchtower-key=wti_YOUR_KEY
export OTEL_SERVICE_NAME=my-serviceAdd the gems (
opentelemetry-sdk,opentelemetry-exporter-otlp,opentelemetry-instrumentation-all) and the initializer:
require "opentelemetry/sdk"
require "opentelemetry/exporter/otlp"
require "opentelemetry/instrumentation/all"
OpenTelemetry::SDK.configure do |c|
c.use_all # Rails, Rack, Sidekiq, Net::HTTP, PG, Redis, ...
endSend one request to the service, then open the project's onboarding screen: it turns green when the first span arrives.