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

Side by Side Diff: infra_libs/httplib2_utils.py

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add noncululativedistribution metric to ts_mon imports Created 5 years, 4 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 | « infra_libs/http_metrics.py ('k') | infra_libs/instrumented_requests.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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 json 5 import json
6 import logging 6 import logging
7 import os 7 import os
8 import time 8 import time
9 9
10 import httplib2 10 import httplib2
11 import oauth2client.client 11 import oauth2client.client
12 12
13 from infra_libs import http_metrics 13 from infra_libs.ts_mon.common import http_metrics
14 14
15 DEFAULT_SCOPES = ['email'] 15 DEFAULT_SCOPES = ['email']
16 16
17 # This is part of the API. 17 # This is part of the API.
18 # TODO: this is linux-specific, make it multi-platform. 18 # TODO: this is linux-specific, make it multi-platform.
19 SERVICE_ACCOUNTS_CREDS_ROOT = '/creds/service_accounts' 19 SERVICE_ACCOUNTS_CREDS_ROOT = '/creds/service_accounts'
20 20
21 21
22 class AuthError(Exception): 22 class AuthError(Exception):
23 pass 23 pass
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 duration_msec = (self.time_fn() - start_time) * 1000 168 duration_msec = (self.time_fn() - start_time) * 1000
169 169
170 http_metrics.response_bytes.add(len(content), fields=self.fields) 170 http_metrics.response_bytes.add(len(content), fields=self.fields)
171 http_metrics.durations.add(duration_msec, fields=self.fields) 171 http_metrics.durations.add(duration_msec, fields=self.fields)
172 172
173 status_fields = {'status': response.status} 173 status_fields = {'status': response.status}
174 status_fields.update(self.fields) 174 status_fields.update(self.fields)
175 http_metrics.response_status.increment(fields=status_fields) 175 http_metrics.response_status.increment(fields=status_fields)
176 176
177 return response, content 177 return response, content
OLDNEW
« no previous file with comments | « infra_libs/http_metrics.py ('k') | infra_libs/instrumented_requests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698