Giter Club home page Giter Club logo

gobrake's Introduction

Airbrake

Build Status Code Climate Gem Version Documentation Status Downloads Reviewed by Hound

Introduction

Airbrake is an online tool that provides robust exception tracking in any of your Ruby applications. In doing so, it allows you to easily review errors, tie an error to an individual piece of code, and trace the cause back to recent changes. The Airbrake dashboard provides easy categorization, searching, and prioritization of exceptions so that when errors occur, your team can quickly determine the root cause.

Key features

The Airbrake Dashboard

This library is built on top of Airbrake Ruby. The difference between Airbrake and Airbrake Ruby is that the airbrake gem is just a collection of integrations with frameworks or other libraries. The airbrake-ruby gem is the core library that performs exception sending and other heavy lifting.

Normally, you just need to depend on this gem, select the integration you are interested in and follow the instructions for it. If you develop a pure frameworkless Ruby application or embed Ruby and don't need any of the listed integrations, you can depend on the airbrake-ruby gem and ignore this gem entirely.

The list of integrations that are available in this gem includes:

Deployment tracking:

Installation

Bundler

Add the Airbrake gem to your Gemfile:

gem 'airbrake'

Manual

Invoke the following command from your terminal:

gem install airbrake

Configuration

Rails

Integration

To integrate Airbrake with your Rails application, you need to know your project id and project key. Set AIRBRAKE_PROJECT_ID & AIRBRAKE_PROJECT_KEY environment variables with your project's values and generate the Airbrake config:

export AIRBRAKE_PROJECT_ID=<PROJECT ID>
export AIRBRAKE_PROJECT_KEY=<PROJECT KEY>

rails g airbrake

Heroku add-on users can omit specifying the key and the id. Heroku add-on's environment variables will be used (Heroku add-on docs):

rails g airbrake

This command will generate the Airbrake configuration file under config/initializers/airbrake.rb. Make sure that this file is checked into your version control system. This is enough to start Airbraking.

In order to configure the library according to your needs, open up the file and edit it. The full list of supported configuration options is available online.

To test the integration, invoke a special Rake task that we provide:

rake airbrake:test

In case of success, a test exception should appear in your dashboard.

The notify_airbrake controller helpers

The Airbrake gem defines two helper methods available inside Rails controllers: #notify_airbrake and #notify_airbrake_sync. If you want to notify Airbrake from your controllers manually, it's usually a good idea to prefer them over Airbrake.notify, because they automatically add information from the Rack environment to notices. #notify_airbrake is asynchronous, while #notify_airbrake_sync is synchronous (waits for responses from the server and returns them). The list of accepted arguments is identical to Airbrake.notify.

Additional features: user reporting, sophisticated API

The library sends all uncaught exceptions automatically, attaching the maximum possible amount information that can help you to debug errors. The Airbrake gem is capable of reporting information about the currently logged in user (id, email, username, etc.), if you use an authentication library such as Devise. The library also provides a special API for manual error reporting. The description of the API is available online.

Automatic integration with Rake tasks and Rails runner

Additionally, the Rails integration offers automatic exception reporting in any Rake tasks[link] and Rails runner.

Integration with filter_parameters

If you want to reuse Rails.application.config.filter_parameters in Airbrake you can configure your notifier the following way:

# config/initializers/airbrake.rb
Airbrake.configure do |c|
  c.blocklist_keys = Rails.application.config.filter_parameters
end

There are a few important details:

  1. You must load filter_parameter_logging.rb before the Airbrake config
  2. If you use Lambdas to configure filter_parameters, you need to convert them to Procs. Otherwise you will get ArgumentError
  3. If you use Procs to configure filter_parameters, the procs must return an Array of keys compatible with the Airbrake allowlist/blocklist option (String, Symbol, Regexp)

Consult the example application, which was created to show how to configure filter_parameters.

filter_parameters dot notation warning

The dot notation introduced in rails/pull/13897 for filter_parameters (e.g. a key like credit_card.code) is unsupported for performance reasons. Instead, simply specify the code key. If you have a strong opinion on this, leave a comment in the dedicated issue.

Logging

In new Rails apps, by default, all the Airbrake logs are written into log/airbrake.log. In older versions we used to write to wherever Rails.logger writes. If you wish to upgrade your app to the new behaviour, please configure your logger the following way:

