Instrument sanctions' FastAPI app in code
FastAPIInstrumentor.instrument_app gives sanctions its SERVER span back, skipping /healthz (the Docker healthcheck flooded Tempo search) and the ASGI receive/send INTERNAL spans. Drop the OTEL_* env vars only the zero-code configurator read, and the unused SERVICE_NAME. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4baae96e6e
commit
d3cf6bb514
@@ -141,13 +141,7 @@ services:
|
||||
- ./scripts:/app/scripts
|
||||
environment:
|
||||
<<: *app-env
|
||||
SERVICE_NAME: sanctions
|
||||
OTEL_SERVICE_NAME: sanctions
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: https://otlp.vione.cloud
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
||||
OTEL_TRACES_EXPORTER: otlp
|
||||
OTEL_METRICS_EXPORTER: none
|
||||
OTEL_LOGS_EXPORTER: none
|
||||
env_file:
|
||||
- .env.observability
|
||||
command: uvicorn services.sanctions.app:app --host 0.0.0.0 --port 8003 --reload --no-access-log
|
||||
|
||||
@@ -3,6 +3,7 @@ import asyncio
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel
|
||||
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
||||
|
||||
from common.db import engine
|
||||
from common.logging_config import configure_logging
|
||||
@@ -16,6 +17,11 @@ logger = configure_logging(SERVICE_NAME)
|
||||
setup_telemetry(service_name=SERVICE_NAME)
|
||||
app = FastAPI(title=SERVICE_NAME)
|
||||
|
||||
FastAPIInstrumentor.instrument_app(
|
||||
app,
|
||||
excluded_urls="/healthz",
|
||||
exclude_spans=["receive", "send"],
|
||||
)
|
||||
|
||||
class LookupRequest(BaseModel):
|
||||
holder_name: str
|
||||
|
||||
Reference in New Issue
Block a user