Coder Social home page Coder Social logo

ftw.raven's Introduction

This package extends raven, the Sentry integration with a Plone integration wich is not logger based but hooks into the Zope exception handling.

Be aware that there is already a standard logging based Zope / Plone integration for raven. You should use the standard implementation unless you want the exception hook based integration.

  • Add the ftw.raven package to your dependencies.
  • Configure the raven client with environment variables in buildout

Example configuration for buildout:

[instance]
eggs +=
    ftw.raven
environment-vars +=
    RAVEN_DSN https://123:[email protected]/2

You can test your configuration by visiting the view raven-test on any context as Manager-user. This will trigger an exception which should appear in your sentry project.

Note that it's possible that the trigger doesn't work on local test systems in some cases.

In JavaScript you can call the function raven_test() in your javascript console, which will also trigger an exception.

When an exception is reported, the release can be sent along. A release can either be the version number of a released distribution (e.g. released on pypi) or the HEAD SHA of a project checkout when the app is not released on pypi.

For using a distribution version as release, the environment variable RAVEN_PROJECT_DIST must contain the name of the distribution, e.g.

[instance]
environment-vars +=
    RAVEN_PROJECT_DIST my.project

Usually the buildout root is a checkout of the project, thus we need to configured the RAVEN_BUILDOUT_ROOT so that the git repository is found:

[instance]
environment-vars +=
    RAVEN_BUILDOUT_ROOT ${buildout:directory}

By default, not all exceptions are reported, because some exceptions such as redirects or 404s are not errors but are implemented as exceptions. Without configuration, the exceptions NotFound, Unauthorized, Redirect and Intercepted.

Reporting of those exceptions can be enabled by with the environment variable RAVEN_ENABLE_EXCEPTIONS:

[instance]
environment-vars +=
    RAVEN_ENABLE_EXCEPTIONS NotFound, Redirect

If you need to disable custom exceptions, you can do that with the environment variable RAVEN_DISABLE_EXCEPTIONS:

[instance]
environment-vars +=
    RAVEN_DISABLE_EXCEPTIONS UnimportantError

In order to be able to report JavaScript-errors, the ftw.raven:default Generic Setup profile must be installed, which registers a JavaScript including the raven library and the configuration.

It is possible to report additional, predefined tags for a deployment. The tags may be directly declared as JSON in the environment variable RAVEN_TAGS or the variable RAVEN_TAGS_FILE may contain a path to a json-file. These two methods may be combined, and the respective dictionaries will be merged (with tags from the RAVEN_TAGS variable taking precedence).

The JSON must be a one-level hash containing strings as keys and values.

Examples:

[instance]
environment-vars +=
    RAVEN_TAGS {"deployment": "production"}
[instance]
environment-vars +=
    RAVEN_TAGS_FILE ${buildout:directory}/conf/raven_tags.json

This package is copyright by 4teamwork.

ftw.raven is licensed under GNU General Public License, version 2.

ftw.raven's People

Contributors

jone avatar mbaechtold avatar nachtalb avatar 2e12 avatar deiferni avatar bierik avatar lukasgraf avatar maethu avatar

Stargazers

Michael Graf avatar

Watchers

Thomas Buchberger avatar  avatar  avatar Philippe Gross avatar 4teamwork Jenkins avatar James Cloos avatar Bernhard Bühlmann avatar Furkan Kalınsaz avatar Nicola Lorenz avatar  avatar Daniel Jowett avatar

ftw.raven's Issues

Releases: append git hash when dist is checked out

When a RAVEN_PROJECT_DIST is configured (and no RAVEN_BUILDOUT_ROOT), we should detect a source checkout (maybe based on .dev0 version ending).
If it is a source checkout, we should try to get the git SHA1 and append it to the release (e.g. 3.2.1.dev0@945a4ee).

JavaScript: wrong typeof condition

diff --git a/ftw/raven/browser/resources/raven-integration.js b/ftw/raven/browser/resources/raven-integration.js
index 9712ffe..ce7b2f1 100644
--- a/ftw/raven/browser/resources/raven-integration.js
+++ b/ftw/raven/browser/resources/raven-integration.js
@@ -1,4 +1,4 @@
-if (typeof(raven_config) != undefined) {
+if (typeof(raven_config) != typeof(undefined)) {
   // From: https://gist.github.com/impressiver/5092952
   var ravenOptions = {
     // Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.

Not working in Plone 5

Can we have a version of this that works with Plone 5? The main issues are the resource-registration and plone.app.linkintegrity with was rewritten to no longer monkeypatch the zpublisher_exception_hook

Include the error number of error_log when possible

A user usually sees a error number when an error occurs on Plone.
It would be great if the error in sentry could be found with this number.

We're currently not reporting the number, since this is another part of error handling, but we should try to do so.

optimize raven.js caching

At the moment, the raven.js is loaded at each request, possibly blocking.
We should add caches.
The problem is that it contains user-specific details at the moment.
We could probably use inline rendering for the user details for improving speed.

Support for adding custom tags

It would be nice if we could supply user-defined tags.

This would for example allow us to sum up a couple staging deployments (DEV, TEST, ...) under the same Sentry project, but distinguish them via the corresponding tags.

From what I can tell, these would need to be included in the prepared data structure here.

resolved conflict errors are reported

When conflict errors are resolved by retrying, the are reported anyway.
Since this is an expected behavior and not wrong, they should maybe not be reported.

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.