Skip to content

Instantly share code, notes, and snippets.

@matagus
Created July 19, 2012 20:14
Show Gist options
  • Save matagus/3146463 to your computer and use it in GitHub Desktop.
Save matagus/3146463 to your computer and use it in GitHub Desktop.
recording exception to New Relic using python agent
import sys
import newrelic.agent
try:
# ...
# some code
# ...
except Exception as e:
exc_info = sys.exc_info()
newrelic.agent.record_exception(exc_info[0], exc_info[1], exc_info[2])
@catalanojuan
Copy link

Yo lo abstraería un toque, para no tener código propio de new relic por toda nuestra app. Tendría algún helper en streema.apps.utils.exceptions que nos sirva para "loggear" excepciones y ahi si ponemos el código de newrelic just once. Cosa que si nos deprecan algo o dejamos de usar newrelic para usar otra cosa, el código cambie en un solo lugar y no en todas partes.

@matagus
Copy link
Author

matagus commented Jul 20, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment