• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

evalphobia / logrus_sentry / 102 / 5
81%
master: 81%

Build:
DEFAULT BRANCH: master
Ran 14 Jun 2017 01:43AM UTC
Files 3
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Jun 2017 01:40AM UTC coverage: 83.473% (-0.3%) from 83.747%
102.5

push

travis-ci

evalphobia
Stop double-buffering in async hook (#47)

The underlying Raven Sentry client already is asynchronous with an adjustable
buffer size. Unlike the buffer in logrus_sentry, Raven drops packets when the
buffer is filled (and calls an optional DropHandler when it does so).

The existing implementation of async hooks does not drop packets when its buffer
fills, which means that the so-called "async" hook becomes synchronous if the
buffer fills, and the Raven packet-dropping logic most likely never has a chance
to do its tricks.  In our service, we discovered that bugs that caused errors to
spew to Sentry via logrus_sentry quickly hit this buffer's limit and caused our
service to stall, despite the supposedly "async" nature of the hook.

This commit changes logrus_sentry's async mode to be truly asynchronous: it
delivers packets to Raven, which either passes them to its background worker or
drops them if its buffer is full.  It then starts a new goroutine per packet to
log any errors and coordinate with the WaitGroup for flush.

The previous version of the code set a 1 second Timeout for async mode, which
effectively just allowed the worker goroutine to send the next packet to Raven
after 1 second.  Because we no longer have a separate worker goroutine, this
is no longer necessary.  A comment also mentions how to set a timeout for the
underlying HTTP POST, which achieves a similar goal of allowing Flush to finish
in a bounded amount of time.

Note that Raven's buffer size (100) is smaller than logrus_sentry's old buffer
size (8192), so users may want to increase raven.MaxQueueBuffer before
contructing the hook to avoid dropping packets.

Also follow the normal Go style of putting mutexes before the fields they
protect in struct definitions.

298 of 357 relevant lines covered (83.47%)

16.59 hits per line

Source Files on job 102.5
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 102
  • Travis Job 102.5
  • 2362c794 on github
  • Prev Job for on master (#100.5)
  • Next Job for on master (#104.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc