Exemplo n.º 1
0
def create_opbeat_client(request, app_id):
    secret_token = get_opbeat_setting(request, 'secret_token')
    organization_id = get_opbeat_setting(request, 'organization_id')

    return opbeat.Client(
        secret_token=secret_token,
        organization_id=organization_id,
        app_id=app_id,
    )
Exemplo n.º 2
0
def opbeat_logging():
    client = opbeat.Client()

    handler = OpbeatHandler(client)

    logger = logging.getLogger()
    logger.addHandler(handler)

    try:
        yield
    except Exception:
        client.capture_exception()
        raise
Exemplo n.º 3
0
from pymemcache.client.base import Client

from parsers import IS
from parsers import FR
from parsers import ENTSOE
from parsers import weather
from migrate_db import migrate

INTERVAL_SECONDS = 60 * 5

# Set up error handling
import opbeat
from opbeat.handlers.logging import OpbeatHandler
if 'OPBEAT_SECRET' in os.environ:
    opbeat_client = opbeat.Client(
        app_id='c36849e44e',
        organization_id='093c53b0da9d43c4976cd0737fe0f2b1',
        secret_token=os.environ['OPBEAT_SECRET'])
else:
    opbeat_client = None
    print "No Opbeat Token found! Opbeat Error handling is inactive."

# Set up logging
ENV = os.environ.get('ENV', 'development').lower()
logger = logging.getLogger(__name__)
stdout_handler = logging.StreamHandler()
logger.addHandler(stdout_handler)
if not ENV == 'development':
    logger.setLevel(logging.INFO)
    # Add opbeat
    if opbeat_client:
        opbeat_handler = OpbeatHandler(opbeat_client)