Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: appengine/findit/handlers/crash/fracas_crash.py

Issue 1852383002: [Findit] Integrate with Fracas through Pub/Sub. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import base64
6 import json
7 import logging
8
9 from base_handler import BaseHandler
10 from base_handler import Permission
11 from common import constants
12 from crash import fracas_crash_pipeline
13 from model.crash.crash_config import CrashConfig
14
15
16 FRACAS_ANALYSIS_QUEUE = 'fracas-crash-queue'
17
18
19 class FracasCrash(BaseHandler):
20 PERMISSION_LEVEL = Permission.ANYONE
21
22 def HandlePost(self):
23 """Handles push delivery from Pub/Sub for crash data."""
24 token = self.request.get('token', '').strip()
25 crash_config = CrashConfig.Get()
26 if token != crash_config.fracas.get('crash_data_push_token'):
27 logging.warning('Unauthorized access.')
28 return self.CreateError(
29 'Unauthorized access: invalid token "%s"' % token, 403)
30
31 received_message = json.loads(self.request.body)
32 pubsub_message = received_message['message']
33 crash_data = json.loads(base64.b64decode(pubsub_message['data']))
34
35 logging.info('Processing message %s from subscription %s.',
36 pubsub_message['message_id'], received_message['subscription'])
37
38 fracas_crash_pipeline.ScheduleNewAnalysisForCrash(
39 crash_data['channel'], crash_data['platform'], crash_data['signature'],
mimee 2016/04/07 23:43:09 I prefer passing the object and unpacking it in th
stgao 2016/04/08 01:14:08 I'd unpack the json here to prevent malformed data
40 crash_data['stack_trace'], crash_data['chrome_version'],
41 crash_data['cpm'], queue_name=constants.CRASH_ANALYSIS_FRACAS_QUEUE)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698