Skip to content

Commit 8388245

Browse files
authored
Merge pull request #124 from huggingface/fix/log-dedupes
dedupe gradio failures from dynamic space calls
2 parents 9a87ee7 + 4fc1833 commit 8388245

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/app/src/server/utils/gradio-discovery.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
1212
import { logger } from './logger.js';
13+
import { gradioMetrics } from './gradio-metrics.js';
1314
import {
1415
spaceMetadataCache,
1516
schemaCache,
@@ -341,11 +342,16 @@ async function fetchSchema(
341342
clearTimeout(timeoutId);
342343
}
343344
} catch (error) {
344-
logger.warn({
345-
spaceName,
346-
subdomain: metadata.subdomain,
347-
error: error instanceof Error ? error.message : String(error),
348-
}, 'Failed to fetch schema');
345+
const isFirstError = gradioMetrics.schemaFetchError(spaceName);
346+
const logFn = isFirstError ? 'warn' : 'trace';
347+
logger[logFn](
348+
{
349+
spaceName,
350+
subdomain: metadata.subdomain,
351+
error: error instanceof Error ? error.message : String(error),
352+
},
353+
'Failed to fetch schema'
354+
);
349355

350356
return {
351357
success: false,

0 commit comments

Comments
 (0)