Migrate from Sentry

Step-by-step guide to migrate from Sentry to JustAnalytics for error tracking, tracing, and performance monitoring.

Overview#

JustAnalytics provides a complete replacement for Sentry's error tracking, performance monitoring, and session replay features. This guide walks you through migrating from @sentry/node, @sentry/browser, or sentry_sdk to JustAnalytics.

The fastest way to migrate is using the JustAnalytics CLI:

npx @justanalyticsapp/cli migrate from-sentry

This command will:

  1. Scan your codebase for Sentry SDK usage
  2. Show a diff preview of all proposed changes
  3. Apply changes with your confirmation
  4. Run a verification check

For CI/CD pipelines, use --json for machine-readable output:

npx @justanalyticsapp/cli migrate from-sentry --json

Manual Migration#

Step 1: Replace Dependencies#

JavaScript / TypeScript:

# Remove Sentry packages
npm uninstall @sentry/node @sentry/browser @sentry/nextjs @sentry/react

# Install JustAnalytics
npm install @justanalyticsapp/node

Python:

pip uninstall sentry-sdk
pip install justanalytics

Step 2: Replace Initialization#

Before (Sentry):

import * as Sentry from '@sentry/node';

Sentry.init({
  dsn: 'https://abc123@sentry.io/456',
  environment: 'production',
  release: 'v1.2.3',
  tracesSampleRate: 1.0,
  sampleRate: 1.0,
  debug: false,
});

After (JustAnalytics):

import * as JustAnalytics from '@justanalyticsapp/node';

JustAnalytics.init({
  apiKey: process.env.JUSTANALYTICS_API_KEY,
  environment: 'production',
  release: 'v1.2.3',
  traceSampleRate: 1.0,
  errorSampleRate: 1.0,
  debug: false,
});

Step 3: Replace API Calls#

| Sentry API | JustAnalytics Equivalent | |---|---| | Sentry.captureException(error) | JustAnalytics.captureError(error) | | Sentry.captureMessage(msg) | JustAnalytics.captureMessage(msg) | | Sentry.setUser({ id, email }) | JustAnalytics.setUser({ id, email }) | | Sentry.setTag(key, value) | JustAnalytics.setTag(key, value) | | Sentry.setExtra(key, value) | JustAnalytics.setAttribute(key, value) | | Sentry.addBreadcrumb(crumb) | JustAnalytics.addBreadcrumb(crumb) | | Sentry.startTransaction(ctx) | JustAnalytics.startSpan(ctx) | | Sentry.configureScope(cb) | JustAnalytics.configureScope(cb) | | Sentry.withScope(cb) | JustAnalytics.withScope(cb) |

Step 4: Configuration Mapping#

| Sentry Option | JustAnalytics Option | Notes | |---|---|---| | dsn | apiKey | Replace DSN with JustAnalytics API key | | environment | environment | Direct mapping | | release | release | Direct mapping | | tracesSampleRate | traceSampleRate | Same range (0.0-1.0) | | sampleRate | errorSampleRate | Same range (0.0-1.0) | | debug | debug | Direct mapping | | beforeSend | beforeSend | Compatible callback signature | | tracesSampler | traceSampler | Compatible callback signature | | integrations | integrations | Replaced by JA auto-instrumentation | | maxBreadcrumbs | removed | JA captures all context automatically | | attachStacktrace | removed | JA always captures stack traces |

Step 5: Framework-Specific Changes#

Next.js

Before (Sentry):

// next.config.js
const { withSentryConfig } = require('@sentry/nextjs');

module.exports = withSentryConfig(nextConfig, {
  org: 'my-org',
  project: 'my-project',
});

After (JustAnalytics):

// instrumentation.ts
import * as JustAnalytics from '@justanalyticsapp/node';

JustAnalytics.init({
  apiKey: process.env.JUSTANALYTICS_API_KEY,
  integrations: ['nextjs'],
});

No wrapper around next.config.js is needed. JustAnalytics uses the standard Next.js instrumentation.ts hook.

Express

Before (Sentry):

import * as Sentry from '@sentry/node';

Sentry.init({ dsn: '...' });
app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.errorHandler());

After (JustAnalytics):

import * as JustAnalytics from '@justanalyticsapp/node';

JustAnalytics.init({ apiKey: process.env.JUSTANALYTICS_API_KEY });
// Auto-instrumentation handles Express middleware automatically

Verify Migration#

After completing the migration, run the doctor command:

npx @justanalyticsapp/cli doctor

This will verify:

  • JA SDK is installed correctly
  • API key is configured
  • Connectivity to the JA ingestion endpoints works
  • No leftover Sentry packages

Feature Comparison#

| Feature | Sentry | JustAnalytics | |---|---|---| | Error tracking | Yes | Yes | | Stack traces | Yes | Yes | | Source map deobfuscation | Yes | Yes | | Performance monitoring | Yes | Yes | | Distributed tracing | Yes | Yes | | Session replay | Yes | Yes | | Web Vitals | Yes | Yes | | Log aggregation | No | Yes | | Infrastructure metrics | No | Yes | | Uptime monitoring | No | Yes | | Web analytics | No | Yes | | Self-hosted option | Yes (complex) | Yes (single Railway deploy) |