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

Side by Side Diff: appengine/cr-buildbucket/api.py

Issue 1903653002: buildbucket: fix instrumentation (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: disable gae_ts_mon in api_test.py 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
« no previous file with comments | « no previous file | appengine/cr-buildbucket/test/api_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 functools 5 import functools
6 import json 6 import json
7 import logging 7 import logging
8 8
9 from google.appengine.ext import ndb 9 from google.appengine.ext import ndb
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 166
167 def buildbucket_api_method( 167 def buildbucket_api_method(
168 request_message_class, response_message_class, **kwargs): 168 request_message_class, response_message_class, **kwargs):
169 """Extends auth.endpoints_method by converting service errors.""" 169 """Extends auth.endpoints_method by converting service errors."""
170 170
171 endpoints_decorator = auth.endpoints_method( 171 endpoints_decorator = auth.endpoints_method(
172 request_message_class, response_message_class, **kwargs) 172 request_message_class, response_message_class, **kwargs)
173 173
174 def decorator(fn): 174 def decorator(fn):
175 fn = catch_errors(fn, response_message_class)
176 fn = endpoints_decorator(fn)
177 fn = ndb.toplevel(fn)
175 def ts_mon_time(): 178 def ts_mon_time():
176 return utils.datetime_to_timestamp(utils.utcnow()) / 1000000.0 179 return utils.datetime_to_timestamp(utils.utcnow()) / 1000000.0
177 fn = gae_ts_mon.instrument_endpoint(time_fn=ts_mon_time)(fn) 180 fn = gae_ts_mon.instrument_endpoint(time_fn=ts_mon_time)(fn)
178 fn = catch_errors(fn, response_message_class)
179 fn = endpoints_decorator(fn)
180 fn = ndb.toplevel(fn)
181 return fn 181 return fn
182 182
183 return decorator 183 return decorator
184 184
185 185
186 def parse_json(json_data, param_name): 186 def parse_json(json_data, param_name):
187 if not json_data: 187 if not json_data:
188 return None 188 return None
189 try: 189 try:
190 return json.loads(json_data) 190 return json.loads(json_data)
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 ), 610 ),
611 DeleteManyBuildsResponse, 611 DeleteManyBuildsResponse,
612 path='bucket/{bucket}/delete', http_method='POST') 612 path='bucket/{bucket}/delete', http_method='POST')
613 @auth.public 613 @auth.public
614 def delete_many_builds(self, request): 614 def delete_many_builds(self, request):
615 """Deletes scheduled or started builds in a bucket.""" 615 """Deletes scheduled or started builds in a bucket."""
616 service.delete_many_builds( 616 service.delete_many_builds(
617 request.bucket, request.status, 617 request.bucket, request.status,
618 tags=request.tag[:], created_by=request.created_by) 618 tags=request.tag[:], created_by=request.created_by)
619 return self.DeleteManyBuildsResponse() 619 return self.DeleteManyBuildsResponse()
OLDNEW
« no previous file with comments | « no previous file | appengine/cr-buildbucket/test/api_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698