当前位置: 首页>>代码示例>>Python>>正文


Python Gauged.value_series方法代码示例

本文整理汇总了Python中gauged.Gauged.value_series方法的典型用法代码示例。如果您正苦于以下问题:Python Gauged.value_series方法的具体用法?Python Gauged.value_series怎么用?Python Gauged.value_series使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gauged.Gauged的用法示例。


在下文中一共展示了Gauged.value_series方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_interval_size_error

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import value_series [as 别名]
 def test_interval_size_error(self):
     gauged = Gauged(self.driver, resolution=1000, block_size=10000)
     with gauged.writer as writer:
         writer.add('likes', 10)
     with self.assertRaises(GaugedIntervalSizeError):
         gauged.value_series('likes', interval=1)
     with self.assertRaises(GaugedIntervalSizeError):
         gauged.aggregate_series('likes', Gauged.SUM, interval=1)
     with self.assertRaises(GaugedIntervalSizeError):
         gauged.aggregate_series('likes', Gauged.MEAN, interval=1)
开发者ID:pyarnold,项目名称:gauged,代码行数:12,代码来源:test_gauged.py

示例2: test_no_data

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import value_series [as 别名]
 def test_no_data(self):
     gauged = Gauged(self.driver)
     self.assertEqual(len(gauged.namespaces()), 0)
     self.assertEqual(len(gauged.value_series('foo')), 0)
     self.assertEqual(len(gauged.aggregate_series('foo', Gauged.SUM)), 0)
     self.assertEqual(gauged.value('foo'), None)
     self.assertEqual(gauged.aggregate('foo', Gauged.SUM), None)
     self.assertEqual(len(gauged.keys()), 0)
     stats = gauged.statistics()
     for attr in ['data_points', 'byte_count']:
         self.assertEqual(getattr(stats, attr), 0)
开发者ID:pyarnold,项目名称:gauged,代码行数:13,代码来源:test_gauged.py

示例3: test_series_caching

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import value_series [as 别名]
 def test_series_caching(self):
     gauged = Gauged(self.driver, block_size=10000, min_cache_interval=1)
     with gauged.writer as writer:
         writer.add('foobar', 50, timestamp=10000)
         writer.add('foobar', 150, timestamp=15000)
         writer.add('foobar', 250, timestamp=20000)
         writer.add('foobar', 350, timestamp=40000)
         writer.add('foobar', 70, timestamp=60000)
         writer.add('bar', 70, timestamp=60000)
     series = gauged.value_series(
         'foobar', start=0, end=60000, interval=10000)
     self.assertListEqual(series.values, [50, 250, 250, 350, 350])
     series = gauged.value_series('bar', start=0, end=60000, interval=10000)
     self.assertListEqual(series.values, [])
     gauged = Gauged(
         self.driver, block_size=10000, overwrite_blocks=True, min_cache_interval=1)
     with gauged.writer as writer:
         writer.add('foobar', 150, timestamp=10000)
         writer.add('foobar', 253, timestamp=15000)
         writer.add('foobar', 351, timestamp=20000)
         writer.add('foobar', 450, timestamp=40000)
         writer.add('foobar', 170, timestamp=60000)
     series = gauged.value_series(
         'foobar', start=0, end=60000, interval=10000)
     self.assertListEqual(series.values, [50, 250, 250, 350, 350])
     series = gauged.value_series('bar', start=0, end=60000, interval=10000)
     self.assertListEqual(series.values, [])
     series = gauged.value_series(
         'foobar', start=0, end=60000, interval=10000, cache=False)
     self.assertListEqual(series.values, [150, 351, 351, 450, 450])
     self.driver.remove_cache(0)
     series = gauged.value_series(
         'foobar', start=0, end=60000, interval=10000)
     self.assertListEqual(series.values, [150, 351, 351, 450, 450])
开发者ID:pyarnold,项目名称:gauged,代码行数:36,代码来源:test_gauged.py

示例4: test_series

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import value_series [as 别名]
 def test_series(self):
     gauged = Gauged(self.driver, block_size=10000)
     self.assertEqual(
         len(gauged.value_series('foobar', start=0, end=10000).values), 0)
     with gauged.writer as writer:
         writer.add('foobar', 50, timestamp=10000)
         writer.add('foobar', 150, timestamp=15000)
         writer.add('foobar', 250, timestamp=20000)
         writer.add('foobar', 350, timestamp=40000)
         writer.add('foobar', 70, timestamp=60000)
     series = gauged.value_series(
         'foobar', start=0, end=80000, interval=10000)
     self.assertListEqual(series.values, [50, 250, 250, 350, 350, 70])
     series = gauged.value_series('foobar', interval=10000)
     self.assertListEqual(series.values, [50, 250, 250, 350, 350, 70])
     series = gauged.value_series(
         'foobar', start=0, end=80000, interval=10000, namespace=1)
     self.assertListEqual(series.values, [])
     with self.assertRaises(GaugedIntervalSizeError):
         gauged.value_series('foobar', interval=0)
     with self.assertRaises(GaugedDateRangeError):
         gauged.value_series('foobar', start=500, end=300)
     with self.assertRaises(GaugedDateRangeError):
         gauged.value_series('foobar', start=-100000000000000)
     with self.assertRaises(GaugedDateRangeError):
         gauged.value_series('foobar', end=-Gauged.NOW - 10000)
     self.assertListEqual(
         gauged.value_series('foobar', start=100000).values, [])
开发者ID:pyarnold,项目名称:gauged,代码行数:30,代码来源:test_gauged.py


注:本文中的gauged.Gauged.value_series方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。