- Rename package directory and all references from sage_datamark to sage_datamart - Add 3 ETL cron dspy files (sync/aggregate/provider_cost) for scheduled data pipelines - Add 5 stat UI files (total_users/fail_calls/success_rate/avg_ttft/total_calls) - Register j2_ template functions in init.py for UI rendering - Move j2_avg_ttft SQL to dashboards.py for DRY - Clean unused imports (getConfig/DBPools/exception) - Update git remote to sage_datamart.git
13 lines
406 B
Plaintext
13 lines
406 B
Plaintext
# ETL: 每5分钟增量同步 llmusage → dm_model_call_fact
|
|
ip = request['client_ip']
|
|
if ip not in ['127.0.0.1']:
|
|
return ip
|
|
|
|
import json
|
|
from sage_datamart.etl import ensure_tables, sync_call_fact
|
|
env = request._run_ns
|
|
async with get_sor_context(env, 'sage_datamart') as sor:
|
|
await ensure_tables(sor)
|
|
count = await sync_call_fact(sor)
|
|
return json.dumps({'status': 'ok', 'synced': count})
|