Not using Claude Code or similar agentic dev-tool?
You can integrate your app manually using Sentry SDK.
The Integrate with AI section shows you a ready-made prompt for a simple integration of Better Stack error tracking into your app using Claude Code or Cursor.
You can integrate your app manually using Sentry SDK.
Even if you use an AI agent, it's helpful to see what the final integration code looks like. Here are a few examples of how to use the Sentry SDK:
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://$APPLICATION_TOKEN@$INGESTING_HOST/1",
// To capture performance monitoring data,
// you must set tracesSampleRate
tracesSampleRate: 1.0,
});
// Example of capturing an exception
try {
throw new Error("This is a test error from the browser!");
} catch (e) {
Sentry.captureException(e);
}
import sentry_sdk
sentry_sdk.init(
dsn="https://$APPLICATION_TOKEN@$INGESTING_HOST/1",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
)
# Example of capturing an exception
try:
1 / 0
except ZeroDivisionError as e:
sentry_sdk.capture_exception(e)
require 'sentry-ruby'
Sentry.init do |config|
config.dsn = 'https://$APPLICATION_TOKEN@$INGESTING_HOST/1'
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
# To activate performance monitoring, set one of these options.
# We recommend adjusting the value in production:
config.traces_sample_rate = 1.0
end
# Example of capturing an exception
begin
1 / 0
rescue ZeroDivisionError => exception
Sentry.capture_exception(exception)
end
Read the official Sentry SDK documentation for more languages. Make sure to change the DSN to send the data to Better Stack.
After running the prompt and triggering and error, you should see your first report in Errors 🚀
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.