This document provides comprehensive integration guides for connecting your applications to the Error Observability platform using the Sentry SDK.
- Overview
- Quick Start
- Supported Languages
- DSN Configuration
- Common Features
- Language-Specific Guides
- Best Practices
- Troubleshooting
The Error Observability platform is compatible with the Sentry SDK ecosystem. This allows you to use any Sentry-compatible SDK to send error reports, performance data, and custom events to your self-hosted Bugsink server.
- Error Tracking: Capture exceptions with full stack traces
- Performance Monitoring: Track transactions and spans for performance insights
- Breadcrumbs: Record user actions leading up to an error
- User Context: Associate errors with specific users
- Custom Tags & Context: Add metadata for filtering and analysis
- Release Tracking: Track errors by application version
- Get your DSN from the Bugsink dashboard (Project Settings → Client Keys)
- Install the SDK for your language
- Initialize the SDK with your DSN
- Start capturing errors automatically or manually
https://<project-key>@<hostname>/<project-id>
Example:
https://abc123def456@errors.observability.app.bauer-group.com/1
| Language | SDK Package | Example File |
|---|---|---|
| Python | sentry-sdk |
python_example.py |
| Node.js | @sentry/node |
nodejs_example.js |
| TypeScript | @sentry/node |
typescript_example.ts |
| Java | io.sentry:sentry |
JavaExample.java |
| C# / .NET | Sentry |
DotNetExample.cs |
| Go | github.com/getsentry/sentry-go |
go_example.go |
| PHP | sentry/sentry |
php_example.php |
| Ruby | sentry-ruby |
ruby_example.rb |
| Rust | sentry |
rust_example.rs |
| C / C++ | sentry-native |
cpp_example.cpp |
All SDK examples demonstrate these core features:
# Example: Python
sentry_sdk.init(
dsn="https://key@hostname/1",
environment="production",
release="my-app@1.0.0",
traces_sample_rate=0.1,
)Associate errors with specific users for better debugging:
sentry_sdk.set_user({
"id": "user-123",
"email": "user@example.com",
"username": "johndoe"
})Track user actions leading up to an error:
sentry_sdk.add_breadcrumb(
message="User clicked checkout button",
category="ui.click",
level="info"
)Add metadata for filtering in the dashboard:
sentry_sdk.set_tag("feature", "checkout")
sentry_sdk.set_extra("cart_items", 3)
sentry_sdk.set_context("order", {"total": 99.99})Capture handled exceptions:
try:
risky_operation()
except Exception as e:
sentry_sdk.capture_exception(e)Track transactions for performance insights:
with sentry_sdk.start_transaction(name="process_order", op="task"):
with sentry_sdk.start_span(op="db.query"):
fetch_order()
with sentry_sdk.start_span(op="http.client"):
call_payment_api()Installation:
pip install sentry-sdkFramework Integrations:
- Flask:
sentry_sdk.integrations.flask.FlaskIntegration - Django:
sentry_sdk.integrations.django.DjangoIntegration - FastAPI:
sentry_sdk.integrations.starlette.StarletteIntegration
Example:
import sentry_sdk
sentry_sdk.init(
dsn="https://key@errors.observability.app.bauer-group.com/1",
environment="production",
release="my-app@1.0.0",
traces_sample_rate=0.1,
send_default_pii=False,
)📁 Full Example: python_example.py
Installation:
npm install @sentry/node @sentry/profiling-nodeFramework Integrations:
- Express: Built-in middleware
- Koa:
@sentry/koa - NestJS:
@sentry/nestjs
Example:
const Sentry = require("@sentry/node");
Sentry.init({
dsn: "https://key@errors.observability.app.bauer-group.com/1",
environment: "production",
release: "my-app@1.0.0",
tracesSampleRate: 0.1,
});📁 Full Example: nodejs_example.js
Installation:
npm install @sentry/node @sentry/profiling-node
npm install -D typescript @types/nodeExample:
import * as Sentry from "@sentry/node";
Sentry.init({
dsn: "https://key@errors.observability.app.bauer-group.com/1",
environment: "production",
release: "my-app@1.0.0",
tracesSampleRate: 0.1,
});📁 Full Example: typescript_example.ts
Maven:
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>7.0.0</version>
</dependency>Gradle:
implementation 'io.sentry:sentry:7.0.0'Framework Integrations:
- Spring Boot:
sentry-spring-boot-starter-jakarta - Log4j2:
sentry-log4j2 - Logback:
sentry-logback
Example:
import io.sentry.Sentry;
Sentry.init(options -> {
options.setDsn("https://key@errors.observability.app.bauer-group.com/1");
options.setEnvironment("production");
options.setRelease("my-app@1.0.0");
options.setTracesSampleRate(0.1);
});📁 Full Example: JavaExample.java
NuGet:
dotnet add package Sentry
dotnet add package Sentry.AspNetCore # For ASP.NET CoreASP.NET Core:
// Program.cs
builder.WebHost.UseSentry(options => {
options.Dsn = "https://key@errors.observability.app.bauer-group.com/1";
options.Environment = "production";
options.Release = "my-app@1.0.0";
options.TracesSampleRate = 0.1;
});Console App:
using Sentry;
SentrySdk.Init(options => {
options.Dsn = "https://key@errors.observability.app.bauer-group.com/1";
options.Environment = "production";
options.Release = "my-app@1.0.0";
});📁 Full Example: DotNetExample.cs
Installation:
go get github.com/getsentry/sentry-goExample:
import "github.com/getsentry/sentry-go"
err := sentry.Init(sentry.ClientOptions{
Dsn: "https://key@errors.observability.app.bauer-group.com/1",
Environment: "production",
Release: "my-app@1.0.0",
TracesSampleRate: 0.1,
})📁 Full Example: go_example.go
Composer:
composer require sentry/sentryFramework Integrations:
- Laravel:
sentry/sentry-laravel - Symfony:
sentry/sentry-symfony
Example:
\Sentry\init([
'dsn' => 'https://key@errors.observability.app.bauer-group.com/1',
'environment' => 'production',
'release' => 'my-app@1.0.0',
'traces_sample_rate' => 0.1,
]);📁 Full Example: php_example.php
Gemfile:
gem 'sentry-ruby'
gem 'sentry-rails' # For Rails applicationsExample:
Sentry.init do |config|
config.dsn = 'https://key@errors.observability.app.bauer-group.com/1'
config.environment = 'production'
config.release = 'my-app@1.0.0'
config.traces_sample_rate = 0.1
end📁 Full Example: ruby_example.rb
Cargo.toml:
[dependencies]
sentry = "0.32"Example:
let _guard = sentry::init((
"https://key@errors.observability.app.bauer-group.com/1",
sentry::ClientOptions {
release: Some("my-app@1.0.0".into()),
environment: Some("production".into()),
traces_sample_rate: 0.1,
..Default::default()
},
));📁 Full Example: rust_example.rs
CMake (FetchContent):
include(FetchContent)
FetchContent_Declare(
sentry
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
GIT_TAG 0.7.0
)
FetchContent_MakeAvailable(sentry)Example:
#include <sentry.h>
sentry_options_t* options = sentry_options_new();
sentry_options_set_dsn(options, "https://key@errors.observability.app.bauer-group.com/1");
sentry_options_set_environment(options, "production");
sentry_options_set_release(options, "my-app@1.0.0");
sentry_init(options);📁 Full Example: cpp_example.cpp
Always use environment variables for sensitive configuration:
export SENTRY_DSN="https://key@hostname/1"
export ENVIRONMENT="production"
export APP_VERSION="1.0.0"Adjust sample rates for production to control costs and performance:
| Environment | Error Sample Rate | Traces Sample Rate |
|---|---|---|
| Development | 1.0 (100%) | 1.0 (100%) |
| Staging | 1.0 (100%) | 0.5 (50%) |
| Production | 1.0 (100%) | 0.1 (10%) |
Always sanitize sensitive data before sending:
def before_send(event, hint):
# Remove sensitive headers
if event.get("request", {}).get("headers"):
for header in ["Authorization", "Cookie"]:
if header in event["request"]["headers"]:
event["request"]["headers"][header] = "[REDACTED]"
return event
sentry_sdk.init(before_send=before_send)Name transactions consistently:
- HTTP endpoints: Use the route pattern (e.g.,
GET /api/users/:id) - Background jobs: Use the job name (e.g.,
ProcessOrderJob) - Tasks: Use a descriptive name (e.g.,
generate_monthly_report)
Always set the release version to track errors across deployments:
sentry_sdk.init(release="my-app@1.2.3")- Check DSN: Verify the DSN is correct and accessible
- Check Sample Rate: Ensure
sample_rateis > 0 - Flush Events: Call
flush()before application exit - Check Network: Verify the application can reach the Bugsink server
Enable debug mode to see SDK logs:
sentry_sdk.init(debug=True)| Issue | Solution |
|---|---|
| SSL Certificate Error | Add server's CA to trusted certificates |
| Connection Timeout | Check firewall rules and network connectivity |
| Events Dropped | Increase max_queue_size or reduce sample rate |
| Missing Stack Traces | Enable attach_stacktrace=True |
Generated for Error Observability Platform