hypercorn icon indicating copy to clipboard operation
hypercorn copied to clipboard

Is Hypercorn pre-fork or post-fork? How can I integrate it with opentelemetry?

Open ar-qun opened this issue 1 year ago • 7 comments

Hello everybody,

I don't seem to manage to make open telemetry work with Hypercorn.

Could someone give me any suggestions related to the process model Hypercorn is using? Here is for uWSGI and Gunicorn https://opentelemetry-python.readthedocs.io/en/latest/examples/fork-process-model/README.html

I am using a WSGI Flask app.

Thanks in advance.

ar-qun avatar Apr 18 '24 20:04 ar-qun

I think the process model is still fork but I don't see any way to specify callbacks for a pre-fork event or something. It would be really nice to have a prefork event.

EDIT: Actually, looks like it uses multi-processing.spawn.

nabheet avatar May 29 '24 17:05 nabheet

Would be interested in anyone that got hypercorn to work with opentelemetry! I'm having trouble getting it to send any traces at all, even with 1 worker. Here's a minimal example: https://github.com/tommyhe6/otel-hypercorn, where hypercorn was not sending any traces but uvicorn working.

tommyhe6 avatar May 29 '24 20:05 tommyhe6

I got it to work. It is definitely sending metrics every 5secs. And I log traces to stdout, so looks like it is sending traces also.

nabheet avatar May 29 '24 20:05 nabheet

Metrics seem to work, but I can't get traces to show up. Is there anything wrong with the configuration in my example? Or do you have a public repo showcasing this by chance? Appreciate the help.

tommyhe6 avatar May 29 '24 20:05 tommyhe6

@nabheet very curious. Could you share snippet from your code?

ar-qun avatar Aug 08 '24 13:08 ar-qun