Chromium Code Reviews| Index: infra/tools/metric_tool/test/data/normal_case_2.py |
| diff --git a/infra/tools/metric_tool/test/data/normal_case_2.py b/infra/tools/metric_tool/test/data/normal_case_2.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c3a692c2d1a21405e488dc250a99d81379887b4b |
| --- /dev/null |
| +++ b/infra/tools/metric_tool/test/data/normal_case_2.py |
| @@ -0,0 +1,41 @@ |
| +# Copyright 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""Example containing all metrics, all with descriptions. |
| + |
| +Tests assume the description contains the name of the metric, without |
| +the prefix. |
| +""" |
| +from infra_libs.ts_mon import BooleanMetric, CounterMetric |
| +from infra_libs.ts_mon import CumulativeDistributionMetric, CumulativeMetric |
| +from infra_libs.ts_mon import DistributionMetric, FloatMetric |
| +from infra_libs.ts_mon import GaugeMetric, NonCumulativeDistributionMetric |
| +from infra_libs.ts_mon import StringMetric |
| + |
| + |
| +metric1 = BooleanMetric('/my/metric1', description='metric1') |
| +metric2 = CounterMetric('/my/metric2', description='metric2') |
| +metric3 = CumulativeDistributionMetric('/my/metric3', |
| + 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.
|
| +metric4 = CumulativeMetric('/my/metric4', description='metric4') |
| +metric5 = DistributionMetric('/my/metric5', description='metric5') |
| + |
| + |
| +# Add a wrapping function to check that we're finding those as well. |
| +def nice_function(): |
| + # Checking that we really ignore comments. |
| + # FloatMetric('/my/metric11', description='metric11') |
| + |
| + metric6 = FloatMetric('/my/metric6', description='metric6') |
| + metric7 = GaugeMetric('/my/metric7', description='metric7') |
| + metric8 = NonCumulativeDistributionMetric('/my/metric8', |
| + description='metric8') |
|
Sergey Berezin
2015/09/29 00:01:18
nit: another weird indentation
pgervais
2015/09/30 00:09:37
Done.
|
| + metric9 = StringMetric('/my/metric9', description='metric9') |
| + # Use all variables to silence pylint. |
| + print metric6, metric7, metric8, metric9 |
| + |
| + |
| +# Some unrelated code to add noise |
| +if __name__ == '__main__': |
| + pass |