Menu
Ruby SDK API Reference
Ruby SDK
Highlight's Ruby SDK makes it easy to monitor errors and logs on your Ruby backend.
Just getting started?
Check out our getting started guide to get up and running quickly.
Highlight.init()
Initializes the Highlight backend SDK.
Options
Highlight.init('1jdkoe52', environment: Rails.env, otlp_endpoint: 'http://localhost:4318') do |c|
c.service_name = 'highlight-ruby-demo-backend'
c.service_version = '1.0.0'
end
Highlight.start_span()
Starts a new span with the given name and attributes.
Method Parameters
Options
Highlight.start_span('pages-home-fetch') do
uri = URI.parse('http://www.example.com/?test=1')
response = Net::HTTP.get_response(uri)
@data = response.body
end
Highlight.log()
Logs a message with the specified level and attributes.
Method Parameters
Options
Highlight.log('info', 'hello, world!', { foo: 'bar' })
Highlight.exception()
Records an exception with optional attributes.
Method Parameters
Options
Highlight.exception(e, { foo: 'bar' })