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
- Fingerprinting —
stack(default),message, orcustom - Environment — e.g.
production,staging - Default Resource Type — defaults to system
ERRORtype - Default Action — defaults to
UNHANDLED
2. SDK Installation
npm install @stdiolabs/provenance-sdknpm install @stdiolabs/provenance-sdk-typescriptpip 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 Type | Action | Auto-Instrumented |
|---|---|---|
| Uncaught exceptions | UNHANDLED | ✅ |
| Unhandled promise rejections | REJECTION | ✅ |
| HTTP 5xx responses | HTTP_ERROR | ✅ |
Manual captureException() | CAUGHT (or custom) | Manual |
console.error (opt-in) | CAUGHT | Optional |
Capture Context
All SDKs accept an optional context object when capturing errors:
| Field | Description |
|---|---|
tags | Key-value pairs for filtering (e.g. { module: 'payments' }) |
breadcrumbs | Trail of user actions leading to the error |
fingerprint | Custom fingerprint to override automatic grouping |
environment | Override the origin's default environment |
release | Override the origin's current release version |
userContext | User info (id, email, username) |
parentSpanId | Link to a parent trace span |