本文整理汇总了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)
示例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)
示例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])
示例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, [])