File tree Expand file tree Collapse file tree 3 files changed +155
-153
lines changed
Expand file tree Collapse file tree 3 files changed +155
-153
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ http = [
3737 " fastapi>=0.99.0" ,
3838 " jinja2<4.0.0,>=3.1.2" ,
3939 # We use the generic ASGI instrumentation, so that if we decide to change
40- # Framework it will still work consistently .
40+ # framework it will still name metrics with a generic naming .
4141 " opentelemetry-instrumentation-asgi" ,
42+ " opentelemetry-instrumentation-fastapi" ,
4243 " pyjwt>=2.10.1" ,
43- " starlette-prometheus<1.0.0,>=0.10.0" ,
4444 " strawberry-graphql[debug-server]>=0.204.0" ,
4545 " uvicorn[standard]<1.0.0,>=0.34.0" ,
4646]
Original file line number Diff line number Diff line change 22from typing import Union
33
44from fastapi import FastAPI , Request
5- from opentelemetry .instrumentation .asgi import OpenTelemetryMiddleware
65from starlette .responses import JSONResponse
7- from starlette_prometheus import PrometheusMiddleware , metrics
86
97from common import AppConfig , application_init
108from http_app import context
@@ -34,21 +32,6 @@ def create_app(
3432
3533 init_routes (app )
3634
37- """
38- OpenTelemetry prometheus exporter does not work together with automatic
39- instrumentation, for now we keep the prometheus middleware even if
40- having 2 different middlewares will add overhead.
41- """
42- app .add_middleware (PrometheusMiddleware )
43- app .add_route ("/metrics/" , metrics )
44-
45- """
46- OpenTelemetry middleware has to be the last one to make sure the
47- tracing data handling is the outermost logic
48- Some typing issues to be addressed in OpenTelemetry but it works.
49- """
50- app .add_middleware (OpenTelemetryMiddleware ) # type: ignore
51-
5235 return app
5336
5437
You can’t perform that action at this time.
0 commit comments