metricq / metricq-python

🐍 The MetricQ Python interface
https://metricq.github.io/metricq-python/
BSD 3-Clause "New" or "Revised" License
18 stars 7 forks source link

Simplify retrieving data from a drain #175

Closed tilsche closed 1 year ago

tilsche commented 1 year ago

While it technically makes sense, the pattern of

async with subscription.drain() as drain:
    async for metric, time, value in drain:
        print(f"{metric} {time} {value}")

Is needlessly complicated and should just be

async for metric, time, value in drain_data():
    print(f"{metric} {time} {value}")