feat(cicd): #46c OTEL Tracing 遷移到 Gitea workflows
All checks were successful
E2E Health Check / e2e-health (push) Successful in 18s

- CD: awoooi-cd service (192.168.0.188:24318)
- E2E: awoooi-e2e service
- 環境變數: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES

原 GitHub workflows (cd7d63e) → Gitea workflows (ADR-039)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-31 11:39:42 +08:00
parent 4ce7999bd7
commit d2f4708663
3 changed files with 27 additions and 1 deletions

View File

@@ -26,7 +26,8 @@ import sentry_sdk
import structlog
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from fastapi.responses import JSONResponse, Response
from prometheus_client import CONTENT_TYPE_LATEST, generate_latest
from sentry_sdk.integrations.fastapi import FastApiIntegration
from sentry_sdk.integrations.starlette import StarletteIntegration
@@ -437,6 +438,21 @@ app.include_router(
)
# =============================================================================
# Prometheus Metrics Endpoint
# =============================================================================
# 2026-03-31 ogt: 暴露 Prometheus 指標供告警系統使用
@app.get("/metrics", include_in_schema=False)
async def prometheus_metrics() -> Response:
"""Prometheus metrics endpoint for alerting"""
return Response(
content=generate_latest(),
media_type=CONTENT_TYPE_LATEST,
)
# =============================================================================
# Root Endpoint
# =============================================================================