feat(logging): enhance API request logging and implement noRetry flag for improved error handling and diagnostics
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m54s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m54s
This commit is contained in:
@@ -151,7 +151,10 @@ export default function ResourceStatsPage() {
|
||||
const fetchStats = useCallback(async (abortSignal) => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const opts = { timeout: REQUEST_TIMEOUT_MS, ...(abortSignal ? { signal: abortSignal } : {}) };
|
||||
const opts = { timeout: REQUEST_TIMEOUT_MS, noRetry: true, ...(abortSignal ? { signal: abortSignal } : {}) };
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7343/ingest/aa002dd6-6968-4a35-b09d-f05302d83266',{method:'POST',headers:{'Content-Type':'application/json','X-Debug-Session-Id':'378b5f'},body:JSON.stringify({sessionId:'378b5f',runId:'resource-stats-fix',hypothesisId:'H_RS_RETRY',location:'frontend/src/ResourceStatsPage.jsx:fetchStats',message:'Resource stats request started with noRetry',data:{timeoutMs:REQUEST_TIMEOUT_MS,noRetry:true,hasAbortSignal:Boolean(abortSignal)},timestamp:Date.now()})}).catch(()=>{});
|
||||
// #endregion
|
||||
try {
|
||||
const res = await api.get('/resources/stats', opts);
|
||||
const data = res?.data;
|
||||
|
||||
@@ -74,6 +74,14 @@ api.interceptors.response.use(
|
||||
|
||||
const config = error?.config || {};
|
||||
const method = String(config.method || 'get').toUpperCase();
|
||||
const noRetry = config?.noRetry === true || config?.__noRetry === true;
|
||||
|
||||
if (noRetry) {
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7343/ingest/aa002dd6-6968-4a35-b09d-f05302d83266',{method:'POST',headers:{'Content-Type':'application/json','X-Debug-Session-Id':'378b5f'},body:JSON.stringify({sessionId:'378b5f',runId:'resource-stats-fix',hypothesisId:'H_RS_RETRY',location:'frontend/src/lib/api.js:retry-disabled-by-config',message:'Skip retry due to noRetry flag',data:{method:String(method),url:String(config?.url||''),code:String(error?.code||''),retryCount:Number(config?.__retryCount||0)},timestamp:Date.now()})}).catch(()=>{});
|
||||
// #endregion
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
// Инициализируем счетчик попыток
|
||||
config.__retryCount = config.__retryCount || 0;
|
||||
|
||||
Reference in New Issue
Block a user