fix(obs): split SigNoz health and public routes

This commit is contained in:
ogt
2026-07-15 03:03:22 +08:00
parent 12a9aa6cca
commit 9a9d1464a5
21 changed files with 246 additions and 34 deletions

View File

@@ -485,9 +485,13 @@ class Settings(BaseSettings):
default="http://192.168.0.112:8080",
description="Kali security scanner URL",
)
SIGNOZ_URL: str = Field(
default="http://192.168.0.188:3301",
description="SigNoz observability URL",
SIGNOZ_INTERNAL_URL: str = Field(
default="http://192.168.0.110:8080",
description="Canonical internal SigNoz query and health URL",
)
SIGNOZ_PUBLIC_URL: str = Field(
default="https://signoz.wooo.work",
description="Public SigNoz UI base URL used only for user-facing deep links",
)
CLICKHOUSE_URL: str = Field(
default="http://192.168.0.188:8123",

View File

@@ -13,7 +13,7 @@ Phase 15.3 (2026-03-26)
└─────────┘ └─────────┘ └──────────┘
URL 格式:
- SignOz Trace: http://192.168.0.188:3301/trace/{trace_id}
- SignOz Trace: https://signoz.wooo.work/trace/{trace_id}
- Langfuse Trace: http://192.168.0.110:3100/trace/{langfuse_trace_id}
- Sentry Issue: http://192.168.0.110:9000/organizations/sentry/issues/{issue_id}/
@@ -36,7 +36,7 @@ class DeepLinking:
統帥鐵律 (Phase 15.3):
- 所有觀測系統必須能互相跳轉
- URL 必須使用內網 IP (非 localhost)
- 使用者可見連結必須使用受控公開網址
- 確保 trace_id 格式一致 (32 hex chars)
"""
@@ -44,7 +44,9 @@ class DeepLinking:
# SignOz URLs (Traces/Metrics/Logs)
# ==========================================================================
SIGNOZ_BASE_URL = "http://192.168.0.188:3301"
@staticmethod
def _signoz_public_base_url() -> str:
return settings.SIGNOZ_PUBLIC_URL.rstrip("/")
@classmethod
def signoz_trace_url(cls, trace_id: str) -> str:
@@ -55,12 +57,12 @@ class DeepLinking:
trace_id: 32 字元 hex 格式 (e.g., "0af7651916cd43dd8448eb211c80319c")
Returns:
SignOz Trace URL (e.g., http://192.168.0.188:3301/trace/0af7651916cd43dd8448eb211c80319c)
SignOz Trace URL (e.g., https://signoz.wooo.work/trace/0af7651916cd43dd8448eb211c80319c)
"""
if not trace_id:
return ""
# SignOz v3 URL 格式
return f"{cls.SIGNOZ_BASE_URL}/trace/{trace_id}"
return f"{cls._signoz_public_base_url()}/trace/{trace_id}"
@classmethod
def signoz_service_url(cls, service_name: str = "awoooi-api") -> str:
@@ -73,7 +75,7 @@ class DeepLinking:
Returns:
SignOz Service URL
"""
return f"{cls.SIGNOZ_BASE_URL}/services/{service_name}"
return f"{cls._signoz_public_base_url()}/services/{service_name}"
@classmethod
def signoz_logs_url(cls, trace_id: str | None = None) -> str:
@@ -88,8 +90,8 @@ class DeepLinking:
"""
if trace_id:
# SignOz v3 logs 過濾語法
return f"{cls.SIGNOZ_BASE_URL}/logs?q=trace_id%3D{trace_id}"
return f"{cls.SIGNOZ_BASE_URL}/logs"
return f"{cls._signoz_public_base_url()}/logs?q=trace_id%3D{trace_id}"
return f"{cls._signoz_public_base_url()}/logs"
# ==========================================================================
# Langfuse URLs (LLMOps)