Skip to content

Metrics not flushed for generator functions #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
acradu opened this issue Mar 14, 2024 · 2 comments
Closed

Metrics not flushed for generator functions #112

acradu opened this issue Mar 14, 2024 · 2 comments

Comments

@acradu
Copy link
Contributor

acradu commented Mar 14, 2024

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?

@SamStephens
Copy link

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.

@acradu
Copy link
Contributor Author

acradu commented Oct 2, 2024

#113 merged

@acradu acradu closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants