> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devinenterprise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Correzioni quotidiane degli errori di Sentry

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Correzioni quotidiane degli errori Sentry" description="Programma una sessione giornaliera di Devin che recupera i nuovi errori Sentry durante la notte, avvia una sessione di correzione per ciascuno e ha le PR pronte per la mattina." prompt="Usa il Sentry MCP per recuperare tutti gli errori irrisolti delle ultime 24 ore nel progetto payments-api, ordinati per numero di eventi. Per i 5 errori più frequenti, analizza lo stack trace e la causa principale, quindi avvia una sessione Devin per ciascuno di essi per aprire una PR con una correzione e un test di regressione. Ignora gli errori con tag wontfix o expected-behavior." category="Automazioni" features="Pianificazioni, MCP, Avanzato" type="schedule" agent="advanced" />

<div className="uc-detail-wrapper">
  <Tip>Per una guida più dettagliata sull'integrazione con Sentry, [clicca qui](/it/enterprise/integrations/sentry).</Tip>

  <Steps>
    <Step title="Connetti l'MCP di Sentry">
      Prima di creare il tuo programma, Devin ha bisogno di accedere ai dati di Sentry.

      1. Vai su **Settings > Connections > server MCP** e cerca **Sentry**
      2. Fai clic su **Enable** e autenticati tramite OAuth — in questo modo concedi a Devin accesso in sola lettura alle tue issue, agli eventi e agli stack trace di Sentry
      3. Fai clic su **Test listing tools** per verificare che la connessione funzioni correttamente

      Una volta connesso, Devin può interrogare i tuoi progetti Sentry, recuperare i dettagli delle issue e gli stack trace e leggere i breadcrumb, tutto all'interno di una sessione. Scopri di più sulla [configurazione dei server MCP](/it/work-with-devin/mcp).
    </Step>

    <Step title="Crea la pianificazione">
      Vai su **Settings > [Schedules](/it/product-guides/scheduled-sessions)** e fai clic su **Create schedule**.

      * **Name**: `Daily Sentry remediation — payments-api`
      * **Frequency**: Tutti i giorni alle 6:00 AM (così le pull request (PR) con le correzioni sono pronte prima del daily standup)
      * **Agent**: Devin — permette a Devin di avviare una sessione separata per ogni errore, così le correzioni vengono eseguite in parallelo
      * **Slack channel**: Seleziona un canale (ad es. `#sentry-fixes`) così il tuo team riceve una notifica quando l'esecuzione è completata e le PR sono pronte per la revisione
      * **Prompt**:

      <PromptBlock type="schedule" agent="advanced">
        ```txt Daily Sentry remediation theme={null}
        Usa il Sentry MCP per recuperare tutti gli errori non risolti
        nelle ultime 24 ore nel progetto payments-api, ordinati per numero di eventi.
        Ignora gli errori etichettati `wontfix` o `expected-behavior`.

        Per i primi 5 errori:
        1. Recupera la stack trace completa e i breadcrumb
        2. Trova i file sorgente rilevanti nel nostro repository
        3. Identifica la causa principale
        4. Avvia una sessione Devin per aprire una PR con una correzione e un test
           di regressione, inserendo l'URL della issue di Sentry nella descrizione della PR

        Pubblica un riepilogo di tutti gli errori e delle relative PR su Slack.

        Se lascio feedback su una qualsiasi delle PR (ad es. segnando una
        correzione come falso positivo, richiedendo un approccio diverso o approvando
        un pattern), crea una voce in Knowledge che raccolga quel feedback in modo che
        le esecuzioni future gestiscano correttamente errori simili.
        ```
      </PromptBlock>
    </Step>

    <Step title="Popola Knowledge a partire dalla tua codebase e dalle correzioni precedenti">
      Devin scrive correzioni migliori quando comprende gli schemi di errore della tua app. Invece di scrivere manualmente le voci di Knowledge, chiedi a Devin in qualsiasi sessione di analizzare la base di codice e le correzioni passate, quindi lascia che sia Devin a creare la Knowledge:

      <PromptBlock agent="advanced">
        ```txt Learn our error patterns and create Knowledge theme={null}
        Investigate our payments-api codebase and build Knowledge entries
        for common error patterns:

        1. Read recent merged PRs that fixed Sentry errors — look for
           patterns in what broke and how it was fixed
        2. Check resolved Sentry issues for recurring root causes
           (null checks, N+1 queries, missing error boundaries)
        3. Review our error handling conventions in the codebase —
           which wrapper classes we use, how we log errors, our
           retry/fallback patterns

        For each pattern you find, create a Knowledge entry with a
        specific trigger (e.g., "TypeError in checkout", "database
        timeout in reports") and actionable fix guidance.
        ```
      </PromptBlock>

      Queste voci vengono richiamate automaticamente quando Devin rileva errori corrispondenti durante le esecuzioni pianificate — e il prompt pianificato sopra indica a Devin di aggiornare Knowledge sulla base del feedback sulle tue PR, così migliora nel tempo.
    </Step>

    <Step title="Risultato di un'esecuzione tipica">
      Ogni mattina, Devin elabora la coda degli errori accumulati durante la notte e apre PR mirate. Ecco un esempio di output di una sessione reale:

      ```
      Processed 5 Sentry errors from payments-api (past 24h):

      1. TypeError: Cannot read property 'last4' of null (1,892 events)
         Root cause: Stripe webhook delivers `payment_method: null` for
         bank transfer payments. CheckoutReceipt.tsx:34 destructures
         without a null check.
         PR #612: Add null safety to CheckoutReceipt, show "Bank Transfer"
         fallback for non-card payments.

      2. TimeoutError: Query timeout after 30s on /api/invoices (743 events)
         Root cause: N+1 query in InvoiceService.getMonthly() — each
         line item triggers a separate product lookup.
         PR #613: Add eager loading for invoice line items with
         Sequelize `include`.

      3. RangeError: Maximum call stack size exceeded (412 events)
         Root cause: Circular reference in refund.toJSON() when a
         refund references its parent transaction which references
         the refund.
         PR #614: Break circular ref with a custom serializer,
         add max-depth test.

      4-5. Two lower-frequency validation errors — PRs #615, #616.
      ```

      Ogni pull request (PR) include il link all'issue Sentry, una descrizione della causa principale, la correzione e un test che avrebbe individuato l'errore originale.
    </Step>

    <Step title="Ottimizza e itera">
      Dopo una settimana di esecuzioni, rivedi cosa funziona e adegua:

      **Definisci l'ambito del conteggio degli errori.** Inizia con i `top 5` errori per esecuzione. Se Devin produce costantemente PR pronti al merge, aumenta a 8-10. Se le correzioni richiedono revisioni significative, riduci a 3.

      **Filtra per progetto o tag.** Restringi il prompt a specifici progetti Sentry (`payments-api`, `web-frontend`) o escludi i tag rumorosi. Puoi creare schedulazioni separate per progetto se i volumi di errori sono diversi.

      **Impara dai risultati.** Dopo un paio di settimane, chiedi a Devin di analizzare quali correzioni sono effettivamente arrivate in produzione e trasformarle in Knowledge:

      <PromptBlock agent="advanced">
        ```txt Analyze Sentry fix outcomes and update Knowledge theme={null}
        Look at all PRs Devin opened for Sentry errors in the last 2 weeks.
        For each PR, check whether it was merged or closed.

        Identify themes and learnings — which fix patterns worked, which
        approaches were rejected, what types of errors were false positives,
        and where Devin lacked context. Then update your Knowledge
        accordingly: create new entries, edit existing ones, or delete
        entries that led to bad fixes.
        ```
      </PromptBlock>
    </Step>
  </Steps>
</div>
