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

Unified Diff: appengine/cr-buildbucket/api.py

Issue 2170673002: buildbucket: add longest_pending_time API (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: nits Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/cr-buildbucket/index.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cr-buildbucket/api.py
diff --git a/appengine/cr-buildbucket/api.py b/appengine/cr-buildbucket/api.py
index 23c54a466f58b4d13da2513c5fefd51aa02e9e46..b25023608983c5b2ea86a78cfa3cd63c6c6bfeca 100644
--- a/appengine/cr-buildbucket/api.py
+++ b/appengine/cr-buildbucket/api.py
@@ -651,4 +651,26 @@ class BuildBucketApi(remote.Service):
config_file_content=bucket.config_content,
config_file_rev=bucket.revision,
config_file_url=config.get_buildbucket_cfg_url(bucket.project_id),
- )
+ )
+
+ ########################### LONGEST_PENDING_TIME ############################
+
+ class LongestPendingTimeResponse(messages.Message):
+ longest_pending_time_sec = messages.FloatField(1)
+ error = messages.MessageField(ErrorMessage, 2)
+
+ @buildbucket_api_method(
+ endpoints.ResourceContainer(
+ message_types.VoidMessage,
+ bucket=messages.StringField(1, required=True),
+ builder=messages.StringField(2, required=True),
+ ),
+ LongestPendingTimeResponse,
+ path='metrics/longest-pending-time', http_method='GET')
+ @auth.public
+ def longest_pending_time(self, request):
+ """Returns longest pending time among all SCHEDULED builds of a builder."""
+ wait_time = service.longest_pending_time(request.bucket, request.builder)
+ return self.LongestPendingTimeResponse(
+ longest_pending_time_sec=wait_time.total_seconds(),
+ )
« no previous file with comments | « no previous file | appengine/cr-buildbucket/index.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698