* Internal function to call the API and check if metrics are enabled * This is wrapped by memoizeWithTTLAsync to add caching behavior
()
| 47 | * This is wrapped by memoizeWithTTLAsync to add caching behavior |
| 48 | */ |
| 49 | async function _fetchMetricsEnabled(): Promise<MetricsEnabledResponse> { |
| 50 | const authResult = getAuthHeaders() |
| 51 | if (authResult.error) { |
| 52 | throw new Error(`Auth error: ${authResult.error}`) |
| 53 | } |
| 54 | |
| 55 | const headers = { |
| 56 | 'Content-Type': 'application/json', |
| 57 | 'User-Agent': getNcodeUserAgent(), |
| 58 | ...getOrganizationUuidHeader(), |
| 59 | ...authResult.headers, |
| 60 | } |
| 61 | |
| 62 | const endpoint = buildNoumenaPlatformUrl( |
| 63 | '/api/claude_code/organizations/metrics_enabled', |
| 64 | ) |
| 65 | const response = await axios.get<MetricsEnabledResponse>(endpoint, { |
| 66 | headers, |
| 67 | timeout: 5000, |
| 68 | }) |
| 69 | return response.data |
| 70 | } |
| 71 | |
| 72 | async function _checkMetricsEnabledAPI(): Promise<MetricsStatus> { |
| 73 | // Incident kill switch: skip the network call when nonessential traffic is disabled. |
nothing calls this directly
no test coverage detected