faust icon indicating copy to clipboard operation
faust copied to clipboard

Event runtime metric is zero when using `stream.take(...)`

Open derkach-ip opened this issue 3 years ago • 2 comments

Checklist

  • [+] I have included information about relevant versions
  • [+] I have verified that the issue persists when using the master branch of Faust.

Steps to reproduce

Make agent, that uses take over stream. Also setup Prometheus monitor for Faust app.

import asyncio

from faust import App
from faust.sensors.prometheus import setup_prometheus_sensors

app = App('app-name', broker='kafka://localhost')
setup_prometheus_sensors(app)

@app.agent(topic)
async def start_process_versions(stream: StreamT) -> None:
    async for messages in stream.take(max_=10, within=5):
        await asyncio.gather(asyncio.sleep(1) for _ in messages)

Expected behavior

Sending events_runtime_ms_sum metric with some values, probably about 10_000 ms.

Actual behavior

Sending events_runtime_ms_bucket metric with zero value.

Versions

  • Python version 3.9
  • Faust version 0.8.4
  • Operating system debian:buster-slim
  • Kafka version -

derkach-ip avatar Jun 16 '22 15:06 derkach-ip