Beginner 30 minutes

Migrate from Sentry to TraceKit

Sentry started as error tracking and added performance monitoring later. TraceKit is traces-first with error recording built in -- get both in a single SDK without the bolt-on feel.

Start Free
1

Replace Sentry SDK with TraceKit SDK

Remove the Sentry SDK package and install TraceKit. Sentry uses a DSN (Data Source Name) for authentication; TraceKit uses an API key.

CategorySentryTraceKitNotes
Package@sentry/node (npm)@tracekit/node-apm (npm)Node.js SDK replacement
Packagesentry-sdk (pip)tracekit-apm (pip)Python SDK replacement
Packagesentry/sentry-gogithub.com/tracekit/go-sdkGo SDK replacement
2

Map Sentry DSN and Init Options

Replace Sentry's DSN-based initialization with TraceKit's API key initialization. Sentry's tracesSampleRate becomes TraceKit's sample rate.

CategorySentryTraceKitNotes
AuthenticationSENTRY_DSN (https://[email protected]/id)TRACEKIT_API_KEYAPI key replaces DSN URL
SamplingtracesSampleRate (0.0-1.0)TRACEKIT_SAMPLE_RATE (0.0-1.0)Same numeric range, direct mapping
Environmentenvironment option in Sentry.init()TRACEKIT_ENVIRONMENTEnvironment tagging
Releaserelease option in Sentry.init()TRACEKIT_VERSIONRelease/version tracking
3

Migrate Error Tracking Calls

Replace Sentry's captureException and captureMessage with TraceKit's span-level error recording. In Sentry, errors are top-level events; in TraceKit, errors are attached to the span where they occurred for better trace correlation.

CategorySentryTraceKitNotes
Error CaptureSentry.captureException(error)span.RecordError(err)Errors attached to active span for trace correlation
Error CaptureSentry.captureMessage(msg)span.AddEvent(msg)Messages become span events
BreadcrumbsSentry.addBreadcrumb({message, category})span.AddEvent(message, {category: cat})Breadcrumbs map to span events with attributes
ContextSentry.setTag(key, value)span.SetAttribute(key, value)Tags become span attributes
4

Replace Performance Monitoring Transactions

Sentry's performance monitoring uses transactions and spans. TraceKit uses spans throughout -- a root span is equivalent to a Sentry transaction.

CategorySentryTraceKitNotes
TransactionsSentry.startTransaction({name, op})tracekit.StartSpan(ctx, name)Transactions become root spans
Child Spanstransaction.startChild({op, description})tracekit.StartSpan(ctx, name)Context propagation links parent-child automatically
Finishtransaction.finish()span.End()Same concept, different method name
5

Verify Error and Trace Capture

Trigger a test error and some API requests, then verify both error recording and trace capture in the TraceKit dashboard. TraceKit shows errors inline within the trace waterfall.

CategorySentryTraceKitNotes
VerificationSentry > IssuesTraceKit Dashboard > Traces (filter by error)Errors appear as span events in traces
VerificationSentry > Performance > TransactionsTraceKit Dashboard > TracesTransactions map to trace roots
VerificationSentry > Performance > Web VitalsTraceKit Frontend DashboardWeb vitals via browser SDK

Code Examples

Before (Sentry)

import "github.com/getsentry/sentry-go"

func main() {
    sentry.Init(sentry.ClientOptions{
        Dsn:              "https://[email protected]/123",
        TracesSampleRate: 1.0,
        Environment:      "production",
    })
    defer sentry.Flush(2 * time.Second)

    span := sentry.StartSpan(context.Background(), "process.order")
    defer span.Finish()
    sentry.CaptureException(fmt.Errorf("out of stock"))
}

After (TraceKit)

import "github.com/tracekit/go-sdk/tracekit"

func main() {
    tracekit.Init("tk_your_api_key",
        tracekit.WithService("order-service"),
        tracekit.WithEnvironment("production"),
    )
    defer tracekit.Shutdown(context.Background())

    ctx, span := tracekit.StartSpan(context.Background(), "process.order")
    defer span.End()
    span.RecordError(fmt.Errorf("out of stock"))
}

Before (Sentry)

const Sentry = require('@sentry/node');

Sentry.init({
  dsn: 'https://[email protected]/123',
  tracesSampleRate: 1.0,
  environment: 'production',
});

const transaction = Sentry.startTransaction({
  name: 'process-order',
  op: 'http.server',
});
try {
  // ... business logic
} catch (err) {
  Sentry.captureException(err);
} finally {
  transaction.finish();
}

After (TraceKit)

const tracekit = require('@tracekit/node-apm');

tracekit.init({
  apiKey: 'tk_your_api_key',
  service: 'order-service',
  environment: 'production',
});

const span = tracekit.startSpan('process-order');
try {
  // ... business logic
} catch (err) {
  span.recordError(err);
} finally {
  span.end();
}

Before (Sentry)

import sentry_sdk

sentry_sdk.init(
    dsn="https://[email protected]/123",
    traces_sample_rate=1.0,
    environment="production",
)

with sentry_sdk.start_transaction(name="process-order", op="task"):
    try:
        # ... business logic
        pass
    except Exception as e:
        sentry_sdk.capture_exception(e)

After (TraceKit)

import tracekit

tracekit.init(
    api_key='tk_your_api_key',
    service='order-service',
    environment='production',
)

with tracekit.start_span('process-order') as span:
    try:
        # ... business logic
        pass
    except Exception as e:
        span.record_error(e)

Ready to migrate?

Start your free TraceKit account and follow this guide to migrate from Sentry in 30 minutes.

Start Free Migration