feat: 更新 sentry 错误上报

This commit is contained in:
claude-code-best
2026-04-03 09:39:25 +08:00
parent 1f0a2e44c8
commit 119518599e
11 changed files with 493 additions and 2 deletions

View File

@@ -48,6 +48,7 @@ import { configureGlobalAgents } from '../utils/proxy.js'
import { isBetaTracingEnabled } from '../utils/telemetry/betaSessionTracing.js'
import { getTelemetryAttributes } from '../utils/telemetryAttributes.js'
import { setShellIfWindows } from '../utils/windowsPaths.js'
import { initSentry } from '../utils/sentry.js'
// initialize1PEventLogging is dynamically imported to defer OpenTelemetry sdk-logs/resources
@@ -150,6 +151,9 @@ export const init = memoize(async (): Promise<void> => {
logForDebugging('[init] configureGlobalAgents complete')
profileCheckpoint('init_network_configured')
// Initialize Sentry for error reporting (no-op if SENTRY_DSN not set)
initSentry()
// Preconnect to the Anthropic API — overlap TCP+TLS handshake
// (~100-200ms) with the ~100ms of action-handler work before the API
// request. After CA certs + proxy agents are configured so the warmed