Skip to content

Conversation

@Lexicality
Copy link
Contributor

I wrote a significantly cruder version of this for a project and then realised that other people might find it useful so I spent a few hours writing a nicer one with tests and docs and so on.

I'm sure you don't want to have custom exporters for every http library under the sun but I figured since it's a pretty widely used library it'd be ok. Feel free to close if I was wrong.

cc @csmarchbanks

@Lexicality
Copy link
Contributor Author

oops, I just noticed ruff reformatted a file it shouldn't have

Since the client now requires a minimum of Python 3.9, we don't need to
have this feature gate in place any more

Signed-off-by: Lexi Robinson <lexi@lexi.org.uk>
Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I am happy enough to have lightweight helpers like this, my one ask would be to put it into its own module similar to twisted rather than in the base module and __init__.py. That makes it a bit more clear that the code is separate and to be sure not to depend on it in core.

tox.ini Outdated

[testenv]
deps =
aiohttp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to twisted it would be good to only install this onto certain versions so that we don't break something core in environments where aiohttp is not present.

Unfortunately the AIOHTTP library doesn't support ASGI and apparently
has no plans to do so which makes the ASGI exporter not suitable for
anyone using it to run their python server.

Where possible this commit follows the existing ASGI implementation and
runs the same tests for consistency.

Signed-off-by: Lexi Robinson <lexi@lexi.org.uk>
@Lexicality
Copy link
Contributor Author

Sure thing, how's this?

Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@csmarchbanks csmarchbanks merged commit 10db862 into prometheus:master Sep 19, 2025
11 checks passed
@Lexicality Lexicality deleted the aiohttp-support branch September 19, 2025 17:55
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

Successfully merging this pull request may close these issues.

2 participants