Skip to content

Multiple projects

View Markdown

To send errors to another Honeybadger project, configure an additional agent:

OtherBadger = Honeybadger::Agent.new
OtherBadger.configure do |config|
config.api_key = "PROJECT_API_KEY"
end
begin
# Failing code
rescue => exception
OtherBadger.notify(exception)
end

Agents do not use the global honeybadger.yml or environment variable configuration and must be configured manually after they are instantiated.

By default, agents share context within the current execution scope, including the Honeybadger singleton. Context set with Honeybadger.context or OtherBadger.context is available to both agents in that scope.

Pass local_context: true to give an agent local error context, event context, execution context (such as the Rack environment and request ID), and breadcrumbs:

OtherBadger = Honeybadger::Agent.new(local_context: true)
OtherBadger.configure do |config|
config.api_key = "PROJECT_API_KEY"
end
OtherBadger.context(customer_id: 123)

Set context on this instance directly. Context set on Honeybadger or other agents is not shared with it.