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

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

Issue 2119933003: Add Configurable metric_name_prefix (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add trailing slash Created 4 years, 5 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
« no previous file with comments | « infra_libs/ts_mon/common/interface.py ('k') | infra_libs/ts_mon/config.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import copy 7 import copy
8 8
9 from infra_libs.ts_mon.protos import metrics_pb2 9 from infra_libs.ts_mon.protos import metrics_pb2
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 """Generate metrics_pb2.MetricsData messages for this metric. 87 """Generate metrics_pb2.MetricsData messages for this metric.
88 88
89 Args: 89 Args:
90 collection_pb (metrics_pb2.MetricsCollection): protocol buffer into which 90 collection_pb (metrics_pb2.MetricsCollection): protocol buffer into which
91 to add the current metric values. 91 to add the current metric values.
92 start_time (int): timestamp in microseconds since UNIX epoch. 92 start_time (int): timestamp in microseconds since UNIX epoch.
93 target (Target): a Target to use. 93 target (Target): a Target to use.
94 """ 94 """
95 95
96 metric_pb = collection_pb.data.add() 96 metric_pb = collection_pb.data.add()
97 metric_pb.metric_name_prefix = '/chrome/infra/' 97 metric_pb.metric_name_prefix = interface.state.metric_name_prefix
98 metric_pb.name = self._name 98 metric_pb.name = self._name
99 if self._description is not None: 99 if self._description is not None:
100 metric_pb.description = self._description 100 metric_pb.description = self._description
101 101
102 self._populate_value(metric_pb, value, start_time) 102 self._populate_value(metric_pb, value, start_time)
103 self._populate_fields(metric_pb, fields) 103 self._populate_fields(metric_pb, fields)
104 104
105 target._populate_target_pb(metric_pb) 105 target._populate_target_pb(metric_pb)
106 106
107 def _populate_fields(self, metric, fields): 107 def _populate_fields(self, metric, fields):
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 description=None): 454 description=None):
455 super(NonCumulativeDistributionMetric, self).__init__( 455 super(NonCumulativeDistributionMetric, self).__init__(
456 name, 456 name,
457 is_cumulative=False, 457 is_cumulative=False,
458 bucketer=bucketer, 458 bucketer=bucketer,
459 fields=fields, 459 fields=fields,
460 description=description) 460 description=description)
461 461
462 def is_cumulative(self): 462 def is_cumulative(self):
463 return False 463 return False
OLDNEW
« no previous file with comments | « infra_libs/ts_mon/common/interface.py ('k') | infra_libs/ts_mon/config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698