Exemplo n.º 1
0
 def test_checkpoint_set(self):
     meter = metrics.MeterProvider().get_meter(__name__)
     batcher = UngroupedBatcher(True)
     aggregator = CounterAggregator()
     metric = metrics.Counter(
         "available memory",
         "available memory",
         "bytes",
         int,
         meter,
         ("environment", ),
     )
     aggregator.update(1.0)
     label_set = metrics.LabelSet()
     _batch_map = {}
     _batch_map[(metric, label_set)] = aggregator
     batcher._batch_map = _batch_map
     records = batcher.checkpoint_set()
     self.assertEqual(len(records), 1)
     self.assertEqual(records[0].metric, metric)
     self.assertEqual(records[0].label_set, label_set)
     self.assertEqual(records[0].aggregator, aggregator)
Exemplo n.º 2
0
 def test_checkpoint_set_empty(self):
     batcher = UngroupedBatcher(True)
     records = batcher.checkpoint_set()
     self.assertEqual(len(records), 0)