c.logger = Airbrake::Rails.logger

Sinatra

To use Airbrake with Sinatra, simply require the gem, configure it and use our Rack middleware.

# myapp.rb
require 'sinatra/base'
require 'airbrake'

Airbrake.configure do |c|
  c.project_id = 113743
  c.project_key = 'fd04e13d806a90f96614ad8e529b2822'

  # Display debug output.
  c.logger.level = Logger::DEBUG
end

class MyApp < Sinatra::Base
  use Airbrake::Rack::Middleware

  get('/') { 1/0 }
end

run MyApp.run!

To run the app, add a file called config.ru to the same directory and invoke rackup from your console.

# config.ru
require_relative 'myapp'

That's all! Now you can send a test request to localhost:9292 and check your project's dashboard for a new error.

curl localhost:9292

Rack

To send exceptions to Airbrake from any Rack application, simply use our Rack middleware, and configure the notifier.

require 'airbrake'
require 'airbrake/rack'

Airbrake.configure do |c|
  c.project_id = 113743
  c.project_key = 'fd04e13d806a90f96614ad8e529b2822'
end

use Airbrake::Rack::Middleware

Note: be aware that by default the library doesn't filter any parameters, including user passwords. To filter out passwords add a filter.

Appending information from Rack requests

If you want to append additional information from web requests (such as HTTP headers), define a special filter such as:

Airbrake.add_filter do |notice|
  next unless (request = notice.stash[:rack_request])
  notice[:params][:remoteIp] = request.env['REMOTE_IP']
end

The notice object carries a real Rack::Request object in its stash. Rack requests will always be accessible through the :rack_request stash key.

Optional Rack request filters

The library comes with optional predefined builders listed below.

RequestBodyFilter

RequestBodyFilter appends Rack request body to the notice. It accepts a length argument, which tells the filter how many bytes to read from the body.

By default, up to 4096 bytes is read:

Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new)

You can redefine how many bytes to read by passing an Integer argument to the filter. For example, read up to 512 bytes:

Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new(512))

Sending custom route breakdown performance

Arbitrary code performance instrumentation

For every route in your app Airbrake collects performance breakdown statistics. If you need to monitor a specific operation, you can capture your own breakdown:

def index
  Airbrake::Rack.capture_timing('operation name') do
    call_operation(...)
  end

  call_other_operation
end

That will benchmark call_operation and send performance information to Airbrake, to the corresponding route (under the 'operation name' label).

Method performance instrumentation

Alternatively, you can measure performance of a specific method:

class UsersController
  extend Airbrake::Rack::Instrumentable

  def index
    call_operation(...)
  end
  airbrake_capture_timing :index
end

Similarly to the previous example, performance information of the index method will be sent to Airbrake.

Sidekiq

We support Sidekiq v2+. The configurations steps for them are identical. Simply require our integration and you're done:

require 'airbrake/sidekiq'

If you required Sidekiq before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

Airbrake::Sidekiq::RetryableJobsFilter

By default, Airbrake notifies of all errors, including reoccurring errors during a retry attempt. To filter out these errors and only get notified when Sidekiq has exhausted its retries you can add the RetryableJobsFilter:

Airbrake.add_filter(Airbrake::Sidekiq::RetryableJobsFilter.new)

The filter accepts an optional max_retries parameter. When set, it configures the amount of allowed job retries that won't trigger an Airbrake notification. Normally, this parameter is configured by the job itself but this setting takes the highest precedence and forces the value upon all jobs, so be careful when you use it. By default, it's not set.

Airbrake.add_filter(
  Airbrake::Sidekiq::RetryableJobsFilter.new(max_retries: 10)
)

ActiveJob

No additional configuration is needed. Simply ensure that you have configured your Airbrake notifier with your queue adapter.

Resque

Simply require the Resque integration:

require 'airbrake/resque'

Integrating with Rails applications

If you're working with Resque in the context of a Rails application, create a new initializer in config/initializers/resque.rb with the following content:

# config/initializers/resque.rb
require 'airbrake/resque'
Resque::Failure.backend = Resque::Failure::Airbrake

Now you're all set.

General integration

Any Ruby app using Resque can be integrated with Airbrake. If you can require the Airbrake gem after Resque, then there's no need to require airbrake/resque anymore:

require 'resque'
require 'airbrake'

Resque::Failure.backend = Resque::Failure::Airbrake

