fastapi_app becomes non-serializable after passing through FastAPIInstrumentor.instrument_app
#3467
Labels
bug
Something isn't working
Uh oh!
There was an error while loading. Please reload this page.
Describe your environment
OS: linux
Python version: (e.g., Python 3.9)
Package version:
What happened?
get_meter has a threading lock in its function path, but unfortunately threading lock is not compatible with cloudpickle.
https://github.com/open-telemetry/opentelemetry-python/blob/f55bceca6f13265204c0e1b1813d059df9fcb518/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py#L167-L175
Steps to Reproduce
Not a clean repro script because it requires setting up and building ray. Ray is needed to make fastapi serializable
Expected Result
fastapi_app
serializes and deserializes cleanlyActual Result
Additional context
This problem is particularly interesting to Ray Serve is because it take user code, ships it over the wire and runs it on the remote replica. This requires ser/deser user code that include fastapi_app definition.
Any recommendations on how to circumvent this problem? What is a downside of not setting up a meter inside
instrument_app
?Would you like to implement a fix?
Yes
The text was updated successfully, but these errors were encountered: