MCPcopy Index your code
hub / github.com/airbrake/gobrake

github.com/airbrake/gobrake @v5.6.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.6.2 ↗ · + Follow
337 symbols 910 edges 57 files 82 documented · 24% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Gobrake

.github/workflows/test.yml PkgGoDev

Introduction

Gobrake is the official notifier package for Airbrake for the Go programming language. Gobrake provides a minimalist API that enables the ability to send any Go error or panic to the Airbrake dashboard. The library is extremely lightweight, with minimal overhead.

Key features

  • Simple, consistent and easy-to-use library API
  • Asynchronous exception reporting
  • Flexible configuration options
  • Support for environments
  • Add extra context to errors before reporting them
  • Filters support (filter out sensitive or unwanted data that shouldn't be sent)
  • Ignore errors based on class, message, status, file, or any other filter
  • SSL support (all communication with Airbrake is encrypted by default)
  • Notify Airbrake on panics
  • Set error severity to control notification thresholds
  • Support for code hunks (lines of code surrounding each backtrace frame)
  • Automatic deploy tracking
  • Performance monitoring features such as HTTP route statistics, SQL queries, and Job execution statistics
  • Integrations with Beego, Buffalo, Echo, fasthttp, Fiber, Gin, gorilla/mux, Iris, Negroni and net/http
  • Last but not least, we follow semantic versioning 2.0.0

Installation

When using Go Modules, you do not need to install anything to start using Airbrake with your Go application. Import the package and the go tool will automatically download the latest version of the package when you next build your program.

import (
    "github.com/airbrake/gobrake/v5"
)

With or without Go Modules, to use the latest version of the package, run:

go get github.com/airbrake/gobrake/v5

Installing in a new project

Create a new directory, initialize a new module and go get the library:

mkdir airbrake_example && cd airbrake_example
go mod init airbrake_example
go get github.com/airbrake/gobrake/v5

Example

This is the minimal example that you can use to test Gobrake with your project.

package main

import (
    "errors"

    "github.com/airbrake/gobrake/v5"
)

var airbrake = gobrake.NewNotifierWithOptions(&gobrake.NotifierOptions{
    ProjectId:   <YOUR PROJECT ID>, // <-- Fill in this value
    ProjectKey:  "<YOUR API KEY>", // <-- Fill in this value
    Environment: "production",
})

func main() {
    defer airbrake.Close()

    airbrake.Notify(errors.New("operation failed"), nil)
}

ProjectId & ProjectKey

You must set both ProjectId & ProjectKey.

To find your ProjectId (int64) and ProjectKey (string) navigate to your project's Settings and copy the values from the right sidebar.

id-key

Getting Started

To check the complete Guide, visit our official docs.

API

For complete API description please follow documentation on pkg.go.dev documentation.

Note: Gobrake provides middleware out of the box and you may find our example apps more helpful:

Additional notes

Exception limit

The maximum size of an exception is 64KB. Exceptions that exceed this limit will be truncated to fit the size.

Logging

We support major logging frameworks:

  • There's a glog fork, which integrates with Gobrake. It provides all of original glog's functionality and adds the ability to send errors/logs to Airbrake.io.
  • apex/log, to check how to integrate gobrake with apex/log, see example.
  • zerolog, to check how to integrate gobrake with zerolog, see example.
  • zap, to check how to integrate gobrake with zap, see example.

Supported Go versions

The library supports Go v1.17+. The CI file would be the best source of truth because it contains all Go versions that we test against.

Contact

In case you have a problem, question or a bug report, feel free to:

License

The project uses the MIT License. See LICENSE.md for details.

Extension points exported contracts — how you extend this code

Metric (Interface)
(no doc) [4 implementers]
metric.go
Span (Interface)
------------------------------------------------------------------------------ [2 implementers]
metric.go

Core symbols most depended-on inside this repo

Add
called by 51
stat.go
Close
called by 42
notifier.go
Notify
called by 40
route.go
WriteHeader
called by 39
http/httpbrake.go
Get
called by 26
internal/lrucache/lrucache.go
Set
called by 26
internal/lrucache/lrucache.go
Write
called by 25
zap/zap.go
Poll
called by 24
remote_config.go

Shape

Function 147
Method 112
Struct 71
Interface 4
FuncType 2
TypeAlias 1

Languages

Go100%

Modules by API surface

metric.go25 symbols
notifier.go21 symbols
remote_config.go18 symbols
backlog.go17 symbols
git.go12 symbols
stat.go11 symbols
route_stat.go10 symbols
queues.go10 symbols
queries.go10 symbols
notice.go10 symbols
internal/lrucache/lrucache.go10 symbols
route_breakdown.go9 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add gobrake \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact