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

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

Issue 1531573003: Handle multiple modifications to distribution metrics correctly. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add a missing test for coverage Created 5 years 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 errors that can be raised by the monitoring library.""" 5 """Classes representing errors that can be raised by the monitoring library."""
6 6
7 7
8 class MonitoringError(Exception): 8 class MonitoringError(Exception):
9 """Base class for exceptions raised by this module.""" 9 """Base class for exceptions raised by this module."""
10 10
11 11
12 class MonitoringDecreasingValueError(MonitoringError): 12 class MonitoringDecreasingValueError(MonitoringError):
13 """Raised when setting a metric value that should increase but doesn't.""" 13 """Raised when setting a metric value that should increase but doesn't."""
14 14
15 def __init__(self, metric, old_value, new_value): 15 def __init__(self, metric, old_value, new_value):
16 self.metric = metric, 16 self.metric = metric
17 self.old_value = old_value 17 self.old_value = old_value
18 self.new_value = new_value 18 self.new_value = new_value
19 19
20 def __str__(self): 20 def __str__(self):
21 return ('Monotonically increasing metric "%s" was given value "%s", which ' 21 return ('Monotonically increasing metric "%s" was given value "%s", which '
22 'is not greater than or equal to "%s".' % ( 22 'is not greater than or equal to "%s".' % (
23 self.metric, self.new_value, self.old_value)) 23 self.metric, self.new_value, self.old_value))
24 24
25 25
26 class MonitoringDuplicateRegistrationError(MonitoringError): 26 class MonitoringDuplicateRegistrationError(MonitoringError):
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 108
109 class UnknownModificationTypeError(MonitoringError): 109 class UnknownModificationTypeError(MonitoringError):
110 """Raised when using a Modification with an unknown type value.""" 110 """Raised when using a Modification with an unknown type value."""
111 111
112 def __init__(self, mod_type): 112 def __init__(self, mod_type):
113 self.mod_type = mod_type 113 self.mod_type = mod_type
114 114
115 def __str__(self): 115 def __str__(self):
116 return 'Unknown modification type "%s"' % self.mod_type 116 return 'Unknown modification type "%s"' % self.mod_type
OLDNEW
« no previous file with comments | « appengine_module/gae_ts_mon/test/memcache_metric_store_test.py ('k') | infra_libs/ts_mon/common/metric_store.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698