| OLD | NEW |
| 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 copy | 5 import copy |
| 6 import datetime | 6 import datetime |
| 7 import functools | 7 import functools |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 # Don't send metrics when running on the dev appserver. | 180 # Don't send metrics when running on the dev appserver. |
| 181 if (is_local_unittest or | 181 if (is_local_unittest or |
| 182 os.environ.get('SERVER_SOFTWARE', '').startswith('Development')): | 182 os.environ.get('SERVER_SOFTWARE', '').startswith('Development')): |
| 183 logging.info('Using debug monitor') | 183 logging.info('Using debug monitor') |
| 184 interface.state.global_monitor = monitors.DebugMonitor() | 184 interface.state.global_monitor = monitors.DebugMonitor() |
| 185 else: | 185 else: |
| 186 logging.info('Using pubsub monitor %s/%s', shared.PUBSUB_PROJECT, | 186 logging.info('Using pubsub monitor %s/%s', shared.PUBSUB_PROJECT, |
| 187 shared.PUBSUB_TOPIC) | 187 shared.PUBSUB_TOPIC) |
| 188 interface.state.global_monitor = monitors.PubSubMonitor( | 188 interface.state.global_monitor = monitors.PubSubMonitor( |
| 189 monitors.APPENGINE_CREDENTIALS, shared.PUBSUB_PROJECT, | 189 monitors.AppengineCredentials(), shared.PUBSUB_PROJECT, |
| 190 shared.PUBSUB_TOPIC) | 190 shared.PUBSUB_TOPIC) |
| 191 | 191 |
| 192 shared.register_global_metrics([shared.appengine_default_version]) | 192 shared.register_global_metrics([shared.appengine_default_version]) |
| 193 shared.register_global_metrics_callback( | 193 shared.register_global_metrics_callback( |
| 194 shared.INTERNAL_CALLBACK_NAME, _internal_callback) | 194 shared.INTERNAL_CALLBACK_NAME, _internal_callback) |
| 195 | 195 |
| 196 standard_metrics.init() | 196 standard_metrics.init() |
| 197 | 197 |
| 198 logging.info('Initialized ts_mon with service_name=%s, job_name=%s, ' | 198 logging.info('Initialized ts_mon with service_name=%s, job_name=%s, ' |
| 199 'hostname=%s', service_name, job_name, hostname) | 199 'hostname=%s', service_name, job_name, hostname) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 duration_secs * 1000, | 349 duration_secs * 1000, |
| 350 request_size=request_size, | 350 request_size=request_size, |
| 351 response_size=response_size, | 351 response_size=response_size, |
| 352 user_agent=request.META.get('HTTP_USER_AGENT', None)) | 352 user_agent=request.META.get('HTTP_USER_AGENT', None)) |
| 353 return response | 353 return response |
| 354 | 354 |
| 355 | 355 |
| 356 def reset_for_unittest(disable=False): | 356 def reset_for_unittest(disable=False): |
| 357 shared.reset_for_unittest() | 357 shared.reset_for_unittest() |
| 358 interface.reset_for_unittest(disable=disable) | 358 interface.reset_for_unittest(disable=disable) |
| OLD | NEW |