Provenance
Error Tracking

Setup

Enable error tracking on your origins and configure SDK auto-instrumentation

Setup

1. Enable Error Tracking on an Origin

In the Provenance UI, navigate to Origins → select your origin → Config tab → Error Tracking section:

  • Enabled — toggle error tracking on
  • Fingerprintingstack (default), message, or custom
  • Environment — e.g. production, staging
  • Default Resource Type — defaults to system ERROR type
  • Default Action — defaults to UNHANDLED

2. SDK Installation

npm install @stdiolabs/provenance-sdk
npm install @stdiolabs/provenance-sdk-typescript
pip install provenance-sdk
<dependency>
  <groupId>dev.provenance</groupId>
  <artifactId>provenance-sdk</artifactId>
  <version>1.0.0</version>
</dependency>

3. Manual Error Capture

import { create } from '@stdiolabs/provenance-sdk';

const provenance = await create({
  apiKey: 'your-api-key',
  origin: 'your-origin-mnemonic',
});

try {
  riskyOperation();
} catch (err) {
  provenance.captureException(err, {
    tags: { module: 'payments' },
    breadcrumbs: [{ message: 'User clicked checkout' }],
  });
}
import { create } from '@stdiolabs/provenance-sdk-typescript';

const provenance = await create({
  apiKey: 'your-api-key',
  origin: 'your-origin-mnemonic',
});

try {
  riskyOperation();
} catch (err) {
  provenance.captureException(err, {
    tags: { component: 'PaymentForm' },
    breadcrumbs: [{ message: 'User clicked checkout' }],
  });
}
from provenance_sdk import create

provenance = await create(api_key="your-api-key", origin="your-origin")

try:
    risky_operation()
except Exception as e:
    provenance.capture_exception(e, tags={"module": "payments"})
ProvenanceClient provenance = ProvenanceClient.create(
    "your-api-key", "your-origin"
);

try {
    riskyOperation();
} catch (Exception e) {
    provenance.captureException(e, CaptureContext.builder()
        .tag("module", "payments")
        .build());
}

4. Auto-Instrumentation

Auto-instrumentation captures errors automatically without manual try/catch blocks.

import { instrument } from '@stdiolabs/provenance-sdk/auto';

// Captures: uncaughtException, unhandledRejection,
// Express 5xx errors, and console.error (opt-in)
instrument(provenance);
import { provideProvenanceErrorHandler } from
  '@stdiolabs/provenance-sdk-typescript/angular';

bootstrapApplication(AppComponent, {
  providers: [provideProvenanceErrorHandler(provenance)],
});
from provenance_sdk.middleware import ProvenanceErrorMiddleware

app.add_middleware(ProvenanceErrorMiddleware, client=provenance)
MIDDLEWARE = [
    'provenance_sdk.middleware.ProvenanceErrorMiddleware',
    # ... other middleware
]
@EnableProvenanceErrorTracking
@SpringBootApplication
public class MyApp { }

What Gets Captured

Error TypeActionAuto-Instrumented
Uncaught exceptionsUNHANDLED
Unhandled promise rejectionsREJECTION
HTTP 5xx responsesHTTP_ERROR
Manual captureException()CAUGHT (or custom)Manual
console.error (opt-in)CAUGHTOptional

Capture Context

All SDKs accept an optional context object when capturing errors:

FieldDescription
tagsKey-value pairs for filtering (e.g. { module: 'payments' })
breadcrumbsTrail of user actions leading to the error
fingerprintCustom fingerprint to override automatic grouping
environmentOverride the origin's default environment
releaseOverride the origin's current release version
userContextUser info (id, email, username)
parentSpanIdLink to a parent trace span