Astro

Altix ErrorTrack utiliza el protocolo de Sentry, por lo que puedes usar el SDK oficial de @sentry/astro. Los fragmentos a continuación usan un DSN de ejemplo; la página de configuración de tu proyecto los muestra con el real.

  1. Instalar el SDK

    Añade @sentry/astro, el SDK oficial de Sentry. Funciona sin modificaciones con Altix ErrorTrack.

    bash

    npx astro add @sentry/astro
  2. Configurarlo

    Inicializa el SDK lo antes posible en tu aplicación, con tu DSN.

    astro.config.mjs

    import { defineConfig } from "astro/config";
    import sentry from "@sentry/astro";
    
    export default defineConfig({
      integrations: [sentry()],
    });

    sentry.client.config.js

    import * as Sentry from "@sentry/astro";
    
    Sentry.init({
      dsn: "https://<public-key>@errortrack.altixcode.com/<project-id>",
      integrations: [
        Sentry.browserTracingIntegration(),
        Sentry.replayIntegration(),
      ],
      tracesSampleRate: 1.0,
      replaysSessionSampleRate: 0.1,
      replaysOnErrorSampleRate: 1.0,
      // Optional: send events through your own server to get past ad blockers (see /docs/tunnel)
      // tunnel: "/monitoring",
    });

    sentry.server.config.js

    import * as Sentry from "@sentry/astro";
    
    Sentry.init({
      dsn: "https://<public-key>@errortrack.altixcode.com/<project-id>",
      tracesSampleRate: 1.0,
    });
  3. Subir source maps

    Para que los seguimientos de la pila muestren tu código original en lugar de la salida minificada. Crea un token de autenticación con el ámbito project:releases en Ajustes → Tokens de autenticación y guárdalo en los secretos de tu CI, nunca en el repositorio.

    bash

    # Set in the build environment; the SDK's build plugin uploads source maps with them.
    export SENTRY_URL=https://errortrack.altixcode.com
    export SENTRY_ORG=<org-slug>
    export SENTRY_PROJECT=<project-slug>
    export SENTRY_AUTH_TOKEN=<an auth token from Settings → Auth Tokens>

    Guía de source maps

  4. Verificar

    Provoca un error a propósito. Aparecerá en tu lista de incidencias en cuestión de segundos.

    html

    <button onclick="throw new Error('My first ErrorTrack error')">Break the world</button>

Crea un proyecto y su página de configuración completará tu DSN real.