File tree Expand file tree Collapse file tree 5 files changed +10
-9
lines changed
Expand file tree Collapse file tree 5 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,13 @@ class ItemAnalyticsTrends(pydantic.BaseModel):
5252@router .get ("/user-summary" , response_model = UserAnalyticsSummary )
5353def get_user_summary (
5454 session : SessionDep ,
55+ ) -> (
56+ UserAnalyticsSummary
5557): # get_current_active_superuser is imported but not used here yet
5658 with tracer .start_as_current_span ("user_summary_endpoint" ):
57- users_list : list [User ]
5859 with tracer .start_as_current_span ("fetch_all_users_sql" ):
5960 statement = select (User )
60- users_list = session .exec (statement ).all ()
61+ users_list = list ( session .exec (statement ).all () )
6162
6263 if not users_list :
6364 return UserAnalyticsSummary (
@@ -134,12 +135,11 @@ def get_user_summary(
134135
135136
136137@router .get ("/item-trends" , response_model = ItemAnalyticsTrends )
137- def get_item_trends (session : SessionDep ):
138+ def get_item_trends (session : SessionDep ) -> ItemAnalyticsTrends :
138139 with tracer .start_as_current_span ("item_trends_endpoint" ):
139- items_list : list [Item ]
140140 with tracer .start_as_current_span ("fetch_all_items_sql" ):
141141 statement = select (Item )
142- items_list = session .exec (statement ).all ()
142+ items_list = list ( session .exec (statement ).all () )
143143
144144 if not items_list :
145145 return ItemAnalyticsTrends (
Original file line number Diff line number Diff line change 11import os
22
3+ from fastapi import FastAPI
34from opentelemetry import trace
45from opentelemetry .exporter .otlp .proto .grpc .trace_exporter import OTLPSpanExporter
56from opentelemetry .instrumentation .fastapi import FastAPIInstrumentor
1213from app .core .db import engine # Assuming engine is in app.core.db
1314
1415
15- def init_telemetry (app ) :
16+ def init_telemetry (app : FastAPI ) -> None :
1617 # Set service name, try from settings or default
1718 service_name = getattr (settings , "OTEL_SERVICE_NAME" , "fastapi-application" )
1819
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ dev-dependencies = [
3535 " pytest<8.0.0,>=7.4.3" ,
3636 " mypy<2.0.0,>=1.8.0" ,
3737 " ruff<1.0.0,>=0.2.2" ,
38- " pre-commit<4.0.0, >=3.6.2" ,
38+ " pre-commit>=3.6.2,<4.0.0 " ,
3939 " types-passlib<2.0.0.0,>=1.7.7.20240106" ,
4040 " coverage<8.0.0,>=7.4.3" ,
4141]
Original file line number Diff line number Diff line change @@ -204,4 +204,4 @@ Adminer: http://localhost.tiangolo.com:8080
204204
205205Traefik UI: http://localhost.tiangolo.com:8090
206206
207- MailCatcher: http://localhost.tiangolo.com:1080
207+ MailCatcher: http://localhost.tiangolo.com:1080
Original file line number Diff line number Diff line change @@ -27,4 +27,4 @@ openapi.json
2727/playwright-report /
2828/blob-report /
2929/playwright /.cache /
30- /playwright /.auth /
30+ /playwright /.auth /
You can’t perform that action at this time.
0 commit comments