Skip to content
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

Store data in extra_info post-run #256

Open
danielsamuels opened this issue Feb 26, 2024 · 0 comments
Open

Store data in extra_info post-run #256

danielsamuels opened this issue Feb 26, 2024 · 0 comments

Comments

@danielsamuels
Copy link

I'm trying to benchmark a set of API endpoints, and one of the key pieces of information I'd like to be able to store is how many queries were made - and in fact what queries were made. Ideally, I'd implement this with a debug database cursor, wrap the benchmark function in a context manager and store the results in extra_info like this:

with capture_queries() as queries:
    result = benchmark(get_fn, api_url)
    result.extra_info = {"query_count": queries.count()}

But it seems that extra_info has to be defined before the run, not after. I could make the same API call twice (one pure, one with benchmark, but this will clearly make the test take longer, and could affect the benchmark results.

What's the expected process here? Should I make a plain call first, then call with benchmark?

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

1 participant