The bugsnag_performance
gem is a plugin for the OpenTelemetry library to make it simple to send your spans to your BugSnag dashboard. The guide provides more detail on how it can be configured for your application.
To set configuration options, call BugsnagPerformance.configure
passing it a block of configuration values:
BugsnagPerformance.configure do |configuration|
configuration.api_key = "YOUR_API_KEY_HERE"
end
The only required configuration is the BugSnag API key. We also recommend you set the AppVersion and ReleaseStage if these make sense for your deployment workflow.
If you are using the BugSnag Error Monitoring library for Ruby, the Performance library will use the same values for the common configuration options (detailed below) if not set explicitly in your Performance configuration. You can also configure many of the options using environment variables with a BUGSNAG_PERFORMANCE_
prefix which will supersede any BUGSNAG_
values in use from the Error library.
You can find your API key in Project Settings from your BugSnag dashboard.
API key can be loaded from the environment variables BUGSNAG_API_KEY
/BUGSNAG_PERFORMANCE_API_KEY
or specified in code:
BugsnagPerformance.configure do |configuration|
configuration.api_key = "YOUR_API_KEY_HERE"
end
Setting your app’s version information in configuration allows you to see performance data for a specific release.
App version can be loaded from the environment variables BUGSNAG_APP_VERSION
/BUGSNAG_PERFORMANCE_APP_VERSION
or specified in code:
BugsnagPerformance.configure do |configuration|
configuration.app_version = "1.2.3"
end
A block used to configure the OpenTelemetry library. This should be used instead of calling OpenTelemetry.configure
:
BugsnagPerformance.configure do |configuration|
configuration.configure_open_telemetry do |open_telemetry_configurator|
open_telemetry_configurator.use_all
end
end
By default we will send trace and span data to the bugsnag.com
web service address for traces.
If you are using BugSnag On-premise you’ll need to set this to your Trace Server endpoint.
Endpoints can be loaded from the environment variable BUGSNAG_PERFORMANCE_ENDPOINT
or specified in code:
BugsnagPerformance.configure do |configuration|
configuration.endpoint = "http://bugsnag.internal:4318/v1/traces"
end
Sets which logger to use for library log messages. By default this will be set to the BugSnag Error library’s logger, if found, or else the OpenTelemetry logger (OpenTelemetry.logger
).
To hide lower-level messages from the BugSnag library, the logger can be reconfigured as follows:
config.logger = Logger.new($stdout)
Setting a release stage in your configuration allows you to filter performance data by different stages of the application release process (development, production, etc) in the BugSnag dashboard. The release stage is set to “production” by default.
Release stage can be loaded from the environment variables BUGSNAG_RELEASE_STAGE
/BUGSNAG_PERFORMANCE_RELEASE_STAGE
or specified in code:
BugsnagPerformance.configure do |configuration|
configuration.release_stage = "development"
end
You can also limit which builds send performance data by setting the enabled_release_stages
configuration option.
enabled_release_stages
can be loaded as a comma-delimited list from the environment variables BUGSNAG_ENABLED_RELEASE_STAGES
/BUGSNAG_PERFORMANCE_ENABLED_RELEASE_STAGES
or specified in code:
BugsnagPerformance.configure do |configuration|
configuration.enabled_release_stages = ['production', 'staging']
end
The service name provides a human-readable identifier for the app generating the spans. This is shown in Distributed Tracing to differentiate spans across the distributed trace.
The service name can be loaded from the environment variable BUGSNAG_PERFORMANCE_SERVICE_NAME
or specified in code:
BugsnagPerformance.configure do |configuration|
configuration.service_name = "WidgetProcessor"
end