Esempio n. 1
0
def create_sample_event(project,
                        platform=None,
                        default=None,
                        tags=None,
                        release=None):
    if not platform:
        platform = project.platform

    if not platform and not default:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    data = load_data(platform, default)

    if not data:
        return

    if tags:
        data['tags'] = tags

    if release:
        data['release'] = release

    manager = EventManager(data)
    manager.normalize()
    return manager.save(project.id, raw=True)
Esempio n. 2
0
File: docs.py Progetto: slafs/sentry
def client_guide(request, organization, project, platform):
    if platform not in PLATFORM_LIST:
        return HttpResponseRedirect(reverse('sentry'))

    template = 'sentry/partial/client_config/%s.html' % (platform, )

    context = {
        'platform': platform,
        'platform_title': PLATFORM_TITLES.get(platform, platform.title()),
        'organization': organization,
        'team': project.team,
        'project': project,
        'page': 'client_help_%s' % (PLATFORM_ROOTS.get(platform, platform), ),
        'SUBSECTION': 'projects',
        'SECTION': 'team',
    }
    context.update(get_key_context(request.user, project))

    if request.is_ajax():
        return render_to_response(template, context, request)

    context['template'] = render_to_string(template, context, request)

    return render_to_response('sentry/projects/docs/client_config.html',
                              context, request)
Esempio n. 3
0
def _capture_stats(event, is_new):
    group = event.group
    platform = group.platform or group.project.platform
    if not platform:
        return
    platform = PLATFORM_ROOTS.get(platform, platform)
    if platform not in PLATFORM_LIST:
        return

    if is_new:
        metrics.incr("events.unique", 1)

    metrics.incr("events.processed", 1)
    metrics.incr("events.processed.{platform}".format(platform=platform), 1)
    metrics.timing("events.size.data", len(unicode(event.data)))
Esempio n. 4
0
def _capture_stats(event, is_new):
    group = event.group
    platform = group.platform or group.project.platform
    if not platform:
        return
    platform = PLATFORM_ROOTS.get(platform, platform)
    if platform not in PLATFORM_LIST:
        return

    if is_new:
        metrics.incr('events.unique', 1)

    metrics.incr('events.processed', 1)
    metrics.incr('events.processed.{platform}'.format(platform=platform), 1)
    metrics.timing('events.size.data', len(unicode(event.data)))
Esempio n. 5
0
def create_sample_event(project, platform=None):
    if not platform:
        platform = project.platform

    if not platform:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    data = load_data(platform)

    if not data:
        return

    data = Group.objects.normalize_event_data(data)
    return Group.objects.save_data(project.id, data, raw=True)
Esempio n. 6
0
def create_sample_event(project, platform=None):
    if not platform:
        platform = project.platform

    if not platform:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    data = load_data(platform)

    if not data:
        return

    data = Group.objects.normalize_event_data(data)
    return Group.objects.save_data(project.id, data, raw=True)
Esempio n. 7
0
def create_sample_event(project, platform=None, default=None):
    if not platform:
        platform = project.platform

    if not platform and not default:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    data = load_data(platform, default)

    if not data:
        return

    manager = EventManager(data)
    manager.normalize()
    return manager.save(project.id, raw=True)
Esempio n. 8
0
def create_sample_event(project, platform=None, default=None):
    if not platform:
        platform = project.platform

    if not platform and not default:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    data = load_data(platform, default)

    if not data:
        return

    manager = EventManager(data)
    manager.normalize()
    return manager.save(project.id, raw=True)
Esempio n. 9
0
def create_sample_event(project, platform=None):
    if not platform:
        platform = project.platform

    if not platform:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    json_path = os.path.join(DATA_ROOT, 'samples',
                             '%s.json' % (platform.encode('utf-8'), ))

    if not os.path.exists(json_path):
        return

    with open(json_path) as fp:
        data = json.loads(fp.read())

    data['platform'] = platform
    data['message'] = 'This is an example %s exception' % (PLATFORM_TITLES.get(
        platform, platform.title()), )
    data['sentry.interfaces.User'] = {
        "username": "******",
        "id": "1671",
        "email": "*****@*****.**"
    }
    data['sentry.interfaces.Http'] = {
        "cookies": {},
        "url": "http://example.com/foo",
        "headers": {
            "Referer":
            "http://example.com",
            "User-Agent":
            "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"
        },
        "env": {},
        "query_string": "",
        "data": {},
        "method": "GET"
    }
    data = Group.objects.normalize_event_data(data)
    return Group.objects.save_data(project.id, data, raw=True)
Esempio n. 10
0
def create_sample_event(project, platform=None, default=None, tags=None,
                        release=None):
    if not platform and not default:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    data = load_data(platform, default)

    if not data:
        return

    if tags:
        data['tags'] = tags

    if release:
        data['release'] = release

    manager = EventManager(data)
    manager.normalize()
    return manager.save(project.id, raw=True)
Esempio n. 11
0
def client_guide(request, project, platform):
    if platform not in PLATFORM_LIST:
        return HttpResponseRedirect(reverse('sentry'))

    template = 'sentry/partial/client_config/%s.html' % (platform,)

    context = {
        'platform': platform,
        'platform_title': PLATFORM_TITLES.get(platform, platform.title()),
        'project': project,
        'page': 'client_help_%s' % (PLATFORM_ROOTS.get(platform, platform),),
        'SECTION': 'settings',
    }
    context.update(get_key_context(request.user, project))

    if request.is_ajax():
        return render_to_response(template, context, request)

    context['template'] = render_to_string(template, context, request)

    return render_to_response('sentry/projects/docs/client_config.html', context, request)
Esempio n. 12
0
def create_sample_event(project, platform=None):
    if not platform:
        platform = project.platform

    if not platform:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    json_path = os.path.join(DATA_ROOT, 'samples', '%s.json' % (platform.encode('utf-8'),))

    if not os.path.exists(json_path):
        return

    with open(json_path) as fp:
        data = json.loads(fp.read())

    data['platform'] = platform

    data = Group.objects.normalize_event_data(data)
    return Group.objects.save_data(project.id, data, raw=True)
Esempio n. 13
0
def create_sample_event(project, platform=None):
    if not platform:
        platform = project.platform

    if not platform:
        return

    platform = PLATFORM_ROOTS.get(platform, platform)

    json_path = os.path.join(DATA_ROOT, 'samples', '%s.json' % (platform.encode('utf-8'),))

    if not os.path.exists(json_path):
        return

    with open(json_path) as fp:
        data = json.loads(fp.read())

    data['platform'] = platform
    data['message'] = 'This is an example %s exception' % (
        PLATFORM_TITLES.get(platform, platform.title()),)
    data['sentry.interfaces.User'] = {
        "username": "******",
        "id": "1671",
        "email": "*****@*****.**"
    }
    data['sentry.interfaces.Http'] = {
        "cookies": {},
        "url": "http://example.com/foo",
        "headers": {
            "Referer": "http://example.com",
            "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"
        },
        "env": {},
        "query_string": "",
        "data": {},
        "method": "GET"
    }
    data = Group.objects.normalize_event_data(data)
    return Group.objects.save_data(project.id, data, raw=True)