Example #1
0
def process_event(header, event):
    """
    Notify ratchet.io about this query if the event passes the heuristics.
    """
    for name, heuristic in heuristics.iteritems():
        level = heuristic(header, event)
        if level and NOTIFICATION_LEVELS[level] >= notification_level:
            extra = {'header': header, 'data': event}
            ratchet.report_message(name, level=level, extra_data=extra, payload_data={'language': 'sql'})
Example #2
0
def application(environ, start_response):
    request = webob.Request(environ)
    status = '200 OK'

    headers = [('Content-Type', 'text/html')]

    start_response(status, headers)
    
    yield '<p>Hello world</p>'

    try:
        # will raise a NameError about 'bar' not being defined
        foo = bar
    except:
        # report full exception info
        ratchet.report_exc_info(sys.exc_info(), request)
        
        # and/or, just send a string message with a level
        ratchet.report_message("Here's a message", 'info', request)
    
        yield '<p>Caught an exception</p>'