awslabs/aws-embedded-metrics-python

Metrics not flushed for generator functions

acradu opened this issue · 2 comments

Hello,
I recently discovered that the metrics I was emitting from some generator functions were not actually being emitted and after some digging I found that the reason is that @metric_scope doesn't actually iterate the generator, so logger.flush() occurs before any consumer attempts to use the generator.

Is this expected behavior or actually a bug?

My team is looking at lambda streaming using a custom runtime (as the Python runtime does not support streaming). The lack of this feature means aws-embedded-metrics cannot be used for streaming, where the streamed response is provided by a generator function.