Configuration options

Discover configuration options to customize your BugSnag integration.

Setting configuration options

Configuration options can be set by setting named parameters when calling bugsnag_performance.start():

Available options

 API key

The API key used for performance data sent to BugSnag.

await bugsnag_performance.start(
  apiKey: 'YOUR_API_KEY_HERE'
);

You can find your API key in Project Settings from your BugSnag dashboard.

App version information

Setting your app’s version in configuration allows you to see performance data for a specific release:

await bugsnag_performance.start(
  apiKey: 'YOUR_API_KEY_HERE', 
  appVersion: "1.2.3"
);

Auto instrumentation

By default we will measure your app’s start time TODO: clarify timing.

This measurement can be disabled entirely using the following configuration option:

TODO: snippet

Endpoint

By default we will send trace and span data to otlp.bugsnag.com/v1/traces.

If you are using BugSnag On-premise you’ll need to set this to your Trace Server endpoint.

await bugsnag_performance.start(
  apiKey: apiKey, 
  endpoint: Uri.parse('YOUR_ENDPOINT_HERE')
);

Network request callback

You can control which network requests are captured and sanitize the URL string sent to your BugSnag dashboard using the networkRequestCallback configuration option. The network request span will be transmitted to BugSnag using the url in the returned object, or will not be sent at all if null is returned:

await bugsnag_performance.start(
  apiKey: apiKey, 
  networkRequestCallback: (requestInfo) {
    // Don't send network request span
    if (requestInfo.url!.contains('no-track.com')){
      return null;
    }

    // Remove user ID
    if (requestInfo.type == 'GET' && RegExp(r"/account\/[0-9]+/").hasMatch(requestInfo.url!)) {
      requestInfo.url = requestInfo.url?.replaceAll(RegExp(r'/account/[0-9]+/'), 'account/[account-id]');
    }

    return requestInfo;
  }
);

Release stages

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:

await bugsnag_performance.start(
  apiKey: apiKey, 
  releaseStage: 'staging')
);

// if no release stage is set then we will automatically use the following:
Platform.environment['DEPLOYMENT_ENVIRONMENT'];

You can also limit which builds send performance data by setting the enabledReleaseStages configuration option:

await bugsnag_performance.start(
  apiKey: apiKey, 
  enabledReleaseStages: ['production'],['staging']
);

By default, performance data will be sent for all stages.