Fix bug which caused metric publishing to not accept query string parameters in ASGI app by hacksparr0w · Pull Request #1125 · prometheus/client_python
Conversation
The _bake_output function in exposition.py expects the params argument to be a dict[str, Any] but the ASGI interface does not handle encoding, thus the parameters are passed in as dict[bytes, Any].
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Would you be willing to write a test for this please? Or add enough type hinting that it would be caught by mypy.
I isolated the bug into a test case. Codifying this into type hints would be non-trivial since the used parse_qs function from urllib.parse is not typed and returns Any.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters