Skip to main content

Sample client for Errormator reporting

Project description

errormator_client

usage (example for pyramid):

in your ini add:

#exception gathering
[filter:errormator_client]
use = egg:errormator_client
debug = false
errormator = true
errormator.server_url = https://api.errormator.com
errormator.api_key = YOUR_API_KEY
#404 gathering
errormator.report_404 = true

[pipeline:main]
    pipeline =
    weberror
    errormator_client
    .....your pipeline....
    app_name

for pylons app you can modify config/middleware.py: import the callable and add this lines:

#exception gathering
# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)

app = make_errormator_middleware(app,config)

and add in your ini:

errormator = true
errormator.server_url = https://api.errormator.com
errormator.api_key = YOUR_API_KEY
errormator.report_404 = true

additional config variables you can set in config object:

errormator.server_name - identifier for Instance/Server Name your application is running on (default: auto determined fqdn of server)
errormator.timeout - connection timeout when communicating with API
errormator.reraise_exceptions - reraise exceptions when wsgi catches exception
errormator.slow_requests - record slow requests in application (needs to be enabled for slow datastore recording)
errormator.logging - enable hooking to application loggers
errormator.logging.level - minimum log level for log capture
errormator.datastores - enable query execution tracking for various datastore layers
errormator.slow_request_time - (float/int) time in seconds after request is considered being slow (default 30)
errormator.slow_query_time - (float/int) time in seconds after datastore sql query is considered being slow (default 7)
errormator.datastores.sqlalchemy = default true - tries to enable sqlalchemy query logging
errormator.report_404 - enables 404 error logging (default False)
errormator.report_errors - enables 500 error logging (default True)
errormator.buffer_flush_interval - how often send data to mothership Errormator (default 5)
errormator.force_send - send all data after request is finished - handy for crons or other voliatile applications

errormator_client is BSD licensed, consult LICENSE for details.

Exception views in pyramid and Errormator

Pyramid uses exception views to serve nice html templates when exception occurs. Unfortunately this means that exception is handled BEFORE it reaches errormator’s middleware so 500 error data will never get sent to errormator.

This is how you can handle error handling inside your error_view:

def error_view(exc, request):
    from errormator_client.exceptions import get_current_traceback
    traceback = get_current_traceback(skip=1, show_hidden_frames=True, ignore_system_exceptions=True)
    request.environ['errormator.client'].py_report(request.environ, traceback, message=None,http_status=500)
    request.response.status = 500
    return {}

Sensitive data filtering

The client by default blanks out COOKIE,POST,GET for keys like: ‘password’,’passwd’,’pwd’,’auth_tkt’

This behaviour can be altered to filter all kinds of data from the structures that get sent to the server by passing dotted module name in configuration:

errormator.filter_callable = foo.bar.baz:callable_name

example:

def callable_name(structure, section=None):
    structure['request']['SOMEVAL'] = '***REMOVED***'
    return structure

Errormator will try to import foo.bar.baz and use callable_name as the function that accepts parameters (structure, section) and returns altered data structure.

Please note that this functionality can be used to alter things like errormator grouping mechanism - you can set this variable based on values present in structure generated by the client

Installation and Setup

Install errormator_client using pip:

pip_install errormator-client

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

errormator_client-0.3.7.tar.gz (14.7 kB view details)

Uploaded Source

File details

Details for the file errormator_client-0.3.7.tar.gz.

File metadata

File hashes

Hashes for errormator_client-0.3.7.tar.gz
Algorithm Hash digest
SHA256 b7f16163e6c4855e31add451d4c562cb366a18ff9c328a98d8749f5718b024c7
MD5 fce5a26b5be3354b35314596f4b6ae5f
BLAKE2b-256 99f7d7e616ee4e51c0d7b9a72e819848e1ef4f478833d6acbc8ee9db373c6b57

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page