Configuration options

You must call bugsnag.Configure() at the start of your program to use Bugsnag, you pass it a bugsnag.Configuration object containing any of the following values.

The only required configuration is the Bugsnag API key which can be obtained by clicking “Settings” on the top of of your Bugsnag dashboard after signing up. We also recommend you set the ReleaseStage, AppType, and AppVersion if these make sense for your deployment workflow.


The Bugsnag API key can be found on your Bugsnag dashboard under “Settings”.


If you want to have multiple different configurations around in one program, you can use bugsnag.New() to create multiple independent instances of Bugsnag. You can use these without calling bugsnag.Configure(), but bear in mind that until you call bugsnag.Configure() unhandled panics will not be sent to Bugsnag.

notifier := bugsnag.New(bugsnag.Configuration{

Any place that lets you pass in rawData also allows you to pass in configuration. For example, to send HTTP errors to one Bugsnag project:

bugsnag.Handler(nil, bugsnag.Configuration{APIKey: "YOUR_OTHER_API_KEY"})


If your app has multiple components with different configurations, it can be useful when filtering error reports to separate them by the type of app, like HTTP router, worker queues, and more.

    AppType: "queue",


If you use a versioning scheme for deploys of your app, Bugsnag can use the AppVersion to only re-open errors if they occur in later version of the app.

    AppVersion: "1.2.3",


By default, Bugsnag will automatically capture and report session information from your application.

If the notify endpoint is changed and the sessions endpoint is not, this option will be set to false and session tracking will be disabled.

To disable automatic session capturing:

    AutoCaptureSessions: false,

If you want control over what is deemed a session, you can switch off automatic session tracking with the above configuration, and call bugsnag.StartSession(ctx) when appropriate for your application.


Deprecated: Use Endpoints instead.

The Bugsnag endpoint defaults to If you’re using Bugsnag on-premise, you should set this to the endpoint of your local instance.

    Endpoint: "http://bugsnag.internal:49000/",


By default we will send error reports to and sessions to

If you are using Bugsnag On-premise you’ll need to set these to your Event Server and Session Server endpoints. If the notify endpoint is set but the sessions endpoint is not, session tracking will be disabled automatically to avoid leaking session information outside of your server configuration, and a warning will be logged.

To set the endpoints:

    Endpoints: bugsnag.Endpoints{
        Notify:  "http://bugsnag.internal:49000/",
        Sessions: "http://bugsnag.internal:49001/",


The hostname is used to track where errors are coming from in the Bugsnag dashboard. The default value is obtained from os.Hostname() so you won’t often need to change this.

    Hostname: "go1",


The Logger to write to in case of an error inside Bugsnag. This defaults to the global logger.

    Logger: app.Logger,


The list of ReleaseStages to notify in. By default Bugsnag will notify you in all release stages, but you can use this to silence development errors.

    NotifyReleaseStages: []string{"production", "staging"},


While it’s nice that you can pass MetaData directly into bugsnag.Notify, bugsnag.AutoNotify, and bugsnag.Recover, this can be a bit cumbersome and inefficient — you’re constructing the meta-data whether or not it will actually be used. A better idea is to pass raw data in to these functions, and add an OnBeforeNotify filter that converts them into MetaData.

For example, lets say our system processes jobs:

type Job struct{
    Retry     bool
    UserId    string
    UserEmail string
    Name      string
    Params    map[string]string

You can pass a job directly into bugsnag.Notify:

bugsnag.Notify(err, job)

And then add a filter to extract information from that job and attach it to the Bugsnag event:

    func(event *bugsnag.Event, config *bugsnag.Configuration) error {

        // Search all the RawData for any *Job pointers that we're passed in
        // to bugsnag.Notify() and friends.
        for _, datum := range event.RawData {
            if job, ok := datum.(*Job); ok {
                // don't notify bugsnag about errors in retries
                if job.Retry {
                    return fmt.Errorf("not notifying about retried jobs")

                // add the job as a tab on
                event.MetaData.AddStruct("Job", job)

                // set the user correctly
                event.User = &User{Id: job.UserId, Email: job.UserEmail}

        // continue notifying as normal
        return nil


The first time Bugsnag is configured, it wraps the running program in a panic handler using panicwrap. This forks a sub-process which monitors unhandled panics. To prevent this, set PanicHandler to func() {} the first time you call bugsnag.Configure. This will prevent bugsnag from being able to notify you about unhandled panics.

    PanicHandler: func() {},


Sometimes sensitive data is accidentally included in Bugsnag MetaData. You can remove it by setting ParamsFilters. Any key in the MetaData, HTTP request headers, or HTTP URL query parameters that include any string in the filters will be redacted. The default is []string{"password", "secret", "authorization", "cookie", "access_token"}, which prevents fields like password, password_confirmation and secret_answer from being sent.

    ParamsFilters: []string{"password", "secret"},


In order to determine where a crash happens Bugsnag needs to know which packages you consider to be part of your app (as opposed to a library). By default this is set to []string{"main*"}. Strings are matched to package names using filepath.Match.

For matching subpackages within a package you may use the ** notation. For example,** will match all subpackages under package/.

    ProjectPackages: []string{"main", "*"},


The ReleaseStage tracks where your app is deployed. You should set this to production, staging, development or similar as appropriate.

    ReleaseStage: "development",


The directory where source packages are built and the assumed prefix of package directories. When set, the prefix is trimmed from callstack frame file names before ProjectPackages are stripped, for better readability and error grouping on the Bugsnag dashboard. The default value is $GOPATH/src or $GOROOT/src if $GOPATH is unset. At runtime, $GOROOT is the root used during the Go build. See the Go runtime package documentation for more information


Bugsnag usually starts a new goroutine before sending notifications. This means that notifications can be lost if you do a bugsnag.Notify and then immediately os.Exit. To avoid this problem, set Bugsnag to Synchronous (or just panic() instead ;).

    Synchronous: true

Or just for one error:

bugsnag.Notify(err, bugsnag.Configuration{Synchronous: true})


The transport configures how Bugsnag makes http requests. By default we use http.DefaultTransport which handles HTTP proxies automatically using the $HTTP_PROXY environment variable.

    Transport: http.DefaultTransport,