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

@@ -23,6 +23,10 @@ env:
HARBOR: 192.168.0.110:5000
# Harbor Proxy Cache (指向 DockerHub 的內部 Mirror避免拉取限額)
HARBOR_MIRROR: 192.168.0.110:5001
# OTEL CI/CD 監控 (2026-03-31 #46c - 遷移到 Gitea)
OTEL_EXPORTER_OTLP_ENDPOINT: http://192.168.0.188:24318
OTEL_SERVICE_NAME: awoooi-cd
OTEL_RESOURCE_ATTRIBUTES: service.version=${{ github.sha }},deployment.environment=production
jobs:
build-and-deploy:

View File

@@ -14,6 +14,12 @@ on:
schedule:
- cron: '0 16 * * *' # 每日 00:00 台北 (UTC+8)
# OTEL CI/CD 監控 (2026-03-31 #46c)
env:
OTEL_EXPORTER_OTLP_ENDPOINT: http://192.168.0.188:24318
OTEL_SERVICE_NAME: awoooi-e2e
OTEL_RESOURCE_ATTRIBUTES: deployment.environment=production
jobs:
e2e-health:
runs-on: ubuntu-latest

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
# =============================================================================