from sentry.app import cache, env from sentry.constants import DEFAULT_LOG_LEVEL, LOG_LEVELS, MAX_TAG_VALUE_LENGTH, MAX_TAG_KEY_LENGTH from sentry.exceptions import InvalidTimestamp from sentry.interfaces.base import get_interface from sentry.models import Project, ProjectKey from sentry.tasks.store import preprocess_event from sentry.utils import is_float, json from sentry.utils.auth import parse_auth_header from sentry.utils.compat import StringIO from sentry.utils.strings import decompress logger = logging.getLogger("sentry.coreapi") LOG_LEVEL_REVERSE_MAP = dict((v, k) for k, v in LOG_LEVELS.iteritems()) RESERVED_FIELDS = ( "project", "event_id", "message", "checksum", "culprit", "level", "time_spent", "logger", "server_name", "site", "timestamp", "extra", "modules",
""" from __future__ import absolute_import from collections import OrderedDict from django import forms from sentry.constants import LOG_LEVELS from sentry.rules.conditions.base import EventCondition LEVEL_CHOICES = OrderedDict([ ("{0}".format(k), "{0}".format(v.capitalize())) for k, v in sorted(LOG_LEVELS.items(), key=lambda x: x[0], reverse=True) ]) LOG_LEVEL_REVERSE_MAP = dict((v, k) for k, v in LOG_LEVELS.iteritems()) class LevelMatchType(object): EQUAL = 'eq' LESS_OR_EQUAL = 'lte' GREATER_OR_EQUAL = 'gte' class LevelEventForm(forms.Form): level = forms.ChoiceField(choices=LEVEL_CHOICES.items(), initial=30) match = forms.ChoiceField(choices=((LevelMatchType.EQUAL, 'equal'), (LevelMatchType.LESS_OR_EQUAL, 'less than or equal to'), (LevelMatchType.GREATER_OR_EQUAL, 'greater than or equal to')),
from sentry.utils import settings from sentry.plugins import Plugin from sentry.conf import server from sentry.utils.http import absolute_uri from sentry.web.helpers import render_to_string from sentry.constants import LOG_LEVELS import sentry_pushover import requests message_template = 'sentry_pushover/error.txt' message_template_alert = 'sentry_pushover/alert.txt' choices_levels = ((i, level.upper()) for i, level in LOG_LEVELS.iteritems()) choices_sounds = (( ('pushover', 'Pushover (default)'), ('bike', 'Bike'), ('bugle', 'Bugle'), ('cashregister', 'Cash Register'), ('classical', 'Classical'), ('cosmic', 'Cosmic'), ('falling', 'Falling'), ('gamelan', 'Gamelan'), ('incoming', 'Incoming'), ('intermission', 'Intermission'), ('magic', 'Magic'), ('mechanical', 'Mechanical'), ('pianobar', 'Piano Bar'), ('siren', 'Siren'),