From b051673aa7c1983c9d70db78d3eff0c0d19f9ba8 Mon Sep 17 00:00:00 2001 From: tbphp Date: Thu, 6 Aug 2026 22:01:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(monitor):=20=E7=B4=A7=E5=87=91=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=97=A5=E5=BF=97=E6=80=9D=E8=80=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/features/monitor/LogsTab.vue | 11 +++++++---- web/src/features/monitor/log-format.ts | 8 ++++---- web/src/i18n/locales/en-US/monitor.ts | 10 +++++----- web/src/i18n/locales/ja-JP/monitor.ts | 10 +++++----- web/src/i18n/locales/zh-CN/monitor.ts | 10 +++++----- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/web/src/features/monitor/LogsTab.vue b/web/src/features/monitor/LogsTab.vue index bc35616c..9cd7e369 100644 --- a/web/src/features/monitor/LogsTab.vue +++ b/web/src/features/monitor/LogsTab.vue @@ -717,7 +717,7 @@ function costLabel(log: RequestLogItemDto): string { .logs-list__inline { display: flex; align-items: center; - gap: 5px; + gap: 0; } .logs-list__tokens { @@ -727,12 +727,15 @@ function costLabel(log: RequestLogItemDto): string { } .logs-list__model { - flex: 1 1 0; + flex: 0 1 auto; } .logs-list__reasoning { - flex: 0 1 auto; - max-width: 45%; + flex: 0 0 auto; +} + +.logs-list__inline > .logs-list__hint { + margin-left: 5px; } .logs-list__token-line { diff --git a/web/src/features/monitor/log-format.ts b/web/src/features/monitor/log-format.ts index dc5b329f..4faa9c6b 100644 --- a/web/src/features/monitor/log-format.ts +++ b/web/src/features/monitor/log-format.ts @@ -65,7 +65,7 @@ export function formatLogReasoning( details.push(formatReasoningBudgetCompact(value.budget_tokens, locale)) } } - return details.join(' / ') + return details.join('/') } export function formatLogReasoningBudget(value: string, locale: string): string { @@ -83,9 +83,9 @@ function formatReasoningBudgetCompact(value: string, locale: string): string { try { const amount = BigInt(value) if (amount < 1_000n) return formatSignedInteger(value, locale) - if (amount < 1_000_000n) return `${amount / 1_000n}K` - if (amount < 1_000_000_000n) return `${amount / 1_000_000n}M` - return `${amount / 1_000_000_000n}B` + if (amount < 1_000_000n) return `${amount / 1_000n}k` + if (amount < 1_000_000_000n) return `${amount / 1_000_000n}m` + return `${amount / 1_000_000_000n}b` } catch { return value } diff --git a/web/src/i18n/locales/en-US/monitor.ts b/web/src/i18n/locales/en-US/monitor.ts index 41317b84..b1cb03b1 100644 --- a/web/src/i18n/locales/en-US/monitor.ts +++ b/web/src/i18n/locales/en-US/monitor.ts @@ -685,8 +685,8 @@ export default { reasoningEffort: 'Reasoning effort', reasoningBudget: 'Reasoning budget', reasoningBudgetValue: '{value} Tokens', - reasoningBudgetDynamic: 'Automatic', - reasoningBudgetDisabled: 'Off', + reasoningBudgetDynamic: 'auto', + reasoningBudgetDisabled: 'off', reasoningNotSpecified: 'Not specified', statusCode: 'Status code', duration: 'Duration', @@ -779,9 +779,9 @@ export default { modelMapping: 'Client model {client} → upstream model {upstream}', modelMappingLabel: 'View model mapping', reasoning: { - compact: 'Reasoning {value}', - disabled: 'Reasoning off', - dynamic: 'automatic', + compact: '[{value}]', + disabled: '[off]', + dynamic: 'auto', }, tokens: { input: 'Input', diff --git a/web/src/i18n/locales/ja-JP/monitor.ts b/web/src/i18n/locales/ja-JP/monitor.ts index 1d3dd37c..751070f0 100644 --- a/web/src/i18n/locales/ja-JP/monitor.ts +++ b/web/src/i18n/locales/ja-JP/monitor.ts @@ -685,8 +685,8 @@ export default { reasoningEffort: '思考レベル', reasoningBudget: '思考予算', reasoningBudgetValue: '{value} Tokens', - reasoningBudgetDynamic: '自動', - reasoningBudgetDisabled: 'オフ', + reasoningBudgetDynamic: 'auto', + reasoningBudgetDisabled: 'off', reasoningNotSpecified: '未指定', statusCode: 'ステータスコード', duration: '所要時間', @@ -778,9 +778,9 @@ export default { modelMapping: 'クライアントモデル {client} → アップストリームモデル {upstream}', modelMappingLabel: 'モデルマッピングを表示', reasoning: { - compact: '思考 {value}', - disabled: '思考オフ', - dynamic: '自動', + compact: '[{value}]', + disabled: '[off]', + dynamic: 'auto', }, tokens: { input: '入力', diff --git a/web/src/i18n/locales/zh-CN/monitor.ts b/web/src/i18n/locales/zh-CN/monitor.ts index a88bc6ad..ff8b9326 100644 --- a/web/src/i18n/locales/zh-CN/monitor.ts +++ b/web/src/i18n/locales/zh-CN/monitor.ts @@ -668,8 +668,8 @@ export default { reasoningEffort: '思考级别', reasoningBudget: '思考预算', reasoningBudgetValue: '{value} Tokens', - reasoningBudgetDynamic: '自动', - reasoningBudgetDisabled: '关闭', + reasoningBudgetDynamic: 'auto', + reasoningBudgetDisabled: 'off', reasoningNotSpecified: '未指定', statusCode: '状态码', duration: '耗时', @@ -759,9 +759,9 @@ export default { modelMapping: '客户端模型 {client} → 上游模型 {upstream}', modelMappingLabel: '查看模型映射', reasoning: { - compact: '思考 {value}', - disabled: '思考关闭', - dynamic: '自动', + compact: '[{value}]', + disabled: '[off]', + dynamic: 'auto', }, tokens: { input: '输入', From 4c545a22dda5f0e2b49e93f788a367c8ea1e40dd Mon Sep 17 00:00:00 2001 From: tbphp Date: Thu, 6 Aug 2026 22:58:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(monitor):=20=E6=81=A2=E5=A4=8D=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E6=88=90=E5=8A=9F=E7=8E=87=E4=B8=8E=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/features/monitor/UsageTab.vue | 27 ++++++++++++++++++++------- web/src/i18n/locales/en-US/monitor.ts | 2 ++ web/src/i18n/locales/ja-JP/monitor.ts | 2 ++ web/src/i18n/locales/zh-CN/monitor.ts | 2 ++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/web/src/features/monitor/UsageTab.vue b/web/src/features/monitor/UsageTab.vue index 1add2508..2bb39727 100644 --- a/web/src/features/monitor/UsageTab.vue +++ b/web/src/features/monitor/UsageTab.vue @@ -24,7 +24,8 @@ import EmptyState from '@/components/ui/EmptyState.vue' import InlineFeedback from '@/components/ui/InlineFeedback.vue' import QueryFeedback from '@/components/ui/QueryFeedback.vue' import StatusBadge from '@/components/ui/StatusBadge.vue' -import { formatEstimatedCost, formatInteger, formatTokens } from '@/lib/format' +import { formatCacheHitRate } from '@/lib/cache-rate' +import { formatEstimatedCost, formatInteger, formatPercent, formatTokens } from '@/lib/format' import MonitorSectionHeading from './MonitorSectionHeading.vue' import { @@ -84,6 +85,20 @@ function formatCost(aggregate: UsageAggregateDto): string { return formatEstimatedCost(aggregate.estimated_cost_nano_usd, locale.value) } +function inputTokens(aggregate: UsageAggregateDto): number { + return ( + aggregate.uncached_input_tokens + + aggregate.cache_read_tokens + + aggregate.cache_write_5m_tokens + + aggregate.cache_write_1h_tokens + + aggregate.cache_write_unknown_tokens + ) +} + +function cacheRateLabel(aggregate: UsageAggregateDto): string { + return formatCacheHitRate(aggregate.cache_read_tokens, inputTokens(aggregate), locale.value) +} + function groupName(groupID: number): string { if (groupID === 0) return t('monitor.usage.breakdown.unattributedGroup') return ( @@ -369,17 +384,15 @@ defineExpose({ openFilters }) {{ t('monitor.usage.columns.quality') }} {{ - t('monitor.usage.columns.qualityUsage', { - missing: formatInteger(row.usage_missing_count, locale), - partial: formatInteger(row.partial_count, locale), + t('monitor.usage.columns.qualitySuccess', { + rate: formatPercent(row.success_count, row.request_count, locale), }) }} {{ - t('monitor.usage.columns.qualityPricing', { - unpriced: formatInteger(row.unpriced_request_count, locale), - partial: formatInteger(row.pricing_partial_count, locale), + t('monitor.usage.columns.qualityCache', { + rate: cacheRateLabel(row), }) }} diff --git a/web/src/i18n/locales/en-US/monitor.ts b/web/src/i18n/locales/en-US/monitor.ts index b1cb03b1..dacf2415 100644 --- a/web/src/i18n/locales/en-US/monitor.ts +++ b/web/src/i18n/locales/en-US/monitor.ts @@ -335,6 +335,8 @@ export default { estimatedCost: 'Estimated cost', quality: 'Quality', actions: 'Actions', + qualitySuccess: 'Success rate {rate}', + qualityCache: 'Cache hit rate {rate}', qualityUsage: 'Missing {missing} · Partial {partial}', qualityPricing: 'Unpriced {unpriced} · Partial {partial}', qualityCompact: diff --git a/web/src/i18n/locales/ja-JP/monitor.ts b/web/src/i18n/locales/ja-JP/monitor.ts index 751070f0..8996ced1 100644 --- a/web/src/i18n/locales/ja-JP/monitor.ts +++ b/web/src/i18n/locales/ja-JP/monitor.ts @@ -336,6 +336,8 @@ export default { estimatedCost: '推定コスト', quality: '品質', actions: '操作', + qualitySuccess: '成功率 {rate}', + qualityCache: 'キャッシュ率 {rate}', qualityUsage: 'なし {missing} · 部分 {partial}', qualityPricing: '未設定 {unpriced} · 一部 {partial}', qualityCompact: diff --git a/web/src/i18n/locales/zh-CN/monitor.ts b/web/src/i18n/locales/zh-CN/monitor.ts index ff8b9326..418d9944 100644 --- a/web/src/i18n/locales/zh-CN/monitor.ts +++ b/web/src/i18n/locales/zh-CN/monitor.ts @@ -323,6 +323,8 @@ export default { estimatedCost: '预估成本', quality: '质量', actions: '操作', + qualitySuccess: '成功率 {rate}', + qualityCache: '缓存率 {rate}', qualityUsage: '缺失 {missing} · 部分 {partial}', qualityPricing: '未定价 {unpriced} · 部分定价 {partial}', qualityCompact: From ad362cddfb0d64d2a1917b06a91e1bb7b5b3b4f5 Mon Sep 17 00:00:00 2001 From: tbphp Date: Thu, 6 Aug 2026 23:15:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?test(logging):=20=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BA=8B=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/container/route_contract_test.go | 12 +++---- internal/control/auth_events_test.go | 20 +++++------ internal/control/model_prices_audit_test.go | 2 +- .../control/mutation_audit_routes_test.go | 12 +++---- internal/control/mutation_audit_test.go | 10 +++--- internal/gateway/security_events_test.go | 36 +++++++++---------- internal/gateway/security_integration_test.go | 4 +-- internal/platform/utils/logger_utils_test.go | 2 +- internal/requestlog/process_log_test.go | 6 ++-- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/internal/container/route_contract_test.go b/internal/container/route_contract_test.go index ae212cce..ec8dd028 100644 --- a/internal/container/route_contract_test.go +++ b/internal/container/route_contract_test.go @@ -276,10 +276,10 @@ func TestHTTPRoutesReturnMethodNotAllowedBeforePlaneAuthentication(t *testing.T) } for _, event := range []string{ - "control_plane_auth_failed", - "data_plane_auth_failed", - "control_plane_mutation", - "data_plane_route_not_found", + "auth_failed", + "auth_failed", + "mutation", + "route_not_found", } { if strings.Contains(logs.String(), event) { t.Fatalf("wrong-method requests emitted %q: %s", event, logs.String()) @@ -324,7 +324,7 @@ func TestHTTPRoutesValidateDynamicPathsBeforeDataAuthentication(t *testing.T) { }) } - if strings.Contains(logs.String(), "data_plane_auth_failed") { + if strings.Contains(logs.String(), "auth_failed") { t.Fatalf("invalid dynamic paths emitted data auth failure: %s", logs.String()) } } @@ -366,7 +366,7 @@ func TestHTTPRoutesPreserveResponsesAuthenticationBeforeLocalRejection(t *testin ) } } - if !strings.Contains(logs.String(), "data_plane_auth_failed") { + if !strings.Contains(logs.String(), "auth_failed") { t.Fatalf("Responses local rejections skipped authentication log: %s", logs.String()) } } diff --git a/internal/control/auth_events_test.go b/internal/control/auth_events_test.go index b521876e..f32bf908 100644 --- a/internal/control/auth_events_test.go +++ b/internal/control/auth_events_test.go @@ -56,7 +56,7 @@ func TestAuthenticateEventsCountLockedRequestsWithoutRepeatingTransition( assertControlAuthEventTotals( t, decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_auth_failed", + "auth_failed", []float64{1}, ) @@ -74,10 +74,10 @@ func TestAuthenticateEventsCountLockedRequestsWithoutRepeatingTransition( assertControlAuthEventTotals( t, events, - "control_plane_auth_failed", + "auth_failed", []float64{1}, ) - assertControlAuthEventCount(t, events, "control_plane_auth_locked", 1) + assertControlAuthEventCount(t, events, "auth_locked", 1) now = now.Add(time.Minute) stillLocked := serveAuthRequest( @@ -98,18 +98,18 @@ func TestAuthenticateEventsCountLockedRequestsWithoutRepeatingTransition( assertControlAuthEventTotals( t, events, - "control_plane_auth_failed", + "auth_failed", []float64{1, 6}, ) - assertControlAuthEventCount(t, events, "control_plane_auth_locked", 1) + assertControlAuthEventCount(t, events, "auth_locked", 1) - authEvent := controlEventsNamed(events, "control_plane_auth_failed")[0] + authEvent := controlEventsNamed(events, "auth_failed")[0] if authEvent["peer_ip"] != "192.0.2.60" || authEvent["level"] != "warning" || authEvent["msg"] != "[CONTROL] Authentication failed" { t.Fatalf("auth event = %#v", authEvent) } - lockEvent := controlEventsNamed(events, "control_plane_auth_locked")[0] + lockEvent := controlEventsNamed(events, "auth_locked")[0] if lockEvent["peer_ip"] != "192.0.2.60" || lockEvent["retry_after_seconds"] != float64(authLockDuration/time.Second) || lockEvent["level"] != "warning" || @@ -180,10 +180,10 @@ func TestAuthenticateLockRequestCanEmitBothEventsWhenGateOpens(t *testing.T) { assertControlAuthEventTotals( t, events, - "control_plane_auth_failed", + "auth_failed", []float64{1, 5}, ) - assertControlAuthEventCount(t, events, "control_plane_auth_locked", 1) + assertControlAuthEventCount(t, events, "auth_locked", 1) assertAuthStatus( t, @@ -202,7 +202,7 @@ func TestAuthenticateLockRequestCanEmitBothEventsWhenGateOpens(t *testing.T) { assertControlAuthEventCount( t, decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_auth_locked", + "auth_locked", 1, ) } diff --git a/internal/control/model_prices_audit_test.go b/internal/control/model_prices_audit_test.go index efdf9cfb..af9db6ba 100644 --- a/internal/control/model_prices_audit_test.go +++ b/internal/control/model_prices_audit_test.go @@ -186,7 +186,7 @@ func TestModelPriceMutationAuditExcludesAuthFailureAndWrongMethod(t *testing.T) wrongMethod := httptest.NewRequest(http.MethodGet, fmt.Sprintf("/api/model-prices/%d", row.ID), nil) engine.ServeHTTP(httptest.NewRecorder(), wrongMethod) - events := controlEventsNamed(decodeControlJSONLogs(t, logs.Bytes()), "control_plane_mutation") + events := controlEventsNamed(decodeControlJSONLogs(t, logs.Bytes()), "mutation") if len(events) != 0 { t.Fatalf("mutation events = %#v, want none", events) } diff --git a/internal/control/mutation_audit_routes_test.go b/internal/control/mutation_audit_routes_test.go index 176c2c31..2f505731 100644 --- a/internal/control/mutation_audit_routes_test.go +++ b/internal/control/mutation_audit_routes_test.go @@ -281,7 +281,7 @@ func TestGroupMutationAuditExcludesInternalCalls(t *testing.T) { events := controlEventsNamed( decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_mutation", + "mutation", ) if len(events) != 0 { t.Fatalf("mutation events = %#v, want none", events) @@ -485,7 +485,7 @@ func TestAccessKeyMutationAudit(t *testing.T) { events := controlEventsNamed( decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_mutation", + "mutation", ) if len(events) != 2 { t.Fatalf("mutation events = %#v, want two", events) @@ -1000,9 +1000,9 @@ func TestControlSecurityEventFormatterSecretMatrix(t *testing.T) { logText := output.String() for _, required := range []string{ - "control_plane_auth_failed", - "control_plane_auth_locked", - "control_plane_mutation", + "auth_failed", + "auth_locked", + "mutation", "settings_update", "settings:global", "access_key_reveal", @@ -1457,7 +1457,7 @@ func oneMutationAuditEvent( t.Helper() events := controlEventsNamed( decodeControlJSONLogs(t, logs), - "control_plane_mutation", + "mutation", ) if len(events) != 1 { t.Fatalf("mutation events = %#v, want one", events) diff --git a/internal/control/mutation_audit_test.go b/internal/control/mutation_audit_test.go index c5dbf388..3e3c0a97 100644 --- a/internal/control/mutation_audit_test.go +++ b/internal/control/mutation_audit_test.go @@ -254,7 +254,7 @@ func TestAuditMutationRecordsExactlyOneOutcome(t *testing.T) { } events := controlEventsNamed( decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_mutation", + "mutation", ) if len(events) != 1 { t.Fatalf("mutation events = %#v, want one", events) @@ -309,7 +309,7 @@ func TestAuditMutationUsesSuccessfulLocatorOverride(t *testing.T) { events := controlEventsNamed( decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_mutation", + "mutation", ) if len(events) != 1 || events[0]["resource_locator"] != "probe:42" { t.Fatalf("mutation events = %#v, want probe:42", events) @@ -357,7 +357,7 @@ func TestAuditMutationLogsPanicThenRethrowsToRecovery(t *testing.T) { } events := controlEventsNamed( decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_mutation", + "mutation", ) if len(events) != 1 { t.Fatalf("mutation events = %#v, want one", events) @@ -475,7 +475,7 @@ func TestMutationAuditExcludesReadAndDiscoveryRoutes(t *testing.T) { events := controlEventsNamed( decodeControlJSONLogs(t, logs.Bytes()), - "control_plane_mutation", + "mutation", ) if len(events) != 0 { t.Fatalf("mutation events = %#v, want none", events) @@ -496,7 +496,7 @@ func assertMutationEvent( ) { t.Helper() want := map[string]any{ - "event": "control_plane_mutation", + "event": "mutation", "peer_ip": peerIP, "operation": operation, "resource_type": resourceType, diff --git a/internal/gateway/security_events_test.go b/internal/gateway/security_events_test.go index d7cbe48e..13105ff6 100644 --- a/internal/gateway/security_events_test.go +++ b/internal/gateway/security_events_test.go @@ -54,16 +54,16 @@ func TestGatewaySecurityEventsUseIndependentCounters(t *testing.T) { ) events := decodeGatewayJSONLogs(t, logs.Bytes()) - assertGatewayEventCount(t, events, "data_plane_auth_failed", 1) - assertGatewayEventCount(t, events, "data_plane_route_not_found", 1) - authEvent := gatewayEventsNamed(events, "data_plane_auth_failed")[0] + assertGatewayEventCount(t, events, "auth_failed", 1) + assertGatewayEventCount(t, events, "route_not_found", 1) + authEvent := gatewayEventsNamed(events, "auth_failed")[0] if authEvent["peer_ip"] != "192.0.2.10" || authEvent["total"] != float64(1) || authEvent["level"] != "warning" || authEvent["msg"] != "[DATA] Authentication failed" { t.Fatalf("auth event = %#v", authEvent) } - routeEvent := gatewayEventsNamed(events, "data_plane_route_not_found")[0] + routeEvent := gatewayEventsNamed(events, "route_not_found")[0] if routeEvent["peer_ip"] != "192.0.2.10" || routeEvent["access_key_id"] != float64(1) || routeEvent["total"] != float64(1) || @@ -88,7 +88,7 @@ func TestGatewaySecurityEventCountersAccumulateAcrossWindows(t *testing.T) { }{ { name: "authentication", - eventName: "data_plane_auth_failed", + eventName: "auth_failed", serve: func(engine http.Handler) { serveGatewaySecurityRequest( engine, @@ -101,7 +101,7 @@ func TestGatewaySecurityEventCountersAccumulateAcrossWindows(t *testing.T) { }, { name: "route", - eventName: "data_plane_route_not_found", + eventName: "route_not_found", prepare: func(handler *Handler) { handler.dialects = dialect.NewSet() }, @@ -183,7 +183,7 @@ func TestGatewayRouteNotFoundCoversRecognizedRouteWithoutDialect(t *testing.T) { } events := gatewayEventsNamed( decodeGatewayJSONLogs(t, logs.Bytes()), - "data_plane_route_not_found", + "route_not_found", ) if len(events) != 1 || events[0]["access_key_id"] != float64(1) { @@ -214,8 +214,8 @@ func TestGatewayInvalidAccessKeyDoesNotEmitRouteEvent(t *testing.T) { t.Fatalf("response = %d %s, want 401", recorder.Code, recorder.Body.String()) } events := decodeGatewayJSONLogs(t, logs.Bytes()) - assertGatewayEventCount(t, events, "data_plane_auth_failed", 1) - assertGatewayEventCount(t, events, "data_plane_route_not_found", 0) + assertGatewayEventCount(t, events, "auth_failed", 1) + assertGatewayEventCount(t, events, "route_not_found", 0) } func TestGatewayUnknownRoutesBypassDataPlaneAuthentication(t *testing.T) { @@ -248,8 +248,8 @@ func TestGatewayUnknownRoutesBypassDataPlaneAuthentication(t *testing.T) { } events := decodeGatewayJSONLogs(t, logs.Bytes()) - assertGatewayEventCount(t, events, "data_plane_auth_failed", 0) - assertGatewayEventCount(t, events, "data_plane_route_not_found", 0) + assertGatewayEventCount(t, events, "auth_failed", 0) + assertGatewayEventCount(t, events, "route_not_found", 0) } func TestGatewayRejectsInvalidGeminiRoutesBeforeAuthentication(t *testing.T) { @@ -283,8 +283,8 @@ func TestGatewayRejectsInvalidGeminiRoutesBeforeAuthentication(t *testing.T) { } events := decodeGatewayJSONLogs(t, logs.Bytes()) - assertGatewayEventCount(t, events, "data_plane_auth_failed", 0) - assertGatewayEventCount(t, events, "data_plane_route_not_found", 0) + assertGatewayEventCount(t, events, "auth_failed", 0) + assertGatewayEventCount(t, events, "route_not_found", 0) } func TestGatewayPreservesResponsesAuthenticationBeforeLocalRejection(t *testing.T) { @@ -367,10 +367,10 @@ func TestGatewayPreservesResponsesAuthenticationBeforeLocalRejection(t *testing. } events := decodeGatewayJSONLogs(t, logs.Bytes()) - if got := gatewayEventsNamed(events, "data_plane_auth_failed"); len(got) == 0 { - t.Fatalf("data_plane_auth_failed events = %#v, want unauthenticated Responses requests logged", events) + if got := gatewayEventsNamed(events, "auth_failed"); len(got) == 0 { + t.Fatalf("auth_failed events = %#v, want unauthenticated Responses requests logged", events) } - assertGatewayEventCount(t, events, "data_plane_route_not_found", 0) + assertGatewayEventCount(t, events, "route_not_found", 0) } func TestGatewayMalformedPeerDoesNotChangeResponseOrLeakRawValue(t *testing.T) { @@ -398,7 +398,7 @@ func TestGatewayMalformedPeerDoesNotChangeResponseOrLeakRawValue(t *testing.T) { } events := gatewayEventsNamed( decodeGatewayJSONLogs(t, logs.Bytes()), - "data_plane_auth_failed", + "auth_failed", ) if len(events) != 1 || events[0]["peer_ip"] != "" { t.Fatalf("auth events = %#v, want empty peer_ip", events) @@ -431,7 +431,7 @@ func TestGatewaySecurityEventsIgnoreForwardedPeerHeaders(t *testing.T) { } events := gatewayEventsNamed( decodeGatewayJSONLogs(t, logs.Bytes()), - "data_plane_auth_failed", + "auth_failed", ) if len(events) != 1 || events[0]["peer_ip"] != "192.0.2.15" { t.Fatalf("auth events = %#v, want direct peer", events) diff --git a/internal/gateway/security_integration_test.go b/internal/gateway/security_integration_test.go index a08c98a6..502691c2 100644 --- a/internal/gateway/security_integration_test.go +++ b/internal/gateway/security_integration_test.go @@ -346,8 +346,8 @@ func assertGatewaySecretMatrixOutput( ) { t.Helper() for _, required := range []string{ - "data_plane_auth_failed", - "data_plane_route_not_found", + "auth_failed", + "route_not_found", "access_key_id", } { if !strings.Contains(logText, required) { diff --git a/internal/platform/utils/logger_utils_test.go b/internal/platform/utils/logger_utils_test.go index eee10d35..e986153b 100644 --- a/internal/platform/utils/logger_utils_test.go +++ b/internal/platform/utils/logger_utils_test.go @@ -123,7 +123,7 @@ func TestCompactTextFormatterOrdersRequestFieldsByPriority(t *testing.T) { "kid": 1, "out_tokens": 486, "model": "gpt-5.6-luna", - "event": "data_plane_request_completed", + "event": "request_completed", "cost_usd": "0.00496768", "in_tokens": 123068, "duration": "30.2s", diff --git a/internal/requestlog/process_log_test.go b/internal/requestlog/process_log_test.go index 9ae0159f..52a8d6b0 100644 --- a/internal/requestlog/process_log_test.go +++ b/internal/requestlog/process_log_test.go @@ -38,7 +38,7 @@ func processLogEntries(t *testing.T, output []byte) []map[string]any { if err := json.Unmarshal(line, &entry); err != nil { t.Fatalf("decode log line %q: %v", line, err) } - if entry["event"] == "data_plane_request_completed" { + if entry["event"] == "request_completed" { entries = append(entries, entry) } } @@ -73,7 +73,7 @@ func TestProjectProcessLogUsesFrozenPricingAndInputOutputTotals(t *testing.T) { t.Fatalf("projection = %t/%s", ok, level) } want := logrus.Fields{ - "event": "data_plane_request_completed", + "event": "request_completed", "status": "error", "http": http.StatusBadGateway, "proto": string(protocol.OpenAICompletions), "ak_id": uint(42), "model": "client-model", "up_model": "upstream-model", @@ -124,7 +124,7 @@ func TestProjectProcessLogOmitsDefaultAndZeroValueFields(t *testing.T) { t.Fatalf("projection = %t/%s", ok, level) } want := logrus.Fields{ - "event": "data_plane_request_completed", + "event": "request_completed", "status": "success", "proto": "anthropic", "ak_id": uint(42), "model": "client-model", "group": uint(7), "kid": uint(8), "duration": "25ms",