config.ts
services/analytics/config.ts
39
Lines
1237
Bytes
2
Exports
2
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with integrations. It contains 39 lines, 2 detected imports, and 2 detected exports.
Important relationships
- services/analytics/datadog.ts
- services/analytics/firstPartyEventLogger.ts
- services/analytics/firstPartyEventLoggingExporter.ts
- services/analytics/growthbook.ts
- services/analytics/index.ts
- services/analytics/metadata.ts
- services/analytics/sink.ts
- services/analytics/sinkKillswitch.ts
- query/config.ts
- services/autoDream/config.ts
- services/lsp/config.ts
- services/mcp/config.ts
Detected exports
isAnalyticsDisabledisFeedbackSurveyDisabled
Keywords
analyticsprocessisenvtruthytestshoulddisabledistelemetrydisablednode_envutilscheck
Detected imports
../../utils/envUtils.js../../utils/privacyLevel.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
/**
* Shared analytics configuration
*
* Common logic for determining when analytics should be disabled
* across all analytics systems (Datadog, 1P)
*/
import { isEnvTruthy } from '../../utils/envUtils.js'
import { isTelemetryDisabled } from '../../utils/privacyLevel.js'
/**
* Check if analytics operations should be disabled
*
* Analytics is disabled in the following cases:
* - Test environment (NODE_ENV === 'test')
* - Third-party cloud providers (Bedrock/Vertex)
* - Privacy level is no-telemetry or essential-traffic
*/
export function isAnalyticsDisabled(): boolean {
return (
process.env.NODE_ENV === 'test' ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) ||
isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) ||
isTelemetryDisabled()
)
}
/**
* Check if the feedback survey should be suppressed.
*
* Unlike isAnalyticsDisabled(), this does NOT block on 3P providers
* (Bedrock/Vertex/Foundry). The survey is a local UI prompt with no
* transcript data — enterprise customers capture responses via OTEL.
*/
export function isFeedbackSurveyDisabled(): boolean {
return process.env.NODE_ENV === 'test' || isTelemetryDisabled()
}