From d3cf6bb51482687e7f829416a87daff430b8ddb8 Mon Sep 17 00:00:00 2001 From: Movses Aslanyan Date: Tue, 13 Oct 2026 08:45:53 +0330 Subject: [PATCH] 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 --- docker-compose.yml | 6 ------ services/sanctions/app.py | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e04b3e7..0e74c49 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/services/sanctions/app.py b/services/sanctions/app.py index 147a05c..4407a4b 100644 --- a/services/sanctions/app.py +++ b/services/sanctions/app.py @@ -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