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

Side by Side Diff: infra/tools/metric_tool/test/data/normal_case_2.py

Issue 1368583005: Create metric_tool to deal with metric definitions (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Added tests, print undocumented metrics Created 5 years, 2 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
(Empty)
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
3 # found in the LICENSE file.
4
5 """Example containing all metrics, all with descriptions.
6
7 Tests assume the description contains the name of the metric, without
8 the prefix.
9 """
10 from infra_libs.ts_mon import BooleanMetric, CounterMetric
11 from infra_libs.ts_mon import CumulativeDistributionMetric, CumulativeMetric
12 from infra_libs.ts_mon import DistributionMetric, FloatMetric
13 from infra_libs.ts_mon import GaugeMetric, NonCumulativeDistributionMetric
14 from infra_libs.ts_mon import StringMetric
15
16
17 metric1 = BooleanMetric('/my/metric1', description='metric1')
18 metric2 = CounterMetric('/my/metric2', description='metric2')
19 metric3 = CumulativeDistributionMetric('/my/metric3',
20 description='metric3')
Sergey Berezin 2015/09/29 00:01:18 nit: is the weird indentation a part of the test?
pgervais 2015/09/30 00:09:37 Done.
21 metric4 = CumulativeMetric('/my/metric4', description='metric4')
22 metric5 = DistributionMetric('/my/metric5', description='metric5')
23
24
25 # Add a wrapping function to check that we're finding those as well.
26 def nice_function():
27 # Checking that we really ignore comments.
28 # FloatMetric('/my/metric11', description='metric11')
29
30 metric6 = FloatMetric('/my/metric6', description='metric6')
31 metric7 = GaugeMetric('/my/metric7', description='metric7')
32 metric8 = NonCumulativeDistributionMetric('/my/metric8',
33 description='metric8')
Sergey Berezin 2015/09/29 00:01:18 nit: another weird indentation
pgervais 2015/09/30 00:09:37 Done.
34 metric9 = StringMetric('/my/metric9', description='metric9')
35 # Use all variables to silence pylint.
36 print metric6, metric7, metric8, metric9
37
38
39 # Some unrelated code to add noise
40 if __name__ == '__main__':
41 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698