feat: Sentry in the API, the worker, the Site and the Kanban (off until the DSNs are set)
app/observability.py starts sentry-sdk for the API and the worker when SENTRY_DSN_API is set, with send_default_pii off and a scrub that strips cookies, tokens, bodies, CPF/CNPJ and e-mails. The browser loads the official Sentry bundle from our own origin (web/vendor, provenance in its README) and starts with SENTRY_DSN_WEB from /api/session or /api/operator/me; every failed API answer the customer or the team gets is reported with its path, status and message, never the request body. The CSP allows Blyzer's Sentry ingest host. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,11 @@
|
||||
let data;
|
||||
try { data = text ? JSON.parse(text) : {}; }
|
||||
catch (_) { throw new Error(response.ok ? 'Resposta inválida do serviço.' : 'O serviço está indisponível. Tente novamente em instantes.'); }
|
||||
if (!response.ok) { const error=new Error(problem(data.detail));error.status=response.status;throw error; }
|
||||
if (!response.ok) {
|
||||
const error=new Error(problem(data.detail));error.status=response.status;
|
||||
window.dtfObservability?.apiError?.(path,response.status,error.message,data.detail);
|
||||
throw error;
|
||||
}
|
||||
return data;
|
||||
};
|
||||
// A refusal as one sentence: the server's own, or the first field a form
|
||||
@@ -60,6 +64,9 @@
|
||||
}
|
||||
const ready = api('/session');
|
||||
ready.then(session=>{
|
||||
window.dtfEnvironment=session.sentry_environment||session.environment;
|
||||
window.dtfRelease=session.sentry_release||undefined;
|
||||
window.dtfObservability?.start?.(session.sentry_dsn_web,'site');
|
||||
window.dtfUploadMaxBytes=session.max_upload_bytes;
|
||||
const limit=document.getElementById('zLimite');
|
||||
if(limit)limit.textContent='Até '+(session.max_upload_bytes/1073741824).toFixed(0)+' GB por arquivo.';
|
||||
|
||||
Reference in New Issue
Block a user