Evita perder tempo a reproduzir erros. Obtém contexto como a linha de código, ações do utilizador e funções que levaram ao erro para depurar e corrigir rapidamente.
Monitorização de erros
Recebe informações úteis para resolver os problemas mais importantes relacionados ao código. Rastreia, depura e resolve erros em qualquer linguagem ou framework com contexto personalizado para chegar sempre à causa de raiz.
Utilizado por 4 milhões de developers.
- GitHub
- Disney
- Atlassian
- Linear
- Vercel
- Cloudflare
- Slack
- Metronome
- Autodesk
- Microsoft
- Instacart
- Lyft
- Bolt
- Monday
- Cursor
- Anthropic
- Factory AI
- Sentry
- Baseten
- Runlayer
- Convex
Automatiza a triagem de problemas
Sabe quando o teu código falha e quem pode ajudar a corrigir. Atribui automaticamente problemas ao developer que introduziu o código com erro e notifica a tua equipa no Slack quando o erro ocorre pela primeira vez, reincide ou se agrava.
Assegura a qualidade e a estabilidade do lançamento
Obtém visibilidade imediata entre lançamentos com dados sobre métricas principais como sessões sem falhas, adoção de versões e taxas de falha. Sabe quando uma versão começa a degradar para poderes reverter rapidamente… se tiveres de o fazer.
Começar com o Sentry é simples.
Suportamos todas as tecnologias (exceto as que não suportamos).
Começa com apenas algumas linhas de código.
Regista-te e instala o Sentry com apenas uma linha de código:
npx @sentry/wizard@latest -i nextjsObtém o SDK do Sentry para Go:
go get "github.com/getsentry/sentry-go"A configuração deve ser feita o mais cedo possível no ciclo de vida da tua aplicação:
package main
import (
"log"
"time"
"github.com/getsentry/sentry-go"
)
func main() {
err := sentry.Init(sentry.ClientOptions{
Dsn: "https://<key>@sentry.io/<project>",
EnableTracing: true,
TracesSampleRate: 1.0,
TracesSampler: sentry.TracesSampler(func(ctx sentry.SamplingContext) float64 {
if ctx.Span.Name == "GET /health" {
return 0.0
}
return 1.0
}),
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
}Regista-te e instala o Sentry com apenas uma linha de código:
npx @sentry/wizard@latest -i angularAdiciona a dependência do Sentry:
dotnet add package Sentry.AspNetCoreConfigura o Sentry em appsettings.json:
"Sentry": {
"Dsn": "https://examplePublicKey@o0.ingest.sentry.io/0",
"Debug": true,
},Depois adiciona o SDK simplesmente chamando UseSentry:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
// Adiciona a seguinte linha:
webBuilder.UseSentry();
});Executa este comando para instalar e registar a integração do Sentry com o Astro:
npx astro add @sentry/astroE adiciona o teu DSN e a configuração do projeto ao ficheiro astro.config.mjs:
import { defineConfig } from "astro/config";
import sentry from "@sentry/astro";
export default defineConfig({
integrations: [
sentry({
dsn: "__DSN__",
sourceMapsUploadOptions: {
project: "your-project-slug",
authToken: process.env.SENTRY_AUTH_TOKEN,
},
tracesSampleRate: 1.0,
}),
],
});Instala o pacote NuGet para adicionar a dependência do Sentry:
dotnet add package SentryInicializa o SDK o mais cedo possível, como no método Main em Program.cs/Program.fs:
using (SentrySdk.Init(o => {
o.Dsn = "https://<key>@sentry.io/<project>";
o.Debug = true;
o.TracesSampleRate = 1.0; }))
{
// O código da aplicação vai aqui - o Dispose irá esvaziar os eventos
}Obtém o SDK do Sentry para JavaScript:
<script src="https://browser.sentry-cdn.com/<VERSION>/bundle.min.js"></script>Configura o teu DSN:
Sentry.init({ dsn: 'https://<key>@sentry.io/<project>',
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});Instala o pacote sentry/sentry-laravel com o Composer:
composer require sentry/sentry-laravelAdiciona os relatórios do Sentry a bootstrap/app.php:
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Sentry\Laravel\Integration;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
Integration::handles($exceptions);
})->create();Ativa o Sentry Tracing em config/sentry.php:
'traces_sample_rate' => 0.2,
'traces_sampler' => function (\Sentry\Tracing\SamplingContext $context): float {
// retorna um número entre 0 e 1
},Executa este comando Artisan para configurar o DSN do Sentry:
php artisan sentry:publish --dsn=<paste-your-DSN-here>Instala o pacote sentry/sentry com o Composer:
composer require sentry/sentryPara capturar todos os erros, incluindo os do arranque da tua aplicação, deves inicializar o SDK do Sentry para PHP o mais cedo possível:
\Sentry\init(['dsn' => 'https://<key>@sentry.io/<project>',
'traces_sample_rate' => 0.2,
'traces_sampler' => function (\Sentry\Tracing\SamplingContext $context): float {
// retorna um número entre 0 e 1
}, ]);Obtém o SDK do Sentry para Python:
pip install --upgrade sentry-sdkConfigura o teu DSN:
import sentry_sdk
sentry_sdk.init(
"https://<key>@sentry.io/<project>",
enable_tracing=True,
traces_sample_rate=1.0,
)Obtém o SDK do Sentry para React:
npm install @sentry/reactConfigura o teu DSN:
import React from "react";
import ReactDOM from "react-dom";
import * as Sentry from "@sentry/react";
import App from "./App";
Sentry.init({
dsn: "https://<key>@sentry.io/<project>",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.reactRouterV6BrowserTracingIntegration({
useEffect: React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
}),
],
tracesSampleRate: 1.0,
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});
ReactDOM.render(<App />, document.getElementById("root"));Adiciona a gem sentry-ruby ao teu Gemfile:
gem "sentry-ruby"Configura o teu DSN:
Sentry.init do |config|
config.dsn = 'https://<key>@sentry.io/<project>'
config.traces_sample_rate = 1.0
config.traces_sampler = lambda do |sampling_context|
true
end
endPara usar o SDK, inicializa o Sentry no teu ponto de entrada Solid index.jsx antes de renderizar a tua aplicação Solid:
import * as Sentry from "@sentry/solid";
import { useBeforeLeave, useLocation } from "@solidjs/router";
import { render } from "solid-js/web";
import App from "./app";
Sentry.init({
dsn: "__DSN__",
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
});
const app = document.getElementById("app");
if (!app) throw new Error("No #app element found in the DOM.");
render(() => <App />, app)Obtém o SDK do Sentry para Java:
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter</artifactId>
<version><VERSION></version>
</dependency>Configura o teu DSN em application.properties:
sentry.dsn=https://<key>@sentry.io/<project>
sentry.traces-sample-rate=1.0Para usar o SDK, inicializa o Sentry no teu ponto de entrada Svelte main.js antes de iniciar a tua aplicação Svelte:
import App from "./App.svelte";
import * as Sentry from "@sentry/svelte";
Sentry.init({
dsn: "__DSN__",
release: "my-project-name@2.3.12",
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});
const app = new App({
target: document.getElementById("app"),
});
export default app;Para integrar o Sentry no teu projeto Xcode, especifica-o no teu Podfile e depois executa pod install:
platform :ios, '9.0'
use_frameworks!
target 'YourApp' do
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '<VERSION>'
endInicializa o SDK o mais cedo possível no ciclo de vida da tua aplicação:
import Sentry
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SentrySDK.start { options in
options.dsn = "https://<key>@sentry.io/<project>"
options.debug = true
options.tracesSampleRate = 1.0
}
return true
}Obtém o SDK do Sentry para Vue:
npm install @sentry/vueConfigura o teu DSN:
import { createApp } from "vue";
import * as Sentry from "@sentry/vue";
const app = createApp({});
Sentry.init({
app,
dsn: "https://<key>@sentry.io/<project>",
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
});
app.mount("#app");Regista-te e instala o Sentry com apenas uma linha de código:
brew install getsentry/tools/sentry-wizard && sentry-wizard -i androidO mais incrível disto é que eu provavelmente teria este bug há meses e nunca daria por isso.
Estou a começar a perceber que ter o Sentry resulta numa melhor UX, porque acabas por corrigir muitos destes pequenos incómodos que nem sabias que tinhas.
A quantidade de detalhe que recebes num issue do @getsentry é SURREAL
- informação do navegador
- referência à linha específica de código
- erro específico com rastreio (até ao backend)
E isto nem inclui os session replays!
Finalmente corrigi a minha integração com o @getsentry no meu site pessoal e, caramba, porque é que esperei tanto tempo? Isto é incrível.