Iris
Installing Airbrake in a Iris application
The gobrake
package makes it quick and easy to monitor your Iris app’s
performance. It only takes a few minutes to start collecting real performance data so let’s jump right in!
Installation & Configuration
Step 1: Install the latest version of gobrake
go get github.com/airbrake/gobrake/v5
import (
"github.com/airbrake/gobrake/v5"
irisbrake "github.com/airbrake/gobrake/v5/iris"
"github.com/kataras/iris/v12"
)
Step 2: Configure the Airbrake Iris middleware
Configuration is done through the gobrake.NotifierOptions
struct, which you
are supposed to pass to gobrake.NewNotifierWithOptions
.
var notifier = gobrake.NewNotifierWithOptions(&gobrake.NotifierOptions{
ProjectId: <YOUR PROJECT ID>, // <-- Fill in this value
ProjectKey: "<YOUR API KEY>", // <-- Fill in this value
Environment: "production",
})
To find <YOUR PROJECT ID>
and <YOUR API KEY>
navigate to your project’s
Settings and copy the values from the right sidebar.
Now pass the notifier
in the custom middleware provided by gobrake
i.e. irisbrake
and add it as a middleware.
app := iris.New()
app.Use(irisbrake.New(notifier))
Voilà you are ready to start performance monitoring to Airbrake from your Iris app. Please look into sample example to get more idea.
Additional Settings
Please visit our Gobrake overview for details on useful features like:
- Sending errors to Airbrake
- Adding custom params
- Ignoring notices
- Filtering data
- Logging integration
- Sending route stats
- Sending query stats
- Sending queue stats
Troubleshoot
In case you have a problem, question or a bug report, feel free to file an issue.