If you're unsure, just configure it similar to the Rails approach. If you use multiple backends, then continue reading the needed configuration steps in the Resque wiki (it's fairly straightforward).

DelayedJob

Simply require our integration and you're done:

require 'airbrake/delayed_job'

If you required DelayedJob before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

Shoryuken

Simply require our integration and you're done:

require 'airbrake/shoryuken'

If you required Shoryuken before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

Sneakers

Simply require our integration and you're done:

require 'airbrake/sneakers'

If you required Sneakers before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

ActionCable

The ActionCable integration sends errors occurring in ActionCable actions and subscribed/unsubscribed events. If you use Rails with ActionCable, there's nothing to do, it's already loaded. If you use ActionCable outside Rails, simply require it:

require 'airbrake/rails/action_cable'

Rake

Airbrake offers Rake tasks integration, which is used by our Rails integration[link]. To integrate Airbrake in any project, just require the gem in your Rakefile, if it hasn't been required and configure the notifier.

# Rakefile
require 'airbrake'

Airbrake.configure do |c|
  c.project_id = 113743
  c.project_key = 'fd04e13d806a90f96614ad8e529b2822'
end

task :foo do
  1/0
end

Logger

If you want to convert your log messages to Airbrake errors, you can use our integration with Ruby's Logger class from stdlib. All you need to do is to wrap your logger in Airbrake's decorator class:

require 'airbrake/logger'

# Create a normal logger
logger = Logger.new($stdout)

# Wrap it
logger = Airbrake::AirbrakeLogger.new(logger)

Now you can use the logger object exactly the same way you use it. For example, calling fatal on it will both log your message and send it to the Airbrake dashboard:

logger.fatal('oops')

The Logger class will attempt to utilize the default Airbrake notifier to deliver messages. It's possible to redefine it via #airbrake_notifier:

# Assign your own notifier.
logger.airbrake_notifier = Airbrake::NoticeNotifier.new

Airbrake severity level

In order to reduce the noise from the Logger integration it's possible to configure Airbrake severity level. For example, if you want to send only fatal messages from Logger, then configure it as follows:

# Send only fatal messages to Airbrake, ignore anything below this level.
logger.airbrake_level = Logger::FATAL

By default, airbrake_level is set to Logger::WARN, which means it sends warnings, errors and fatal error messages to Airbrake.

Configuring Airbrake logger integration with a Rails application

In order to configure a production logger with Airbrake integration, simply overwrite Rails.logger with a wrapped logger in an after_initialize callback:

# config/environments/production.rb
config.after_initialize do
  # Standard logger with Airbrake integration:
  # https://github.com/airbrake/airbrake#logger
  Rails.logger = Airbrake::AirbrakeLogger.new(Rails.logger)
end

Configuring Rails APM SQL query stats when using Rails engines

By default, the library collects Rails SQL performance stats. For standard Rails apps no extra configuration is needed. However if your app uses Rails engines, you need to take an additional step to make sure that the file and line information is present for queries being executed in the engine code.

Specifically, you need to make sure that your Rails.backtrace_cleaner has a silencer that doesn't silence engine code (will be silenced by default). For example, if your engine is called blorgh and its main directory is in the root of your project, you need to extend the default silencer provided with Rails and add the path to your engine:

# config/initializers/backtrace_silencers.rb

# Delete default silencer(s).
Rails.backtrace_cleaner.remove_silencers!

# Define custom silencer, which adds support for the "blorgh" engine
Rails.backtrace_cleaner.add_silencer do |line|
  app_dirs_pattern = %r{\A/?(app|config|lib|test|blorgh|\(\w*\))}
  !app_dirs_pattern.match?(line)
end

Plain Ruby scripts

Airbrake supports any type of Ruby applications including plain Ruby scripts. If you want to integrate your script with Airbrake, you don't have to use this gem. The Airbrake Ruby gem provides all the needed tooling.

Deploy tracking

By notifying Airbrake of your application deployments, all errors are resolved when a deploy occurs, so that you'll be notified again about any errors that reoccur after a deployment. Additionally, it's possible to review the errors in Airbrake that occurred before and after a deploy.

There are several ways to integrate deployment tracking with your application, that are described below.

Capistrano

The library supports Capistrano v2 and Capistrano v3. In order to configure deploy tracking with Capistrano simply require our integration from your Capfile:

