AMOS 增加 info 级别日志追踪数据流
- weather_sources.py: _attach_korean_amos_data 记录 fetch 开始、成功/失败、温度/跑道数据 - amos_station_sources.py: _amos_get_page 记录页面匹配/不匹配 - amos_station_sources.py: fetch_amos_official_current 记录 HTML 获取和解析 - analysis_service.py: _analyze 记录 AMOS 数据是否到达分析层 重启后端后在日志中搜索 "AMOS" 可追踪完整数据流: AMOS: fetching for city=seoul AMOS page matched icao=RKSI length=... AMOS fetch_amos_official_current: got HTML for RKSI... AMOS: got data for city=seoul temp_c=... source=... AMOS _analyze: found amos data for city=seoul temp_c=...
This commit is contained in:
@@ -384,12 +384,13 @@ class AmosStationSourceMixin:
|
||||
return None
|
||||
|
||||
if text and re.search(rf"\({icao}\)|\b(?:METAR|TAF)\s+{icao}\b", text, re.I):
|
||||
logger.info("AMOS page matched icao={} length={}", icao, len(text))
|
||||
record_source_call("amos", "page", "success", (time.perf_counter() - started) * 1000.0)
|
||||
return text
|
||||
logger.debug("AMOS page did not expose requested airport {}", icao)
|
||||
logger.warning("AMOS page did not expose requested airport {} (tried {} urls)", icao, len(urls))
|
||||
return None
|
||||
except Exception as exc:
|
||||
logger.debug("AMOS page fetch failed icao={}: {}", icao, exc)
|
||||
logger.warning("AMOS page fetch failed icao={}: {}", icao, exc)
|
||||
record_source_call("amos", "page", "error", (time.perf_counter() - started) * 1000.0)
|
||||
return None
|
||||
|
||||
@@ -419,8 +420,11 @@ class AmosStationSourceMixin:
|
||||
try:
|
||||
html = self._amos_get_page(icao)
|
||||
if not html:
|
||||
logger.warning("AMOS fetch_amos_official_current: no HTML for {}", icao)
|
||||
return None
|
||||
|
||||
logger.info("AMOS fetch_amos_official_current: got HTML for {} ({} chars), parsing METAR/runway", icao, len(html))
|
||||
|
||||
# Parse METAR line
|
||||
icao_pattern = re.escape(icao)
|
||||
metar_match = re.search(rf"METAR\s+{icao_pattern}\s.*?=", html, re.DOTALL)
|
||||
|
||||
Reference in New Issue
Block a user