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

Side by Side Diff: infra_libs/ts_mon/common/metrics.py

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: set correct metric and target fields 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
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 """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 monacq.proto import metrics_pb2 12 try:
13 13 from infra_libs.ts_mon import interface
14 from infra_libs.ts_mon import distribution 14 from infra_libs.ts_mon.common import distribution
15 from infra_libs.ts_mon import errors 15 from infra_libs.ts_mon.common import errors
16 from infra_libs.ts_mon import interface 16 from monacq.proto import metrics_pb2
17 except ImportError:
18 from gae_ts_mon import interface
19 from gae_ts_mon.common import distribution
20 from gae_ts_mon.common import errors
21 from gae_ts_mon.proto import metrics_pb2
17 22
18 23
19 MICROSECONDS_PER_SECOND = 1000000 24 MICROSECONDS_PER_SECOND = 1000000
20 25
21 26
22 class Metric(object): 27 class Metric(object):
23 """Abstract base class for a metric. 28 """Abstract base class for a metric.
24 29
25 A Metric is an attribute that may be monitored across many targets. Examples 30 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 31 include disk usage or the number of requests a server has received. A single
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 430
426 def __init__( 431 def __init__(
427 self, name, bucketer=None, target=None, fields=None, time_fn=time.time): 432 self, name, bucketer=None, target=None, fields=None, time_fn=time.time):
428 super(NonCumulativeDistributionMetric, self).__init__( 433 super(NonCumulativeDistributionMetric, self).__init__(
429 name, 434 name,
430 is_cumulative=False, 435 is_cumulative=False,
431 bucketer=bucketer, 436 bucketer=bucketer,
432 target=target, 437 target=target,
433 fields=fields, 438 fields=fields,
434 time_fn=time_fn) 439 time_fn=time_fn)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698