# Capfile
require 'airbrake/capistrano'

If you use Capistrano 3, define the after :finished hook, which executes the deploy notification task (Capistrano 2 doesn't require this step).

# config/deploy.rb
namespace :deploy do
  after :finished, 'airbrake:deploy'
end

If you version your application, you can set the :app_version variable in config/deploy.rb, so that information will be attached to your deploy.

# config/deploy.rb
set :app_version, '1.2.3'

Rake task

A Rake task can accept several arguments shown in the table below:

Key Required Default Example
ENVIRONMENT No Rails.env production
USERNAME No nil john
REPOSITORY No nil https://github.com/airbrake/airbrake
REVISION No nil 38748467ea579e7ae64f7815452307c9d05e05c5
VERSION No nil v2.0

In Rails

Simply invoke rake airbrake:deploy and pass needed arguments:

rake airbrake:deploy USERNAME=john ENVIRONMENT=production REVISION=38748467 REPOSITORY=https://github.com/airbrake/airbrake

Anywhere

Make sure to require the library Rake integration in your Rakefile.

# Rakefile
require 'airbrake/rake/tasks'

Then, invoke it like shown in the example for Rails.

Supported Rubies

  • CRuby >= 2.6.0
  • JRuby >= 9k

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.

Development & testing

In order to run the test suite, first of all, clone the repo, and install dependencies with Bundler.

git clone https://github.com/airbrake/airbrake.git
cd airbrake
bundle

Next, run unit tests.

bundle exec rake

In order to test integrations with frameworks and other libraries, install their dependencies with help of the following command:

bundle exec appraisal install

To run integration tests for a specific framework, use the appraisal command.

bundle exec appraisal rails-4.2 rake spec:integration:rails
bundle exec appraisal sinatra rake spec:integration:sinatra

Pro tip: GitHub Actions config has the list of all the integration tests and commands to invoke them.

gobrake's People

Contributors

andrew-werdna avatar anmic avatar arxdsilva avatar chimanjain avatar creack avatar dependabot-preview[bot] avatar dependabot[bot] avatar dvrkps avatar ihrwein avatar itolmach avatar kyrylo avatar mmcdaris avatar moorara avatar penthious avatar prendo93 avatar rbg avatar scottsbaldwin avatar smurf-u avatar thompiler avatar vmihailenco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gobrake's Issues

License

Please add license information to the package.

At time airbrake is not logging the error..

I'm not sure what is the cause of this but we are seeing at times that gobrake does not report the error reported by the system.

This is something I have personally noticed when was tailing the live log of the production and saw the statement written to the log file but the airbrake code that supposes to write the error to airbrake did not log any error.

If code helps here how we call airbrake in our code.

Also, what is expected behaviour in gobrake when network error happens.

Add findGitDir function

// findGitDir returns first directory containing .git file checking the dir and parent dirs.
func findGitDir(dir string) (string, bool) {}

Filter out by default

string: Unsolicited response received on idle HTTP channel starting with HTTP/1.0 408 Request Time-out\r\nCache-Control: no-cache\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n"; err=<nil>

Gobrake Middleware Stacktrace only showing middleware

The way that stack tracing is currently implemented (using runtime.Caller()) isn't suitable for integration as Middleware.

Currently, since runtime.Caller only reports on the calling Goroutine, all you'll see is the stack trace for the middleware itself:

/Users/ahamidi/Dev/Go/src/github.com/codegangsta/negroni/negroni.go:24 in HandlerFunc.ServeHTTP
/Users/ahamidi/Dev/Go/src/github.com/codegangsta/negroni/negroni.go:33 in middleware.ServeHTTP
/Users/ahamidi/Dev/Go/src/github.com/codegangsta/negroni/negroni.go:73 in (*Negroni).ServeHTTP
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1703 in serverHandler.ServeHTTP
/usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1204 in (*conn).serve
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 in goexit

In my case I've created a Negroni Middleware called Airbraker that notifies Airbrake whenever it sees an error HTTP Status Code.

Any ideas on how I might be able to get it to report on other goroutines? (I've only found references to runtime.Stack(buf, bool), which provides access stack traces for all running goroutines).

Sporadic test failure in metric_test.go

Sometimes running the test suite yields a failure. Running the tests with the same ginkgo seed doesn't reproduce it for me, so we have to make an educated guess.

Running Suite: gobrake
======================
Random Seed: 1579241484
Will run 31 of 31 specs

••••••
------------------------------
• Failure [0.206 seconds]
metric with real clock
/Users/kyrylo/code/airbrake/gobrake/metric_test.go:19
  supports measuring spans in goroutines [It]
  /Users/kyrylo/code/airbrake/gobrake/metric_test.go:20

  Expected
      <time.Duration>: 210356472
  to be within 10ms of ==
      <time.Duration>: 200000000

  /Users/kyrylo/code/airbrake/gobrake/metric_test.go:46
------------------------------
••••••••••••••••••••••••

Summarizing 1 Failure:

[Fail] metric with real clock [It] supports measuring spans in goroutines
/Users/kyrylo/code/airbrake/gobrake/metric_test.go:46

Ran 31 of 31 Specs in 1.364 seconds
FAIL! -- 30 Passed | 1 Failed | 0 Pending | 0 Skipped
--- FAIL: TestGobrake (1.36s)
FAIL
exit status 1
FAIL    github.com/airbrake/gobrake/v4  1.621s

Custom stacktrace

Hi,

related to this: #12 I would like to "inject" a custom stacktrace. My case (I think it is pretty common) is that I want to have one place where I call the logger. But since the stacktrace generation is hard wired in the go library it is impossible to use a custom one which is different from the place the logger is called.

gopkg.in import is failing

We're using the import path "gopkg.in/airbrake/gobrake.v3", and the build is now failing for our project:

../../../gopkg.in/airbrake/gobrake.v3/code_hunk.go:9:2: cannot find package "github.com/airbrake/gobrake/lrucache" in any of:
        /usr/local/Cellar/go/1.10/libexec/src/github.com/airbrake/gobrake/lrucache (from $GOROOT)
        /foo/dev/go/src/github.com/airbrake/gobrake/lrucache (from $GOPATH)

Documentation

It would be nice to see example usage or some quick blurb in the readme.

Rename DisableCodeHunks option to CodeHunks

The name DisableCodeHunks already includes negation, which is hard to understand. A much easier and more understandable way to manage it is to call it just CodeHunks.

DisableCodeHunks = true

// is the same as 

CodeHunks = false

I guess the current naming was dictated by simplicity of implementation since we want code hunks to be enabled by default but in Golang bool struct values default to false, which would make CodeHunks disabled by default.

Cannot be loaded with Glide

Hi,

We are using this library and basically it works fine and as expected. But we have a problem related to Glide.

When I do a glide install I often get the error

Failed to set version on gopkg.in/airbrake/gobrake.v2 to d63ed44: Unable to update checked out version

I don't know what this is related to. My glide.yml:

import:
- package: github.com/mitchellh/go-homedir
- package: github.com/spf13/cobra
- package: github.com/spf13/viper
  version: ^1.0.0
- package: github.com/gin-gonic/gin
  version: ^1.2.0
- package: github.com/gin-contrib/sse
- package: github.com/golang/protobuf
  subpackages:
  - proto
- package: github.com/mattn/go-isatty
  version: ^0.0.2
- package: github.com/gin-gonic/contrib
- package: github.com/dgrijalva/jwt-go
  version: ^3.0.0
  subpackages:
  - request
- package: github.com/dimiro1/health
- package: github.com/gocraft/dbr
  version: ^2.1.0
- package: github.com/pressly/goose
  version: ^2.1.0
- package: github.com/lib/pq
- package: github.com/airbrake/gobrake
  version: ^3.0.3

glide.lock:

hash: 79447dcb9523201b12266895651e6fabb02439d66260b65deed26ce778c34338
updated: 2017-09-05T15:32:41.423703519+02:00
imports:
- name: github.com/airbrake/gobrake
  version: d63ed4454f4c5abcb02b189fdf5cfec9baaae752
- name: github.com/dgrijalva/jwt-go
  version: d2709f9f1f31ebcda9651b03077758c1f3a0018c
  subpackages:
  - request
- name: github.com/dimiro1/health
  version: 22672c48855646f5d54b6315336d2e3fee6eef81
- name: github.com/fsnotify/fsnotify
  version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/gin-contrib/cors
  version: cf4846e6a636a76237a28d9286f163c132e841bc
- name: github.com/gin-contrib/sse
  version: 22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae
- name: github.com/gin-gonic/contrib
  version: 0f937ce6d016f44b2f5b1f03787e055977e7c0b8
  subpackages:
  - jwt
- name: github.com/gin-gonic/gin
  version: d459835d2b077e44f7c9b453505ee29881d5d12d
  subpackages:
  - binding
  - render
- name: github.com/gocraft/dbr
  version: b2f0ffcef2a64c0729d5818e103bc019caed7b22
  subpackages:
  - dialect
- name: github.com/golang/protobuf
  version: ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e
  subpackages:
  - proto
- name: github.com/hashicorp/hcl
  version: 8f6b1344a92ff8877cf24a5de9177bf7d0a2a187
  subpackages:
  - hcl/ast
  - hcl/parser
  - hcl/scanner
  - hcl/strconv
  - hcl/token
  - json/parser
  - json/scanner
  - json/token
- name: github.com/inconshreveable/mousetrap
  version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
- name: github.com/lib/pq
  version: e42267488fe361b9dc034be7a6bffef5b195bceb
- name: github.com/magiconair/properties
  version: be5ece7dd465ab0765a9682137865547526d1dfb
- name: github.com/mattn/go-isatty
  version: fc9e8d8ef48496124e79ae0df75490096eccf6fe
- name: github.com/mitchellh/go-homedir
  version: b8bc1bf767474819792c23f32d8286a45736f1c6
- name: github.com/mitchellh/mapstructure
  version: d0303fe809921458f417bcf828397a65db30a7e4
- name: github.com/pelletier/go-toml
  version: 9c1b4e331f1e3d98e72600677699fbe212cd6d16
- name: github.com/pkg/errors
  version: 645ef00459ed84a119197bfb8d8205042c6df63d
- name: github.com/pressly/goose
  version: 056a4d47dcc4d67fa3947a4f13945a5c690e568b
- name: github.com/satori/go.uuid
  version: 879c5887cd475cd7864858769793b2ceb0d44feb
- name: github.com/sirupsen/logrus
  version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
- name: github.com/spf13/afero
  version: 36f8810e2e3d7eeac4ac05b57f65690fbfba62a2
  subpackages:
  - mem
- name: github.com/spf13/cast
  version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4
- name: github.com/spf13/cobra
  version: 2df9a531813370438a4d79bfc33e21f58063ed87
- name: github.com/spf13/jwalterweatherman
  version: 0efa5202c04663c757d84f90f5219c1250baf94f
- name: github.com/spf13/pflag
  version: e57e3eeb33f795204c1ca35f56c44f83227c6e66
- name: github.com/spf13/viper
  version: 25b30aa063fc18e48662b86996252eabdcf2f0c7
- name: github.com/ugorji/go
  version: 8c0409fcbb70099c748d71f714529204975f6c3f
  subpackages:
  - codec
- name: golang.org/x/sys
  version: ab9e364efd8b52800ff7ee48a9ffba4e0ed78dfb
  subpackages:
  - unix
- name: golang.org/x/text
  version: 18c65dde6afd36dbc39197ca72008895b8dfbfb6
  subpackages:
  - transform
  - unicode/norm
- name: gopkg.in/airbrake/gobrake.v2
  version: d63ed4454f4c5abcb02b189fdf5cfec9baaae752
- name: gopkg.in/go-playground/validator.v8
  version: 5f1438d3fca68893a817e4a66806cea46a9e4ebf
- name: gopkg.in/yaml.v2
  version: eb3733d160e74a9c7e442f435eb3bea458e1d19f
testImports: []

getCode is not usable in production

This commit: d138f01
introduces a change which is working fine in dev, but not at all in production.
We certainly don't put the source code on production servers, so getCode will fail each time, leaving a lot of logging entries because there's no such file or directory.

How does one set context values in v2?

Both examples make use of internal map of environment variables, but I can't see where I should be setting those values? Am I missing something or should I make a PR for this?

i.e....

 airbrake.AddFilter(func(notice *gobrake.Notice) *gobrake.Notice {
        notice.Context["environment"] = "production"
        return notice
    })

Update tag

Please update the tag so gopkg can use the latest change (specifically dependencies removal)

Extract stacktraces from errors of pkg/errors

Thanks for making this great library.

I am transitioning some code to use pkg/errors for error logging. This package captures the stacktraces of the place where the errors are created. Those stacktraces are more precise than the ones collected by gobrake, since the error creation and its logging can be far away (I use sirupsen/logrus's log.Errorln(err)).

Before I send a PR I'd like to ask your opinion about this feature. Would you merge a PR that implements it? I've one ready.

Cant download v4 with dep

Hi, i know that we should use go mod instead of dep.. but i have a legacy project and i need to use dep

SSL errors running inside a barebones docker container

E0815 15:03:24.747345 00019 notifier.go:62] gobrake failed (Post https://airbrake.io/api/v3/projects/REDACTED/notices?key=REDACTED: x509: failed to load system roots and no roots provided) reporting error: testing tugd panic
E0815 15:03:24.753315 00019 notifier.go:62] gobrake failed (Post https://airbrake.io/api/v3/projects/REDACTED/notices?key=REDACTED: x509: failed to load system roots and no roots provided) reporting error: Session closed

Notifier double close

panic: close of closed channel [recovered] 
panic: close of closed channel [recovered] 
panic: close of closed channel

goroutine 15 [running]: 
panic(0x369440, 0xc82043c000) 
/usr/local/go/src/runtime/panic.go:481 +0x3e6 
testing.tRunner.func1(0xc820094090) 
/usr/local/go/src/testing/testing.go:467 +0x192 
panic(0x369440, 0xc82043c000) 
/usr/local/go/src/runtime/panic.go:443 +0x4e9 
gopkg.in/airbrake/gobrake%2ev2.(*Notifier).NotifyOnPanic(0xc8200180e0)

Unable to install gobrake v4.0.3

Hi ! I'm having some trouble trying to install the latest version.

Running go get github.com/airbrake/gobrake/v4 as the docs say yields:

package github.com/airbrake/gobrake/v4: cannot find package "github.com/airbrake/gobrake/v4" in any of:
        /usr/local/go/src/github.com/airbrake/gobrake/v4 (from $GOROOT)
        /Users/***/go/src/github.com/airbrake/gobrake/v4 (from $GOPATH)

Trying dep ensure -add "github.com/airbrake/gobrake/v4" yields:

Fetching sources...

Solving failure: No versions of github.com/airbrake/gobrake met constraints:
        v3.7.4: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.3: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.2: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.7.3: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.7.2: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.7.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.7.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.6.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.6.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.5.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.5.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.4.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.4.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.3.2: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.3.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.3.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.2.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.1.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.0.3: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.0.2: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.0.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v3.0.0: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.9: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.8: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.7: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.6: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.5: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.4: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.3: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.2: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2.0.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v1.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v1: Could not introduce github.com/airbrake/gobrake@v1, as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.9: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.8: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.7: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.6: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.5: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.4: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.3: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.2: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.10: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta.1: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v4.0.0-beta: Could not introduce github.com/airbrake/[email protected], as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        master: Could not introduce github.com/airbrake/gobrake@master, as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        v2: Could not introduce github.com/airbrake/gobrake@v2, as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)
        rm: Could not introduce github.com/airbrake/gobrake@rm, as its subpackage github.com/airbrake/gobrake/v4 is missing. (Package is required by (root).)

Which make sense as there's no github.com/airbrake/gobrake/v4.
I see in the README two imports, using github.com/airbrake/gobrake/v4 and github.com/airbrake/gobrake. So which one is the correct ?

Finally running dep ensure -add "github.com/airbrake/gobrake" works, but that installs an older version: v3.7.4

Am I missing something here ? Thanks !

Tests fails when using vgo

Hi!

I started using vgo in some my projects, and when I try to 'test all' in vgo gobrake test fails

• Failure [0.003 seconds]
Notifier
/Users/elvis/prog/go/src/v/gopkg.in/airbrake/[email protected]/notifier_test.go:25
  reports error and backtrace [It]
  /Users/elvis/prog/go/src/v/gopkg.in/airbrake/[email protected]/notifier_test.go:58

  Expected
      <string>: "...OOT]/v/gopk..."
  to equal               |
      <string>: "...OOT]/gopkg...."

  /Users/elvis/prog/go/src/v/gopkg.in/airbrake/[email protected]/notifier_test.go:64
------------------------------
•••••

Summarizing 1 Failure:

[Fail] Notifier [It] reports error and backtrace
/Users/elvis/prog/go/src/v/gopkg.in/airbrake/[email protected]/notifier_test.go:64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.