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

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

Issue 1946513003: [Findit] Modify the handler for fracas input message. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 7 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
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import base64 5 import base64
6 import json 6 import json
7 import logging 7 import logging
8 8
9 from common import constants 9 from common import constants
10 from common.base_handler import BaseHandler 10 from common.base_handler import BaseHandler
11 from common.base_handler import Permission 11 from common.base_handler import Permission
12 from crash import fracas_crash_pipeline 12 from crash import fracas_crash_pipeline
13 13
14 14
15 class FracasCrash(BaseHandler): 15 class FracasCrash(BaseHandler):
16 PERMISSION_LEVEL = Permission.ANYONE 16 PERMISSION_LEVEL = Permission.ANYONE
17 17
18 def HandlePost(self): 18 def HandlePost(self):
19 """Handles push delivery from Pub/Sub for crash data. 19 """Handles push delivery from Pub/Sub for crash data.
20 20
21 The crash data should be in the following json format: 21 The crash data should be in the following json format:
22 { 22 {
23 'channel': 'canary', 23 "customized_data": {
24 'platform': 'win', 24 "channel": "beta",
25 'signature': 'namesapce1:namespace2:class_name:func_name', 25 "versions_to_historical": [
26 'stack_trace': 'frame1\nframe2\nframe3', 26 {
27 'chrome_version': '50.0.2500.0', 27 "chrome_version": "51.0.2693.2",
28 'versions_to_cpm': { 28 "cpm": 0.0610491148
29 '50.0.2500.0': 1.2, 29 },
30 '50.0.2499.0': 1.0, 30 {
31 "chrome_version": "51.0.2704.10",
32 "cpm": 0.0490386976
33 },
34 {
35 "chrome_version": "52.0.2718.2",
36 "cpm": 0.0040353297
37 }
38 ]
31 }, 39 },
40 "chrome_version": "51.0.2704.28",
41 "signature": "blink::FramePainter::paintContents",
42 "client_id": "fracas",
43 "platform": "android",
44 "crash_identifiers": {
45 "chrome_version": "51.0.2704.28",
46 "signature": "blink::FramePainter::paintContents",
47 "channel": "beta",
48 "platform": "android",
49 "process_type": null
50 },
51 "stack_trace": "CRASHED [SIGILL @ 0x5320e570]\\n#0 0x5320e570..."
32 } 52 }
33 """ 53 """
34 try: 54 try:
35 received_message = json.loads(self.request.body) 55 received_message = json.loads(self.request.body)
36 pubsub_message = received_message['message'] 56 pubsub_message = received_message['message']
37 crash_data = json.loads(base64.b64decode(pubsub_message['data'])) 57 crash_data = json.loads(base64.b64decode(pubsub_message['data']))
38 58
39 logging.info('Processing message %s from subscription %s.', 59 logging.info('Processing message %s from subscription %s.',
40 pubsub_message['message_id'], 60 pubsub_message['message_id'],
41 received_message['subscription']) 61 received_message['subscription'])
42 62
43 fracas_crash_pipeline.ScheduleNewAnalysisForCrash( 63 fracas_crash_pipeline.ScheduleNewAnalysisForCrash(
stgao 2016/05/03 18:58:34 ``crash_identifiers`` should be passed over, used
Sharu Jiang 2016/05/03 23:48:03 Done.
44 crash_data['channel'], crash_data['platform'], 64 crash_data['customized_data']['channel'], crash_data['platform'],
45 crash_data['signature'], crash_data['stack_trace'], 65 crash_data['signature'], crash_data['stack_trace'],
46 crash_data['chrome_version'], crash_data['versions_to_cpm'], 66 crash_data['chrome_version'],
67 crash_data['customized_data']['versions_to_historical'],
47 queue_name=constants.CRASH_ANALYSIS_FRACAS_QUEUE) 68 queue_name=constants.CRASH_ANALYSIS_FRACAS_QUEUE)
48 except (KeyError, ValueError): # pragma: no cover. 69 except (KeyError, ValueError): # pragma: no cover.
49 # TODO: save exception in datastore and create a page to show them. 70 # TODO: save exception in datastore and create a page to show them.
50 logging.exception('Failed to process fracas message') 71 logging.exception('Failed to process fracas message')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698