* Internal function to call the API and check if metrics are enabled * This is wrapped by memoizeWithTTLAsync to add caching behavior
()
| 31 | * This is wrapped by memoizeWithTTLAsync to add caching behavior |
| 32 | */ |
| 33 | async 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 | |
| 53 | async function _checkMetricsEnabledAPI(): Promise<MetricsStatus> { |
| 54 | // Incident kill switch: skip the network call when nonessential traffic is disabled. |
nothing calls this directly
no test coverage detected