MCPcopy Create free account
hub / github.com/Noumena-Network/code / _fetchMetricsEnabled

Function _fetchMetricsEnabled

src/services/api/metricsOptOut.ts:49–70  ·  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

47 * This is wrapped by memoizeWithTTLAsync to add caching behavior
48 */
49async 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
72async function _checkMetricsEnabledAPI(): Promise<MetricsStatus> {
73 // Incident kill switch: skip the network call when nonessential traffic is disabled.

Callers

nothing calls this directly

Calls 4

getNcodeUserAgentFunction · 0.85
buildNoumenaPlatformUrlFunction · 0.85
getAuthHeadersFunction · 0.50

Tested by

no test coverage detected