-
Notifications
You must be signed in to change notification settings - Fork 648
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
Clarify support for forking process models #3307
Comments
Thanks for opening this issue, I think it is an important topic. Afaik, things should be working for tracing at this point. Metrics are a little more complicated and #2837 is definitely still valid. It would be great if we could clean up old issues/documentation and would definitely appreciate help on this if you have the time @PeterJCLaw. @srikanthccv last worked on this, do you know if any of the linked bugs can be closed out now? |
|
Thanks for those additional details.
What does verification look like here? Given the nature of this as a forking issue I'd kinda assumed the failure mode was race conditions and the like -- timing based and hard to reproduce/be sure if fixed just from testing. Is there a known reproduction of the failure mode or something we can do to check that it's working as intended? |
The verification can be pretty simple. If you run a simple gunicorn based application with multiple workers (Without following the special instructions mentioned in the docs), it should export the traces/metrics/logs. If they are not exported (to the collector, console etc.), then the issue still exists. |
Hrm, ok. I'm currently running gunicorn with the default worker type and that does seem to work. My reading of gunicorns docs indicate that the master process doesn't actually load the application though -- only the workers do (after the fork happens), unless you use the I'll see if I can find some time to validate the behaviours under gunicorn & uwssgi. Edit for clarity: my use of gunicorn without |
I am confused now. Is it working or not working with gunicorn? |
My current setup is using gunicorn without calling |
I've just tested a toy application under gunicorn and uWSGI, using both their I'm not sure how to validate that the desired batching is happening, though I can see that the traces are often not printed until several requests later which suggests that it is working. |
Thank you, this confirms the above statement that traces and logs batch processors work all the time.
They are emitted if the queue becomes full or batch timeout elapses. I think this is working fine. |
Unfortunately while it looks like the Edit: using uWSGI's |
Hrm, the uWSGI side of this may be somewhat resolvable by users. Ish. Via https://stackoverflow.com/a/72601192 and unbit/uwsgi#2388 it seems that uWSGI has some extra options which can be used to enable |
+1 to updating docs here since |
It seems that from flask import Flask
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor, SimpleSpanProcessor, ConsoleSpanExporter
# BatchSpanProcessor works fine
# exporter = ConsoleSpanExporter()
# span_processor = BatchSpanProcessor(exporter)
# But OTLPSpanExporter does not
exporter = OTLPSpanExporter()
span_processor = SimpleSpanProcessor(exporter)
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(span_processor)
app = Flask(__name__)
FlaskInstrumentor().instrument_app(app, tracer_provider=tracer_provider)
@app.route('/')
def hello():
return 'Hello!' and running
|
https://opentelemetry-python.readthedocs.io/en/latest/examples/fork-process-model/README.html indicates that
BatchSpanProcessor
does not support forking process models, including those used by Gunicorn and uWSGI. However those docs (#1609) pre-date other changes which appear to have added support for forking process models, including:which seem specifically targetted at resolving the described issues.
What is the current expected state of support for the various forking models?
Either way, updating the docs to clarify the actual situation would be appreciated.
Possibly related issues:
The text was updated successfully, but these errors were encountered: