MCPcopy Index your code
hub / github.com/codeaashu/claude-code / _fetchMetricsEnabled

Function _fetchMetricsEnabled

src/services/api/metricsOptOut.ts:33–51  ·  view source on GitHub ↗

* Internal function to call the API and check if metrics are enabled * This is wrapped by memoizeWithTTLAsync to add caching behavior

()

Source from the content-addressed store, hash-verified

31 * This is wrapped by memoizeWithTTLAsync to add caching behavior
32 */
33async function _fetchMetricsEnabled(): Promise<MetricsEnabledResponse> {
34 const authResult = getAuthHeaders()
35 if (authResult.error) {
36 throw new Error(`Auth error: ${authResult.error}`)
37 }
38
39 const headers = {
40 'Content-Type': 'application/json',
41 'User-Agent': getClaudeCodeUserAgent(),
42 ...authResult.headers,
43 }
44
45 const endpoint = `https://api.anthropic.com/api/claude_code/organizations/metrics_enabled`
46 const response = await axios.get<MetricsEnabledResponse>(endpoint, {
47 headers,
48 timeout: 5000,
49 })
50 return response.data
51}
52
53async function _checkMetricsEnabledAPI(): Promise<MetricsStatus> {
54 // Incident kill switch: skip the network call when nonessential traffic is disabled.

Callers

nothing calls this directly

Calls 2

getClaudeCodeUserAgentFunction · 0.85
getAuthHeadersFunction · 0.50

Tested by

no test coverage detected