| 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 """Classes representing individual metrics that can be sent.""" | 5 """Classes representing individual metrics that can be sent.""" |
| 6 | 6 |
| 7 | 7 |
| 8 import copy | 8 import copy |
| 9 import threading | 9 import threading |
| 10 import time | 10 import time |
| 11 | 11 |
| 12 from infra_libs.ts_mon.gae import distribution |
| 13 from infra_libs.ts_mon.gae import errors |
| 14 from infra_libs.ts_mon.gae import interface |
| 15 |
| 12 from monacq.proto import metrics_pb2 | 16 from monacq.proto import metrics_pb2 |
| 13 | 17 |
| 14 from infra_libs.ts_mon import distribution | |
| 15 from infra_libs.ts_mon import errors | |
| 16 from infra_libs.ts_mon import interface | |
| 17 | |
| 18 | 18 |
| 19 MICROSECONDS_PER_SECOND = 1000000 | 19 MICROSECONDS_PER_SECOND = 1000000 |
| 20 | 20 |
| 21 | 21 |
| 22 class Metric(object): | 22 class Metric(object): |
| 23 """Abstract base class for a metric. | 23 """Abstract base class for a metric. |
| 24 | 24 |
| 25 A Metric is an attribute that may be monitored across many targets. Examples | 25 A Metric is an attribute that may be monitored across many targets. Examples |
| 26 include disk usage or the number of requests a server has received. A single | 26 include disk usage or the number of requests a server has received. A single |
| 27 process may keep track of many metrics. | 27 process may keep track of many metrics. |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 425 |
| 426 def __init__( | 426 def __init__( |
| 427 self, name, bucketer=None, target=None, fields=None, time_fn=time.time): | 427 self, name, bucketer=None, target=None, fields=None, time_fn=time.time): |
| 428 super(NonCumulativeDistributionMetric, self).__init__( | 428 super(NonCumulativeDistributionMetric, self).__init__( |
| 429 name, | 429 name, |
| 430 is_cumulative=False, | 430 is_cumulative=False, |
| 431 bucketer=bucketer, | 431 bucketer=bucketer, |
| 432 target=target, | 432 target=target, |
| 433 fields=fields, | 433 fields=fields, |
| 434 time_fn=time_fn) | 434 time_fn=time_fn) |
| OLD | NEW |