лаба на 4
This commit is contained in:
+11
-3
@@ -56,7 +56,7 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
|
||||
|
||||
from src.telemetry import setup, HTTPMetricsMiddleware
|
||||
from src.telemetry import setup, HTTPMetricsMiddleware, capture_trace_context
|
||||
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
||||
|
||||
setup("messenger-api")
|
||||
@@ -637,14 +637,22 @@ async def upload_attachment_endpoint(
|
||||
s3_key=s3_key,
|
||||
)
|
||||
|
||||
trace_context = capture_trace_context()
|
||||
|
||||
await session.execute(
|
||||
text("""
|
||||
INSERT INTO attachment_jobs (id, attachment_id)
|
||||
VALUES (:job_id, :attachment_id)
|
||||
INSERT INTO attachment_jobs (
|
||||
id, attachment_id, traceparent, tracestate
|
||||
)
|
||||
VALUES (
|
||||
:job_id, :attachment_id, :traceparent, :tracestate
|
||||
)
|
||||
"""),
|
||||
{
|
||||
"job_id": uuid4(),
|
||||
"attachment_id": attachment_id,
|
||||
"traceparent": trace_context.get("traceparent"),
|
||||
"tracestate": trace_context.get("tracestate"),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user