Ruby source integration¶
Beacon Ruby v1.1.0 is a source release based on OpenTelemetry Ruby Contrib. Applications integrate the instrumentation gems and initialize the OpenTelemetry SDK explicitly. This release retains upstream instrumentation gem identities and adds the opt-in beacon-security 0.1.0 gem as a GitHub Release asset. It does not publish to RubyGems or provide an executable agent or zero-code preload.
Requirements¶
- The validated environment is Ubuntu 24.04 x86_64, CRuby 3.3.12, and Bundler 2.5.22. The source gem specifications require Ruby 3.3 or newer; Security CI also passes Linux CRuby 3.3, 3.4 and 4.0. Collector acceptance uses CRuby 3.3.12; other engines/platforms are outside the validated scope.
- Download access to GitHub and RubyGems.
- Python 3 and Docker for the receiver check below.
Download and verify¶
Run these commands in a new directory. They pin v1.1.0 and download its source, Security gem, provenance and checksums together:
ruby_release_tag=v1.1.0
ruby_release_version=${ruby_release_tag#v}
ruby_archive="beacon-ruby-${ruby_release_version}-source.tar.gz"
ruby_release_url="https://github.com/beacon-observability/beacon-ruby/releases/download/${ruby_release_tag}"
curl -fLO "${ruby_release_url}/${ruby_archive}"
curl -fLO "${ruby_release_url}/beacon-security-0.1.0.gem"
curl -fLO "${ruby_release_url}/SOURCE.txt"
curl -fLO "${ruby_release_url}/SHA256SUMS"
sha256sum -c SHA256SUMS
tar -xzf "${ruby_archive}"
cd "beacon-ruby-${ruby_release_version}"
Continue only if checksum verification succeeds. SOURCE.txt records the source commit and upstream baseline. The archive includes source and licenses; the Security gem is a separate checksummed asset. Dependencies are installed separately. The validated environment and scope on this page describe v1.1.0; review the selected release's notes for changes.
Verify Net::HTTP traces¶
From the extracted source directory, use the release's locked dependencies and receiver check:
cd beacon/validation
BUNDLE_FROZEN=true bundle install
docker pull otel/opentelemetry-collector-contrib:0.135.0
BUNDLE_FROZEN=true python3 collector_smoke.py
The harness starts a temporary HTTP server and a local OpenTelemetry Collector, then runs the instrumented Ruby HTTP request. It uses OTLP HTTP/protobuf and verifies service beacon-ruby-import-smoke, one root span, one HTTP client span, their shared trace ID, and the parent span relationship. On success it prints:
The harness removes its temporary servers, container, and trace output afterward. This verifies the synthetic request at the local Collector; it does not establish production backend ingestion.
Initialize the SDK¶
Load the required libraries during application startup, then initialize the SDK and enable Net::HTTP instrumentation:
require 'bundler/setup'
require 'net/http'
require 'opentelemetry-sdk'
require 'opentelemetry-exporter-otlp'
require 'opentelemetry-instrumentation-net_http'
OpenTelemetry::SDK.configure do |config|
config.service_name = 'my-ruby-service'
config.use 'OpenTelemetry::Instrumentation::Net::HTTP'
end
Merge this into the application's existing initialization logic to avoid initializing the SDK twice. Instrumentation creates spans only for calls through supported libraries, not arbitrary business methods. See the release Ruby example for root spans, requests, and flushing before exit.
Application integration and scope¶
See the release Gemfile and Ruby example for the validated Net::HTTP path. The Gemfile loads the base and Net::HTTP instrumentation gems from the release source and pins the Core SDK and OTLP exporter versions. Commit the application Gemfile and lockfile, and inspect Bundler dependency sources: installing same-named instrumentation gems directly from RubyGems selects upstream packages. Load the required libraries, initialize the SDK, and enable OpenTelemetry::Instrumentation::Net::HTTP.
Release acceptance covers the shared instrumentation base, Net::HTTP modes, and local Collector trace export. Security findings and runtime inventories also have a validated Logs path; see Ruby Security. Rails-specific adapters, other integrations, DataKit, metrics, general application logs and profiling are outside the validated scope. See the source installation guide and release notes before adapting the example.
To report traces to TrueWatch, enable the DataKit OpenTelemetry HTTP receiver using Common configuration, then configure the HTTP/protobuf export endpoint as described in OpenTelemetry Ruby SDK. SDK initialization is still required. Validate the DataKit integration separately in the actual application environment; local Collector verification does not prove DataKit ingestion.
Generate real Net::HTTP requests, then open APM > Traces in TrueWatch and filter by the configured service name. Check traces, spans, and parent-child relationships.
Enable Security¶
After verifying all assets, install the GitHub-distributed gem from the download directory:
Add that installed version to the application's Gemfile, or reference the extracted
security directory with a Bundler path: entry. Initialize the application's
OpenTelemetry Logs SDK/exporter, call Beacon::Security.start, and add its Rack
middleware. Set BEACON_SECURITY_ENABLED=true; local files remain disabled.
This requires application setup. See Ruby Security for the
complete startup, coverage, budgets and verification steps.
Upgrades and rollback¶
Keep each source release in a separate directory. Retain the verified archive, checksums, SOURCE.txt, application Gemfile and lockfile, and SDK initialization. To roll back, restore the previous source reference, dependencies, and initialization, restart the application, and verify telemetry again.