Skip to content
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

Add support for Flask 3.0.0 #1975

Closed
tammy-baylis-swi opened this issue Oct 2, 2023 · 2 comments · Fixed by #2013
Closed

Add support for Flask 3.0.0 #1975

tammy-baylis-swi opened this issue Oct 2, 2023 · 2 comments · Fixed by #2013

Comments

@tammy-baylis-swi
Copy link
Contributor

tammy-baylis-swi commented Oct 2, 2023

Describe your environment

Attempting to do opentelemetry-bootstrap after installing Flask 3 results in a quiet message: instrumentation for package flask<3.0,>=1.0 is available but version flask==3.0.0 is installed. Skipping.

Attempting to manually install opentelemetry-instrumentation-flask gives a different message: DependencyConflict: requested: "flask >= 1.0, < 3.0" but found: "flask 3.0.0"

The Flask app successfully loads and Otel API can be used to manually create spans (tracer.start_as_current_span). But SERVER spans are not created for requests accepted by the Flask app that should be intercepted by instrumentation. Here is an example 1-span trace exported to console with only the INTERNAL type span:

172.26.0.1 - - [02/Oct/2023 22:19:02] "GET /test/ HTTP/1.1" 200 -
{
    "name": "my_test_trace",
    "context": {
        "trace_id": "0x3c881a21a3f4f695ebf19c55be7d36c5",
        "span_id": "0xd58cce9986a06144",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": null,
    "start_time": "2023-10-02T22:19:02.966587Z",
    "end_time": "2023-10-02T22:19:02.966610Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {},
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.20.0",
            "service.name": "unknown_service"
        },
        "schema_url": ""
    }
}

Steps to reproduce
I've posted a repo here with two ways to reproduce: https://github.com/tammy-baylis-swi/otel-flask-three

What is the expected behavior?
There should be no errors at bootstrap or manual install/instrument of Flask, and traces should include SERVER type spans when the Flask app receives a request. I think instrumentation should support Flask 3 at some point.

What is the actual behavior?
There are error messages (see above) and traces do not include SERVER type spans when the Flask app receives a request.

Additional context
I think it's from this version requirement in opentelemetry-instrumentation-flask. Upgrading to Flask 3 from the previous 2.3.3 might be breaking so some testing is needed.

[project.optional-dependencies]
instruments = [
  "flask >= 1.0, < 3.0",
]
@tammy-baylis-swi tammy-baylis-swi added the bug Something isn't working label Oct 2, 2023
@ocelotl ocelotl changed the title Flask 3.0.0 cannot be instrumented Add support for Flask 3.0.0 Oct 3, 2023
@ocelotl ocelotl added feature-request and removed bug Something isn't working labels Oct 3, 2023
@ocelotl
Copy link
Contributor

ocelotl commented Oct 3, 2023

Yes, we currently don't support Flask >= 3.0.0

@tammy-baylis-swi
Copy link
Contributor Author

Thanks @ocelotl for Label and Title fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants