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

Unified Diff: client/third_party/infra_libs/ts_mon/common/interface.py

Issue 2705273003: Roll infra_libs and gae_ts_mon in luci-py, and add field_specs to all metrics (Closed)
Patch Set: Rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: client/third_party/infra_libs/ts_mon/common/interface.py
diff --git a/client/third_party/infra_libs/ts_mon/common/interface.py b/client/third_party/infra_libs/ts_mon/common/interface.py
index 6f10c408deeb1bb0a93f9000fb5af16b68deb431..8091490fc7ed161910e41a890c2fc37d151e6b89 100644
--- a/client/third_party/infra_libs/ts_mon/common/interface.py
+++ b/client/third_party/infra_libs/ts_mon/common/interface.py
@@ -123,7 +123,6 @@ def _generate_proto_new():
data_sets = {}
count = 0
- error_count = 0
for (target, metric, start_time, end_time, fields_values
) in state.store.get_all():
for fields, value in fields_values.iteritems():
@@ -141,17 +140,12 @@ def _generate_proto_new():
key = (target, metric.name)
new_data_set = None
- try:
- if key not in data_sets:
- new_data_set = new_metrics_pb2.MetricsDataSet()
- metric._populate_data_set(new_data_set, fields)
-
- data = new_metrics_pb2.MetricsData()
- metric._populate_data(data, start_time, end_time, fields, value)
- except errors.MonitoringError:
- logging.exception('Failed to serialize a metric.')
- error_count += 1
- continue
+ if key not in data_sets:
+ new_data_set = new_metrics_pb2.MetricsDataSet()
+ metric._populate_data_set(new_data_set)
+
+ data = new_metrics_pb2.MetricsData()
+ metric._populate_data(data, start_time, end_time, fields, value)
# All required data protos have been successfully populated. Now we can
# insert them in serialized proto and bookeeping data structures.
@@ -164,37 +158,25 @@ def _generate_proto_new():
if count > 0:
yield proto
- if error_count:
- raise errors.MonitoringFailedToFlushAllMetricsError(error_count)
-
def _generate_proto():
"""Generate MetricsCollection for global_monitor.send()."""
proto = metrics_pb2.MetricsCollection()
- error_count = 0
for target, metric, start_time, _, fields_values in state.store.get_all():
for fields, value in fields_values.iteritems():
if len(proto.data) >= METRICS_DATA_LENGTH_LIMIT:
yield proto
proto = metrics_pb2.MetricsCollection()
- try:
- metrics_pb = metrics_pb2.MetricsData()
- metric.serialize_to(metrics_pb, start_time, fields, value, target)
- except errors.MonitoringError:
- error_count += 1
- logging.exception('Failed to serialize a metric.')
- continue
+ metrics_pb = metrics_pb2.MetricsData()
+ metric.serialize_to(metrics_pb, start_time, fields, value, target)
proto.data.add().CopyFrom(metrics_pb)
if len(proto.data) > 0:
yield proto
- if error_count:
- raise errors.MonitoringFailedToFlushAllMetricsError(error_count)
-
def register(metric):
"""Adds the metric to the list of metrics sent by flush().
« no previous file with comments | « client/third_party/infra_libs/ts_mon/common/http_metrics.py ('k') | client/third_party/infra_libs/ts_mon/common/metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698