| name | sentry-desktop-setup |
| description | Configure Sentry for comprehensive desktop application crash reporting, error monitoring, performance tracking, and release health for Electron and native desktop apps |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
| tags | ["desktop","monitoring","crash-reporting","sentry","electron","observability"] |
| graph | {"domains":["domain:software-engineering"],"specializations":["specialization:desktop-development"],"skillAreas":["skill-area:observability-instrumentation","skill-area:cross-platform-desktop"],"roles":["role:desktop-developer","role:fullstack-engineer"],"workflows":["workflow:feature-development","workflow:release-management"]} |
sentry-desktop-setup
Configure Sentry for comprehensive desktop application monitoring including crash reporting, error tracking, performance monitoring, and release health. This skill sets up Sentry SDK integration for Electron and native desktop applications with source maps, session tracking, and custom instrumentation.
Capabilities
- Configure Sentry SDK for Electron (main + renderer processes)
- Set up native crash reporting with minidump support
- Configure source map uploads for readable stack traces
- Implement performance monitoring and tracing
- Set up release tracking with commit integration
- Configure session tracking for release health
- Implement custom error boundaries and handlers
- Set up user feedback collection
- Configure environment-specific DSNs and sampling
Input Schema
{
"type": "object",
"properties": {
"projectPath": {
"type": "string",
"description": "Path to the desktop application project"
},
"framework": {
"enum": ["electron", "tauri", "qt", "wpf", "macos-native"],
"default": "electron"
},
"sentryConfig": {
"type": "object",
"properties": {
"dsn": { "type": "string"
Output Schema
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"type": { "enum": ["config", "main", "renderer", "utils", "ci"] }
}
Generated File Structure
src/
main/
sentry/
sentry-main.ts # Main process Sentry init
crash-reporter.ts # Native crash handling
ipc-handlers.ts # Sentry IPC handlers
renderer/
sentry/
sentry-renderer.ts # Renderer Sentry init
error-boundary.tsx # React error boundary
user-feedback.ts # Feedback dialog
shared/
sentry-config.ts # Shared configuration
context-utils.ts # Context helpers
scripts/
sentry-release.js # Release script
.github/workflows/
sentry-release.yml # CI workflow
Code Templates
Main Process Sentry Configuration
import * as Sentry from '@sentry/electron/main';
import { app } from 'electron';
export function initSentryMain() {
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV || 'production',
release: `${app.getName()}@${app.getVersion()}`,
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
profilesSampleRate: 0.1,
autoSessionTracking: true,
enableNative: true,
beforeSend(event) {
if (event.user) {
delete event.user.ip_address;
}
return event;
},
: [
.(),
.(),
],
});
.(, {
: app.(),
: app.(),
: process.,
: process.,
: process..,
});
}
() {
.( {
scope.(, );
(context) {
scope.(context);
}
.(error);
});
}
Renderer Process Sentry Configuration
import * as Sentry from '@sentry/electron/renderer';
import { init as sentryReactInit, browserTracingIntegration } from '@sentry/react';
export function initSentryRenderer() {
sentryReactInit({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV || 'production',
release: window.electronAPI.getAppVersion(),
tracesSampleRate: 0.1,
integrations: [
browserTracingIntegration(),
Sentry.electronRendererIntegration(),
],
beforeBreadcrumb(breadcrumb) {
if (breadcrumb.category === 'console' && breadcrumb.level === 'debug') {
return null;
}
return breadcrumb;
},
});
Sentry.(, );
}
withSentryErrorBoundary<P >(
: .<P>,
: .
) {
.(, {
fallback,
: ,
});
}
React Error Boundary
import React from 'react';
import * as Sentry from '@sentry/react';
interface Props {
children: React.ReactNode;
fallback?: React.ReactNode;
}
interface State {
hasError: boolean;
eventId: string | null;
}
export class ErrorBoundary extends React.Component<Props, State> {
state: State = { hasError: false, eventId: null };
static getDerivedStateFromError(): State {
return { hasError: true, eventId: null };
}
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
Sentry.( {
scope.({
: errorInfo.,
});
eventId = .(error);
.({ eventId });
});
}
handleReportClick = {
(..) {
.({ : .. });
}
};
handleReload = {
..();
};
() {
(..) {
(
.. || (
)
);
}
..;
}
}
User Feedback Collection
import * as Sentry from '@sentry/react';
export interface FeedbackData {
name: string;
email: string;
comments: string;
}
export async function submitUserFeedback(
eventId: string,
feedback: FeedbackData
) {
await Sentry.sendFeedback({
event_id: eventId,
name: feedback.name,
email: feedback.email,
message: feedback.comments,
});
}
export function showFeedbackDialog(eventId?: string) {
Sentry.showReportDialog({
eventId,
title: 'Help us improve',
subtitle: 'Tell us what happened',
subtitle2: 'Your feedback helps us fix issues faster',
labelSubmit: 'Send Report',
labelClose: 'Close',
});
}
() {
.(message, {
: ,
: { category, : },
: metadata,
});
}
Performance Monitoring
import * as Sentry from '@sentry/electron/renderer';
export function measureAppStartup() {
const transaction = Sentry.startTransaction({
name: 'app-startup',
op: 'app.startup',
});
return {
finish: () => transaction.finish(),
setMeasurement: (name: string, value: number, unit: string) => {
transaction.setMeasurement(name, value, unit as any);
},
};
}
export async function measureOperation<T>(
name: string,
operation: () => Promise<T>
): Promise<T> {
const span = Sentry.startSpan({
name,
op: 'function',
}, async (span) => {
try {
();
} {
span?.();
}
});
span;
}
() {
.(name, value, unit);
}
Release Script
const { execSync } = require('child_process');
const pkg = require('../package.json');
const release = `${pkg.name}@${pkg.version}`;
const org = process.env.SENTRY_ORG;
const project = process.env.SENTRY_PROJECT;
console.log(`Creating Sentry release: ${release}`);
execSync(`sentry-cli releases new ${release} --org ${org} --project ${project}`);
execSync(`sentry-cli releases set-commits ${release} --auto --org ${org}`);
execSync(`sentry-cli releases files ${release} upload-sourcemaps ./dist --org ${org} --project ${project}`);
if (process.platform === 'darwin' || process.platform === 'win32') {
execSync(`sentry-cli upload-dif ./dist --org ${org} --project ${project}`);
}
();
environment = process.. || ;
();
.();
GitHub Actions Workflow
name: Sentry Release
on:
release:
types: [published]
jobs:
sentry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Create Sentry release
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
Environment Variables
| Variable | Description | Required |
|---|
SENTRY_DSN | Sentry Data Source Name | Yes |
SENTRY_AUTH_TOKEN | Authentication token for CLI | For releases |
SENTRY_ORG | Sentry organization slug | For releases |
SENTRY_PROJECT | Sentry project slug | For releases |
Best Practices
- Use environment-specific DSNs - Different projects for dev/staging/prod
- Enable source maps - Critical for readable stack traces
- Set meaningful release names - Include version and build number
- Configure sampling appropriately - Balance data with cost
- Scrub sensitive data - Remove PII before sending
- Track release health - Monitor crash-free sessions
Community References
Related Skills
electron-builder-config - Build configuration
electron-auto-updater-setup - Track update issues
gdpr-consent-manager - Privacy compliance
Related Agents
desktop-test-architect - Testing strategy
release-manager - Release coordination