feat(proxy): implement metrics persistence, traffic logs DB, and advanced monitoring
- Add SQLite schema for proxy metrics and traffic logs - Implement ProxyMetricsRepo with historical aggregates - Add TrafficLogsRepo for DB-backed traffic log queries - Create proxy-advanced IPC handlers (metrics, traffic logs, circuit breaker, parity) - Add ProxyMetricsService with connection snapshots and cleanup - Add ProxyReplayService and ProxyIdeConfigService - Implement MonitorTab and ToolsTab for advanced proxy features - Add TrafficLogTable with sorting and filtering - Fix i18n keys for proxy metrics - Fix generateIdeConfig type mapping - Update proxy routes with advanced tab integration
This commit is contained in:
1 parent
c73537d44c
commit
0be7d7fea2
36 files changed
+4551
-882
No files matched your search
@@ -489,10 +489,95 @@ i18n
|
||||
maps_to: 'Maps to',
|
||||
restore: 'Restore Defaults',
|
||||
},
|
||||
routing: {
|
||||
currentMappings: 'Current Model Mappings',
|
||||
modelMapping: 'Anthropic model routing configuration',
|
||||
noMapping: 'No model mappings configured.',
|
||||
upstreamProxy: 'Outgoing proxy configuration',
|
||||
status: 'Status',
|
||||
enabled: 'Enabled',
|
||||
disabled: 'Disabled',
|
||||
url: 'URL',
|
||||
},
|
||||
examples: {
|
||||
title: 'Usage Examples',
|
||||
description: 'Example commands to call the local API proxy.',
|
||||
},
|
||||
advanced: {
|
||||
title: 'Advanced',
|
||||
monitor: 'Monitor',
|
||||
tabs: {
|
||||
tools: 'Tools',
|
||||
},
|
||||
metrics: {
|
||||
title: 'Performance Metrics',
|
||||
requestsPerMinute: 'Requests/min',
|
||||
avgLatency: 'Avg Latency',
|
||||
errorRate: 'Error Rate',
|
||||
activeConnections: 'Active Connections',
|
||||
},
|
||||
circuitBreaker: {
|
||||
title: 'Circuit Breaker Status',
|
||||
healthy: 'Healthy',
|
||||
degraded: 'Degraded',
|
||||
unhealthy: 'Unhealthy',
|
||||
failureRate: 'Failure Rate',
|
||||
lastFailure: 'Last Failure',
|
||||
failures: 'Failures',
|
||||
},
|
||||
trafficLog: {
|
||||
title: 'Traffic Logs',
|
||||
direction: 'Filter by direction',
|
||||
all: 'All directions',
|
||||
inbound: 'Inbound',
|
||||
outbound: 'Outbound',
|
||||
exportJson: 'Export JSON',
|
||||
exportCsv: 'Export CSV',
|
||||
noLogs: 'No traffic logs found',
|
||||
timestamp: 'Timestamp',
|
||||
endpoint: 'Endpoint',
|
||||
method: 'Method',
|
||||
status: 'Status',
|
||||
duration: 'Duration',
|
||||
},
|
||||
tools: {
|
||||
totalRequests: 'Total Requests',
|
||||
matchedRequests: 'Matched Requests',
|
||||
parityViolations: 'Parity Violations',
|
||||
ideSetup: 'IDE Quick Setup',
|
||||
copyConfig: 'Copy Config',
|
||||
requestReplay: 'Request Replay',
|
||||
comingSoon: 'Coming soon',
|
||||
},
|
||||
trafficLogs: {
|
||||
title: 'Traffic Logs',
|
||||
filterDirection: 'Filter by direction',
|
||||
allDirections: 'All directions',
|
||||
exportJson: 'Export JSON',
|
||||
exportCsv: 'Export CSV',
|
||||
noLogs: 'No traffic logs found',
|
||||
},
|
||||
parity: {
|
||||
title: 'Parity Counters',
|
||||
requests: 'Parity Requests',
|
||||
errors: 'Parity Errors',
|
||||
shadowComparisons: 'Shadow Comparisons',
|
||||
shadowMismatches: 'Shadow Mismatches',
|
||||
noGoBlocked: 'No-Go Blocked',
|
||||
},
|
||||
ideSetup: {
|
||||
title: 'IDE Quick Setup',
|
||||
cursor: 'Cursor',
|
||||
vscode: 'VS Code',
|
||||
claudeCode: 'Claude Code',
|
||||
copyConfig: 'Copy Config',
|
||||
configCopied: 'Config copied!',
|
||||
},
|
||||
replay: {
|
||||
title: 'Request Replay',
|
||||
comingSoon: 'Coming soon',
|
||||
},
|
||||
},
|
||||
},
|
||||
usage: {
|
||||
title: 'Token Usage',
|
||||
@@ -990,10 +1075,95 @@ i18n
|
||||
maps_to: '映射到',
|
||||
restore: '恢复默认',
|
||||
},
|
||||
routing: {
|
||||
currentMappings: '当前模型映射',
|
||||
modelMapping: 'Anthropic 模型路由配置',
|
||||
noMapping: '未配置模型映射。',
|
||||
upstreamProxy: '出站代理配置',
|
||||
status: '状态',
|
||||
enabled: '已启用',
|
||||
disabled: '已禁用',
|
||||
url: 'URL',
|
||||
},
|
||||
examples: {
|
||||
title: '使用示例',
|
||||
description: '调用本地 API 代理的示例命令。',
|
||||
},
|
||||
advanced: {
|
||||
title: '高级',
|
||||
monitor: '监控',
|
||||
tabs: {
|
||||
tools: '工具',
|
||||
},
|
||||
metrics: {
|
||||
title: '性能指标',
|
||||
requestsPerMinute: '请求/分钟',
|
||||
avgLatency: '平均延迟',
|
||||
errorRate: '错误率',
|
||||
activeConnections: '活跃连接',
|
||||
},
|
||||
circuitBreaker: {
|
||||
title: '熔断器状态',
|
||||
healthy: '健康',
|
||||
degraded: '降级',
|
||||
unhealthy: '不健康',
|
||||
failureRate: '失败率',
|
||||
lastFailure: '上次失败',
|
||||
failures: '失败次数',
|
||||
},
|
||||
trafficLog: {
|
||||
title: '流量日志',
|
||||
direction: '按方向筛选',
|
||||
all: '所有方向',
|
||||
inbound: '入站',
|
||||
outbound: '出站',
|
||||
exportJson: '导出 JSON',
|
||||
exportCsv: '导出 CSV',
|
||||
noLogs: '暂无流量日志',
|
||||
timestamp: '时间戳',
|
||||
endpoint: '端点',
|
||||
method: '方法',
|
||||
status: '状态',
|
||||
duration: '耗时',
|
||||
},
|
||||
tools: {
|
||||
totalRequests: '总请求数',
|
||||
matchedRequests: '匹配请求数',
|
||||
parityViolations: '一致性违规',
|
||||
ideSetup: 'IDE 快速配置',
|
||||
copyConfig: '复制配置',
|
||||
requestReplay: '请求重放',
|
||||
comingSoon: '即将推出',
|
||||
},
|
||||
trafficLogs: {
|
||||
title: '流量日志',
|
||||
filterDirection: '按方向筛选',
|
||||
allDirections: '所有方向',
|
||||
exportJson: '导出 JSON',
|
||||
exportCsv: '导出 CSV',
|
||||
noLogs: '暂无流量日志',
|
||||
},
|
||||
parity: {
|
||||
title: '一致性计数器',
|
||||
requests: '一致性请求',
|
||||
errors: '一致性错误',
|
||||
shadowComparisons: '影子对比',
|
||||
shadowMismatches: '影子不匹配',
|
||||
noGoBlocked: '禁止通过',
|
||||
},
|
||||
ideSetup: {
|
||||
title: 'IDE 快速配置',
|
||||
cursor: 'Cursor',
|
||||
vscode: 'VS Code',
|
||||
claudeCode: 'Claude Code',
|
||||
copyConfig: '复制配置',
|
||||
configCopied: '配置已复制!',
|
||||
},
|
||||
replay: {
|
||||
title: '请求重放',
|
||||
comingSoon: '即将推出',
|
||||
},
|
||||
},
|
||||
},
|
||||
usage: {
|
||||
title: 'Token 用量',
|
||||
@@ -1496,10 +1666,95 @@ i18n
|
||||
maps_to: '->',
|
||||
restore: 'Сброс',
|
||||
},
|
||||
routing: {
|
||||
currentMappings: 'Текущие сопоставления моделей',
|
||||
modelMapping: 'Конфигурация маршрутизации моделей Anthropic',
|
||||
noMapping: 'Сопоставления моделей не настроены.',
|
||||
upstreamProxy: 'Конфигурация исходящего прокси',
|
||||
status: 'Статус',
|
||||
enabled: 'Включено',
|
||||
disabled: 'Отключено',
|
||||
url: 'URL',
|
||||
},
|
||||
examples: {
|
||||
title: 'Примеры',
|
||||
description: 'Примеры использования локального прокси.',
|
||||
},
|
||||
advanced: {
|
||||
title: 'Расширенные',
|
||||
monitor: 'Монитор',
|
||||
tabs: {
|
||||
tools: 'Инструменты',
|
||||
},
|
||||
metrics: {
|
||||
title: 'Метрики производительности',
|
||||
requestsPerMinute: 'Запросов/мин',
|
||||
avgLatency: 'Средняя задержка',
|
||||
errorRate: 'Частота ошибок',
|
||||
activeConnections: 'Активные соединения',
|
||||
},
|
||||
circuitBreaker: {
|
||||
title: 'Состояние предохранителя',
|
||||
healthy: 'Здоровый',
|
||||
degraded: 'Деградированный',
|
||||
unhealthy: 'Нездоровый',
|
||||
failureRate: 'Частота отказов',
|
||||
lastFailure: 'Последний сбой',
|
||||
failures: 'Сбои',
|
||||
},
|
||||
trafficLog: {
|
||||
title: 'Журналы трафика',
|
||||
direction: 'Фильтр по направлению',
|
||||
all: 'Все направления',
|
||||
inbound: 'Входящий',
|
||||
outbound: 'Исходящий',
|
||||
exportJson: 'Экспорт JSON',
|
||||
exportCsv: 'Экспорт CSV',
|
||||
noLogs: 'Журналы трафика не найдены',
|
||||
timestamp: 'Время',
|
||||
endpoint: 'Конечная точка',
|
||||
method: 'Метод',
|
||||
status: 'Статус',
|
||||
duration: 'Длительность',
|
||||
},
|
||||
tools: {
|
||||
totalRequests: 'Всего запросов',
|
||||
matchedRequests: 'Совпавшие запросы',
|
||||
parityViolations: 'Нарушения паритета',
|
||||
ideSetup: 'Быстрая настройка IDE',
|
||||
copyConfig: 'Копировать конфиг',
|
||||
requestReplay: 'Повтор запросов',
|
||||
comingSoon: 'Скоро',
|
||||
},
|
||||
trafficLogs: {
|
||||
title: 'Журналы трафика',
|
||||
filterDirection: 'Фильтр по направлению',
|
||||
allDirections: 'Все направления',
|
||||
exportJson: 'Экспорт JSON',
|
||||
exportCsv: 'Экспорт CSV',
|
||||
noLogs: 'Журналы трафика не найдены',
|
||||
},
|
||||
parity: {
|
||||
title: 'Счетчики паритета',
|
||||
requests: 'Запросы паритета',
|
||||
errors: 'Ошибки паритета',
|
||||
shadowComparisons: 'Теневые сравнения',
|
||||
shadowMismatches: 'Теневые несоответствия',
|
||||
noGoBlocked: 'Блокировка No-Go',
|
||||
},
|
||||
ideSetup: {
|
||||
title: 'Быстрая настройка IDE',
|
||||
cursor: 'Cursor',
|
||||
vscode: 'VS Code',
|
||||
claudeCode: 'Claude Code',
|
||||
copyConfig: 'Копировать конфиг',
|
||||
configCopied: 'Конфиг скопирован!',
|
||||
},
|
||||
replay: {
|
||||
title: 'Повтор запроса',
|
||||
comingSoon: 'Скоро',
|
||||
},
|
||||
},
|
||||
},
|
||||
usage: {
|
||||
title: 'Использование токенов',
|
||||
|
||||
@@ -472,6 +472,55 @@ const vi = {
|
||||
title: 'Ví dụ sử dụng',
|
||||
description: 'Ví dụ lệnh để gọi local API proxy.',
|
||||
},
|
||||
advanced: {
|
||||
title: 'Nâng cao',
|
||||
monitor: 'Giám sát',
|
||||
routing: 'Định tuyến',
|
||||
tools: 'Công cụ',
|
||||
metrics: {
|
||||
title: 'Chỉ số hiệu suất',
|
||||
requestsPerMinute: 'Yêu cầu/phút',
|
||||
avgLatency: 'Độ trễ TB',
|
||||
errorRate: 'Tỷ lệ lỗi',
|
||||
activeConnections: 'Kết nối hoạt động',
|
||||
},
|
||||
circuitBreaker: {
|
||||
title: 'Trạng thái Circuit Breaker',
|
||||
healthy: 'Khỏe',
|
||||
degraded: 'Suy giảm',
|
||||
unhealthy: 'Không khỏe',
|
||||
failureRate: 'Tỷ lệ thất bại',
|
||||
lastFailure: 'Lỗi gần nhất',
|
||||
},
|
||||
trafficLogs: {
|
||||
title: 'Nhật ký lưu lượng',
|
||||
filterDirection: 'Lọc theo hướng',
|
||||
allDirections: 'Tất cả hướng',
|
||||
exportJson: 'Xuất JSON',
|
||||
exportCsv: 'Xuất CSV',
|
||||
noLogs: 'Không tìm thấy nhật ký',
|
||||
},
|
||||
parity: {
|
||||
title: 'Bộ đếm Parity',
|
||||
requests: 'Yêu cầu Parity',
|
||||
errors: 'Lỗi Parity',
|
||||
shadowComparisons: 'So sánh Shadow',
|
||||
shadowMismatches: 'Không khớp Shadow',
|
||||
noGoBlocked: 'No-Go đã chặn',
|
||||
},
|
||||
ideSetup: {
|
||||
title: 'Thiết lập IDE nhanh',
|
||||
cursor: 'Cursor',
|
||||
vscode: 'VS Code',
|
||||
claudeCode: 'Claude Code',
|
||||
copyConfig: 'Sao chép cấu hình',
|
||||
configCopied: 'Đã sao chép cấu hình!',
|
||||
},
|
||||
replay: {
|
||||
title: 'Phát lại yêu cầu',
|
||||
comingSoon: 'Sắp ra mắt',
|
||||
},
|
||||
},
|
||||
},
|
||||
usage: {
|
||||
title: 'Token Usage',
|
||||
|
||||
Reference in new issue
Block a user