Star us on GitHub
Star
Menu

Tracing with Other Ruby Frameworks

Learn how to set up highlight.io tracing for Ruby applications.

1

Add `tracingOrigins` to your client Highlight snippet.

This backend SDK requires one of the Highlight frontend SDKs to be installed, so please make sure you've followed the fullstack mapping guide first.

H.init("<YOUR_PROJECT_ID>", { tracingOrigins: ['localhost', 'example.myapp.com/backend'], networkRecording: { enabled: true, recordHeadersAndBody: true, }, });
Copy
2

Install the Highlight Ruby SDK.

Add Highlight to your Gemfile and install with Bundler.

gem "highlight_io" bundle install
Copy
3

Initialize the Highlight Ruby SDK.

Highlight.init initializes the SDK. Setting your project ID also lets Highlight record errors for background tasks and processes that aren't associated with a frontend session.

require "highlight" Highlight.init("<YOUR_PROJECT_ID>", environment: "production") do |c| c.service_name = "my-app" c.service_version = "1.0.0" end
Copy
4

Add Highlight tracing.

start_span will automatically record raised exceptions and send them to Highlight.

require "highlight" Highlight.start_span('my-span') do span.add_attribute({ key: "value" }) # your code here end
Copy
5

Verify your backend traces are being recorded.

Visit the highlight traces portal and check that backend traces are coming in.