Full Configuration โ Collect Everything
This document is the single reference for enabling every telemetry signal Sentrinel can collect. It covers the backend plugin (Elysia, Express, Next.js, Bun) and the Flutter SDK side by side, with every option explained and every data type mapped to the dashboard page that displays it.
If you want "just works, show me everything" โ copy the first config block for each side and you are done. The rest of the document explains what each option does and why it exists.
Django
The Django package reads one settings dict. Every value also reads from the environment, so a container is configured without editing settings:
SENTRINEL = {
"SERVER_URL": "https://api.sentrinel.dev", # SENTRINEL_SERVER_URL
"APP_NAME": "orders", # SENTRINEL_APP_NAME
"ENV": "prod", # SENTRINEL_ENV
"API_KEY": os.environ["SENTRINEL_API_KEY"], # SENTRINEL_API_KEY
"SAMPLE_RATE": 1.0, # errors are never sampled away
"EXCLUDE_PATHS": [r"^/health"],
"LOG_REQUEST_BODY": False, # off by default
"CONSUMER_IDENTIFIER": "myapp.telemetry.consumer_for",
"TRUST_CLIENT_CONSUMER": False, # True takes any x-sentrinel-consumer, not only guest: ids
}
With no consumer from CONSUMER_IDENTIFIER or request.user, a request is
filed under the x-sentrinel-consumer header the phone and browser SDKs send โ
a guest: id only, unless TRUST_CLIENT_CONSUMER is on โ and their
x-sentrinel-device header becomes the device.id attribute. Every option:
DJANGO.md.
FastAPI
The FastAPI package is an ASGI middleware that takes the same settings as keyword arguments โ lower case, the same names โ and reads the same environment variables:
app.add_middleware(
SentrinelMiddleware,
server_url="https://api.sentrinel.dev", # SENTRINEL_SERVER_URL
app_name="orders", # SENTRINEL_APP_NAME
module="api", # SENTRINEL_MODULE
env="prod", # SENTRINEL_ENV
api_key=os.environ["SENTRINEL_API_KEY"], # SENTRINEL_API_KEY
sample_rate=1.0, # errors are never sampled away
exclude_paths=[r"^/health", r"^/docs"],
log_request_body=False, # off by default
consumer_identifier="x-tenant-id", # a header name, or a function of the request
trust_client_consumer=False, # True takes any x-sentrinel-consumer, not only guest: ids
)
The same fallback as Django: with no consumer from consumer_identifier or
the authenticated user, the x-sentrinel-consumer header is used (guest: ids
only, unless trust_client_consumer=True), and x-sentrinel-device becomes the
device.id attribute. A misspelt option is a TypeError at startup, not a
silent no-op. Every option: FASTAPI.md.
Postgres collector
/etc/sentrinel/collector-<instance>.env (collector-default.env for a single
database), edited with sentrinel-collector config set KEY=VALUE:
DATABASE_URL=postgres://sentrinel_monitor:โฆ@localhost:5432/orders
SENTRINEL_KEY=snt_db_โฆ
SENTRINEL_INSTANCE=orders-primary
# SENTRINEL_URL=https://api.sentrinel.dev # the default; set it for a self-hosted API
# SENTRINEL_MASK_QUERIES=false # literals are stripped unless this is false
# SENTRINEL_COLLECT_PLANS=true # plans run when the role can read tables
A key Sentrinel refuses stops the collector with a message rather than a retry loop, and an interval that is empty or not a positive whole number falls back to its default. Every setting: DATABASE.md.
Table of contents
- Backend config: Elysia
- Backend config: Express
- Backend config: Next.js
- Backend config: Bun native
- Flutter config (with Swift and Kotlin)
- Browser config
- OpenTelemetry without a plugin
- Backend environment variables
- What each signal captures
- Data masking
- Sampling safety
- Distributed tracing
- Structured logging deep dive
- What you see in the dashboard
- Troubleshooting
Backend config: Elysia
This enables every signal the backend plugin supports: request metrics, request logs with payloads, console log capture, structured logging, error tracking, distributed tracing, resource monitoring, consumer tracking, and deploy markers.
import { Elysia } from "elysia";
import { sentrinelPlugin } from "@sentrinel/plugin";
const app = new Elysia()
.use(sentrinelPlugin({
// โโ Core โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
serverUrl: "http://localhost:3001", // your Sentrinel API URL
appName: "my-api", // shown in dashboard
env: "prod", // "dev" | "staging" | "prod"
apiKey: process.env.SENTRINEL_API_KEY, // per-app ingest key
version: process.env.GIT_SHA, // deploy markers on charts
debug: false, // verbose plugin logging
// โโ Flush control โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
flushInterval: 30000, // ms between batch sends
// โโ Consumer tracking โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
consumerIdentifier: (ctx) =>
ctx.request.headers.get("x-consumer-id") ?? "unknown",
// โโ Path exclusion โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
excludePaths: ["/health", "/metrics", /^\/internal\//],
// โโ Request logging (raw request/response rows) โโโโโโโโโโโ
requestLogging: {
enabled: true, // turn on request log rows
sampleRate: 1.0, // 100% of fast successes
slowRequestThresholdMs: 500, // always capture slow ones
logRequestHeaders: true, // include request headers
logRequestBody: true, // include request body
logResponseBody: true, // include response body
maxBodySize: 65536, // 64KB โ the most ever read
// Credentials are masked with no configuration (see Data masking).
// These ADD to the built-in list; they never replace it.
maskHeaders: [/^x-tenant-secret$/i],
maskQueryParams: ["invite"],
maskBodyFields: [/^iban$/i],
},
// โโ Console log capture โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
logCapture: {
enabled: true, // capture console.* output
minLevel: "debug", // "debug" = capture everything
maxPerRequest: 100, // cap per request
maxMessageLength: 2000, // truncate long messages
},
// โโ Structured logging โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
logging: {
minLevel: "debug", // drop nothing before buffering
echo: true, // mirror to stdout in dev
},
}))
.get("/", () => "hello")
.listen(3000);
What each option does
| Option | What it controls | Why it matters |
|---|---|---|
serverUrl |
Where telemetry is sent | Must point to the API, not the dashboard |
appName |
Groups all data for this service | Must match the API key's app |
env |
Scopes to an environment | Staging key cannot write to prod |
apiKey |
Authenticates ingestion and decides the app | Required โ ingest keys are on unless SENTRINEL_REQUIRE_INGEST_KEY=false on a development instance |
version |
Deploy markers | Charts get vertical lines at deploy time |
flushInterval |
How often batches are sent | Lower = more realtime, higher = less network |
consumerIdentifier |
Identifies the API client | Powers the Consumers dashboard page |
excludePaths |
Ignores noisy endpoints | Health checks, metrics scrapes, internal routes |
requestLogging.enabled |
Writes request log rows | Required for Request Logs, Apdex, payloads |
requestLogging.sampleRate |
Fraction of fast successes kept | 0.1 = 10%, errors/slow always kept |
requestLogging.slowRequestThresholdMs |
Always-capture threshold | Requests above this are never sampled out |
requestLogging.logRequestHeaders |
Includes headers in logs | Shows in the Headers tab |
requestLogging.logRequestBody |
Includes request body | Shows in the Payloads tab. Read before your handler, from a clone โ a route that verifies a raw signature still sees its own bytes |
requestLogging.logResponseBody |
Includes response body | Shows in the Payloads tab |
requestLogging.maxBodySize |
The most of a body ever read | Only this many bytes are read โ the rest of the stream is never buffered. Files, media and streams are skipped |
requestLogging.maskHeaders |
Extra headers to redact | Added to a built-in list (Authorization, Cookie, X-API-Key, โฆ) that always applies |
requestLogging.maskQueryParams |
Extra query params to redact | Added to a built-in list (token, code, key, signature, โฆ) |
requestLogging.maskBodyFields |
Extra body fields to redact | Added to a built-in list (password, token, secret, card number, cvv, โฆ); JSON, form and multipart |
logCapture.enabled |
Captures console.* output | Correlates logs to the request that produced them |
logCapture.minLevel |
Minimum level to capture | "debug" = everything, "warn" = warnings+ |
logCapture.maxPerRequest |
Per-request log cap | Prevents hot loops from flooding the buffer |
logCapture.maxMessageLength |
Truncates long messages | Keeps storage bounded |
logging.minLevel |
Drops records before buffering | "debug" = nothing dropped |
logging.echo |
Mirrors to stdout | Useful in dev, off in prod |
When a request shows no payload
An empty Payloads tab on a write request is usually correct. Two cases produce one, and they are worth telling apart before assuming capture is broken:
- The request carried no body.
DELETE /customers/:idand action routes likePOST /workorders/:id/startput everything in the URL. CheckrequestSizeon the row โ0means there was nothing to record. - The body was exactly
{}. An empty object is dropped as noise. Clients that sendJSON.stringify(body ?? {})therefore look identical to clients that send nothing at all.
Anything else with a non-zero requestSize and no recorded body is a bug worth
reporting.
Backend config: Express
import express from "express";
import { sentrinelExpressMiddleware, sentrinelErrorHandler } from "@sentrinel/plugin/express";
const app = express();
app.use(express.json());
app.use(sentrinelExpressMiddleware({
serverUrl: "http://localhost:3001",
appName: "my-express-api",
env: "prod",
apiKey: process.env.SENTRINEL_API_KEY,
version: process.env.GIT_SHA,
consumerIdentifier: "x-consumer-id", // header name (string)
excludePaths: ["/health", "/metrics"],
requestLogging: {
enabled: true,
sampleRate: 1.0,
slowRequestThresholdMs: 500,
logRequestHeaders: true,
logRequestBody: true,
logResponseBody: true,
maxBodySize: 65536,
},
logCapture: {
enabled: true,
minLevel: "debug",
maxPerRequest: 100,
},
logging: {
minLevel: "debug",
echo: false,
},
}));
app.get("/users", (req, res) => {
res.json(getUsers());
});
// After your routes, before any error handler of your own.
app.use(sentrinelErrorHandler());
app.listen(3000);
Mount the middleware before your routes so it sees every request, and
sentrinelErrorHandler() after them. Express hands a thrown error only to
four-argument error middleware โ never to the next an ordinary middleware was
given โ so this is the one place the plugin can receive the Error with its
stack. Without it errors are still recorded, from their status, with no stack
trace. It records and calls next(err); it never responds. Put it before any
handler of yours that responds without calling next(err).
Routes are read on finish, after routing, so rows carry the pattern
(/api/orders/:id) including the router's mount path. Handlers run inside the
request's trace, so traceSpan() and getLogger() attach to it.
Backend config: Next.js
Recording happens inside each route, on the Node runtime. Configure once:
// lib/sentrinel.ts
import { createSentrinelNext } from "@sentrinel/plugin/next";
export const { withSentrinel } = createSentrinelNext({
serverUrl: process.env.SENTRINEL_URL!,
appName: "my-next-app",
env: process.env.VERCEL_ENV ?? "prod",
apiKey: process.env.SENTRINEL_API_KEY,
version: process.env.VERCEL_GIT_COMMIT_SHA,
requestLogging: {
enabled: true,
sampleRate: 1.0,
slowRequestThresholdMs: 500,
logRequestHeaders: true,
logRequestBody: true,
logResponseBody: true,
maxBodySize: 65536,
},
logCapture: {
enabled: true,
minLevel: "info",
maxPerRequest: 50,
},
logging: {
minLevel: "debug",
echo: false,
},
});
Then wrap route handlers โ App Router:
// app/api/orders/[id]/route.ts
import { withSentrinel } from "@/lib/sentrinel";
export const GET = withSentrinel(async (request: Request, { params }: { params: Promise<{ id: string }> }) => {
const { id } = await params;
return Response.json(await getOrder(id));
});
and Pages Router API routes, with the same function:
// pages/api/orders/[id].ts
import { withSentrinel } from "@/lib/sentrinel";
export default withSentrinel(async (req, res) => {
res.json(await getOrder(String(req.query.id)));
});
What the wrapper records, and why it is a wrapper:
- The real response. Status, duration, error with its stack, and the route
pattern (
/api/orders/[id], rebuilt fromparams; passwithSentrinel(handler, { route })for a route without params). A handler that throws is recorded as a 500 and the error is re-thrown for Next.redirect(),notFound(),forbidden()andunauthorized()are recorded with their status, never as errors. - Tracing. The handler runs inside the request's trace, so
traceSpan(),sentrinelFetch()andgetLogger()attach to it, and an incomingtraceparent(from the browser SDK) is continued. - Node runtime only. The collector needs
node:os,process.cpuUsageand AsyncLocalStorage. A route withexport const runtime = "edge"cannot be wrapped.
Middleware is not how to instrument Next. It runs on the Edge runtime before
the route, so it can see neither the status nor the duration. The old
sentrinelNextMiddleware returned new Response(null) for every matched request
โ which Next treats as the response, blanking every route under the matcher.
It is now a pass-through (x-middleware-next: 1) that records nothing, kept only
so existing middleware.ts files keep working; import it from
@sentrinel/plugin/next/middleware (Edge-safe) and plan to delete it.
createSentrinelNext shares one collector per configuration across every route
file and across next dev reloads. The one-shot form
withSentrinel(options, handler) exported from @sentrinel/plugin/next does the
same sharing.
Backend config: Bun native
For raw Bun.serve without Elysia:
import { sentrinelBunMiddleware } from "@sentrinel/plugin/bun";
Bun.serve({
port: 3000,
fetch: sentrinelBunMiddleware({
serverUrl: "http://localhost:3001",
appName: "my-bun-app",
env: "prod",
apiKey: process.env.SENTRINEL_API_KEY,
version: process.env.GIT_SHA,
consumerIdentifier: "x-consumer-id",
requestLogging: {
enabled: true,
sampleRate: 1.0,
slowRequestThresholdMs: 500,
logRequestHeaders: true,
logRequestBody: true,
logResponseBody: true,
},
logCapture: {
enabled: true,
minLevel: "debug",
},
logging: {
minLevel: "debug",
echo: false,
},
}, async (req) => {
return new Response("Hello");
}),
});
The handler runs inside the request's trace. A response body is read โ at most
maxBodySize, and never for streams or binary types โ only after the response
has been handed back, so logging never delays the client.
Flush on shutdown, crashes, and delivery (every Node adapter)
On by default, off under NODE_ENV=test:
sentrinelPlugin({
/* โฆ */
processHooks: { flushOnExit: true, captureErrors: true, timeoutMs: 3000 }, // or false
sendTimeoutMs: 10_000, // one POST, then it is retried
retry: { maxQueued: 100, maxQueuedBytes: 8 * 1024 * 1024, maxAttempts: 5 }, // per payload type
buffer: { maxRequestLogs: 10_000, maxAppLogs: 10_000, maxErrors: 5_000, maxTraces: 5_000 },
});
- SIGTERM / SIGINT /
beforeExitflush what is buffered, waiting at mosttimeoutMs, then the process does what it would have done: with no other handler the signal is re-raised; with your own handler, yours decides. uncaughtException/unhandledRejectionare reported, flushed, then printed and exited with code 1 โ Node's own behaviour โ unless your app registered its own handlers, which then decide.- Batches are cut to the ingest limits (5,000 requests or logs, 2,000 errors, 500 traces) and a batch the server still refuses as too large is halved and resent. Buffers are bounded; past a limit the oldest records are dropped and the count is logged once per flush. Each payload type has its own retry queue, so an outage full of request logs cannot evict metrics.
- If your app has its own shutdown handler that calls
process.exit(), callawait flushSentrinel()(from@sentrinel/plugin) first โprocess.exit()ends the process before anything asynchronous can finish.
Flutter config
The Flutter SDK captures HTTP requests, errors, crashes, release health
sessions, performance frames, product events, custom metrics and structured
logs. It sends traceparent to the backends you list, so their traces connect
to the tap that caused them.
Using SentrinelFlutter (recommended)
import 'package:flutter/material.dart';
import 'package:sentrinel_flutter/sentrinel_flutter.dart';
void main() => SentrinelFlutter.run(
options: SentrinelOptions(
serverUrl: 'https://api.sentrinel.dev',
appName: 'mobile-app', // the same app as your backend
module: 'mobile', // which part of the project this is
env: 'prod',
apiKey: const String.fromEnvironment('SENTRINEL_API_KEY'), // a Mobile key
release: '1.4.2', // critical for release health
tracePropagationTargets: ['api.example.com'], // your backends only
flushInterval: Duration(seconds: 30),
),
app: () => runApp(const MyApp()),
);
// In your root widget:
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
// Navigation tracking + breadcrumbs
navigatorObservers: [SentrinelNavigatorObserver()],
home: HomeScreen(),
);
}
}
Key rule: runApp goes inside the app callback. Async errors are only
caught within the zone โ calling runApp outside it silently misses most of
them.
SentrinelFlutter.run also: installs FlutterError.onError and
PlatformDispatcher.onError (chained, silent errors skipped), ends the
session and flushes when the app is backgrounded, reports phone vs tablet from
the screen, and tracks frames against the display's refresh rate. Calling it
again reconfigures without stacking handlers.
SentrinelOptions
| Option | Default | What it does |
|---|---|---|
serverUrl, appName, env, apiKey, module, release |
โ | As for the backend plugin. env must match the key. |
tracePropagationTargets |
[] |
Hosts ('api.example.com', '*.example.com', a URL prefix) or RegExps that receive traceparent, x-sentrinel-consumer and x-sentrinel-device. Nothing else does; on web, same-origin always does. |
beforeSend |
none | (kind, record) => record | null for request, error, log, span, event. Runs before a crash report touches disk. |
consumerIdentifier |
none | Pins the consumer. Usually leave it out and call identify. |
persistCrashes |
true |
Keep fatal errors and the session marker on disk. |
storagePath |
app support dir | Where the crash spool and install id live. |
httpClient |
plain client | Used for telemetry posts; never closed by Sentrinel. |
trackFrames, trackAppStart, trackLifecycle |
true |
Turn the automatic pieces off individually. |
flushInterval |
30 s | The batch timer. |
Using the core Dart package (non-Flutter)
import 'package:sentrinel/sentrinel.dart';
void main() => Sentrinel.guard(() {
Sentrinel.init(
serverUrl: 'https://api.sentrinel.dev',
appName: 'my-dart-app',
env: 'prod',
apiKey: const String.fromEnvironment('SENTRINEL_API_KEY'),
release: '1.4.2',
tracePropagationTargets: ['api.example.com'],
);
// ...
});
// HTTP client โ every request is recorded; traceparent goes to your targets
final client = Sentrinel.httpClient();
// Dio: through the Dio team's dio_compatibility_layer package
final dio = Dio()..httpClientAdapter = ConversionLayerAdapter(Sentrinel.httpClient());
In plain Dart, call Sentrinel.onBackground() / onForeground() yourself if
the process has a foreground, and Sentrinel.close() on exit.
What gets captured automatically
| Signal | How | What you see |
|---|---|---|
| HTTP requests | Sentrinel.httpClient() |
Method, route, host, status, latency, size |
| Unhandled errors | zone, FlutterError.onError, PlatformDispatcher.onError, isolates |
Issues; session errored |
| Crashes | captureError(โฆ, fatal: true) โ written to disk first |
Issues; session crashed |
| Release health | A session per foreground stretch, ended on background | Crash-free rate per release |
| Performance | Frame timing + app start | Slow/frozen frames, start-to-first-frame |
| Distributed tracing | traceparent to tracePropagationTargets |
Flutter โ backend in one trace |
| Identity | guest:<install id>, then identify(user.id) |
Consumers, Users |
| Device | os, osVersion, deviceType, deviceModel + User-Agent |
Users, segments |
| Breadcrumbs | HTTP + navigation auto, manual add | Last 25 events before an error |
URLs in span attributes and transport-error messages are sent without query string, fragment or userinfo.
Capturing errors manually
// Caught errors
try {
await api.submitPost(post);
} catch (e, stack) {
Sentrinel.captureError(e, stack, path: 'submit_post');
rethrow;
}
// The app is about to die โ written to disk before this returns
Sentrinel.captureError(e, stack, fatal: true);
Identity and context
// After sign-in, at launch when a saved session is restored, after profile
// updates. Requests, errors, logs and events are filed under the user.
Sentrinel.identify(user.id);
// Everything else you want on every record
Sentrinel.setContext({
'tier': user.subscriptionTier,
'locale': Localizations.localeOf(context).languageCode,
});
// On sign-out: back to guest:<install id>
Sentrinel.identify(null);
Sentrinel.clearContext();
// What dart:io cannot see โ feed it from device_info_plus
Sentrinel.setDeviceInfo(model: info.model, osVersion: info.version.release);
Adding breadcrumbs
Sentrinel.addBreadcrumb('tapped pay', category: 'ui', data: {'amount': 42});
Structured logs
Sentrinel.info('User signed in', category: 'auth', attributes: {
'method': 'google',
});
Sentrinel.warn('Cache miss', category: 'cache', attributes: {
'key': 'feed_v2',
});
Sentrinel.error('Payment failed', category: 'billing', attributes: {
'orderId': order.id,
'reason': 'insufficient_funds',
});
Backgrounding
Automatic with SentrinelFlutter: on hidden/paused/detached the session
ends with its duration and everything is flushed; back within 30 seconds it is
the same session. Without the Flutter package:
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
Sentrinel.onForeground();
} else if (state == AppLifecycleState.paused) {
Sentrinel.onBackground();
}
}
Full Flutter example
import 'package:flutter/material.dart';
import 'package:sentrinel_flutter/sentrinel_flutter.dart';
void main() => SentrinelFlutter.run(
options: SentrinelOptions(
serverUrl: 'https://api.sentrinel.dev',
appName: 'my-app',
env: 'prod',
apiKey: const String.fromEnvironment('SENTRINEL_API_KEY'),
release: '1.4.2',
tracePropagationTargets: ['api.example.com'],
),
app: () => runApp(const MyApp()),
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorObservers: [SentrinelNavigatorObserver()],
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () async {
final client = Sentrinel.httpClient();
final res = await client.get(
Uri.parse('https://api.example.com/posts'),
);
// Process response...
},
child: const Text('Load Posts'),
),
),
),
);
}
}
// Wherever sign-in completes:
// Sentrinel.identify(user.id);
Native iOS / macOS: Swift
Crashes (uncaught NSExceptions, fatal signals including Swift traps), handled errors and release health. No tracing, events or metrics.
// Package: https://github.com/Zaga-ltd/sentinel_packages.git, product "Sentrinel"
import Sentrinel
Sentrinel.start(options: .init(
serverUrl: URL(string: "https://api.sentrinel.dev")!,
appName: "my-app",
env: "prod",
apiKey: "<a Mobile key>",
module: "ios",
release: "1.4.2"
))
Sentrinel.identify(user.id) // nil on sign-out
Sentrinel.captureError(error, path: "checkout")
Sentrinel.addBreadcrumb("tapped pay", category: "ui")
// Your own backend only:
Sentrinel.identityHeaders.forEach { request.setValue($1, forHTTPHeaderField: $0) }
| Option | Default | What it does |
|---|---|---|
storagePath |
Application Support | Crash spool and install id; nil keeps everything in memory |
persistCrashes |
true |
Write crashes to disk before the process dies |
installCrashHandlers |
true |
NSException + signal handlers (chained to any existing ones) |
trackLifecycle |
true |
On iOS, end the session and flush on background |
consumerIdentifier |
none | Pins the consumer; prefer identify |
flush() is for backgrounding; close() is for termination only.
Native Android / JVM: Kotlin
Uncaught exceptions on any thread, handled errors and release health. No tracing, events, metrics, or native (JNI) crashes.
// implementation("com.github.Zaga-ltd.sentinel_packages:sentrinel_kotlin:main-SNAPSHOT") via JitPack
Sentrinel.start(
Sentrinel.Options(
serverUrl = "https://api.sentrinel.dev",
appName = "my-app",
env = "prod",
apiKey = BuildConfig.SENTRINEL_API_KEY,
module = "android",
release = BuildConfig.VERSION_NAME,
),
storageDirectory = filesDir, // Android: required for crashes to survive
)
Sentrinel.identify(user.id) // null on sign-out
ProcessLifecycleOwner.get().lifecycle.addObserver(object : DefaultLifecycleObserver {
override fun onStop(owner: LifecycleOwner) = Sentrinel.onBackground()
override fun onStart(owner: LifecycleOwner) = Sentrinel.onForeground()
})
| Option | Default | What it does |
|---|---|---|
storagePath |
sentrinel.storage property, else java.io.tmpdir/sentrinel |
Use the storageDirectory overload on Android |
persistCrashes |
true |
Write crashes to disk (fsync'd) before the process dies |
installCrashHandler |
true |
The default uncaught-exception handler (chained) |
consumerIdentifier |
none | Pins the consumer; prefer identify |
Sentrinel.identityHeaders() gives the two identity headers for your own
backend's requests.
Browser config
A web app is the third surface, and the only one where the API key cannot go in the config. Everything in a JavaScript bundle is served to every visitor, and an ingest key cannot be scoped down after the fact. So the setup is two halves: the page holds no secret and posts to your own origin, and a server route forwards with the key.
Client โ everything on
import { initSentrinelBrowser } from '@sentrinel/plugin/browser';
// Before hydration or first render. An error thrown *during* hydration is one
// of the most common real failures, and a handler installed after misses it.
export const sentrinel = initSentrinelBrowser({
// Same origin, so no key ships in the bundle. This is the default.
endpoint: '/api/sentrinel',
// Crash-free rate is per release. Without this every build reads `unknown`.
release: '2026.8.2',
// โโ What to collect โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
captureErrors: true, // window errors + unhandled rejections
captureRequests: true, // patch fetch: timing, status, trace propagation
captureBreadcrumbs: true, // clicks, SPA navigation, requests
trackSessions: true, // one per page load โ release health's denominator
// โโ Volume โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
sampleRate: 1, // successful requests kept
slowRequestThresholdMs: 2_000, // above this, kept regardless of sampleRate
flushInterval: 10_000,
maxBatch: 100, // flush early once this many records queue
// โโ Tracing and identity โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// Same-origin only by default: sending trace ids to a third party leaks them
// and turns a simple request into one needing CORS preflight. These origins
// also receive x-sentrinel-consumer / x-sentrinel-device โ add both, and
// traceparent, to Access-Control-Allow-Headers on a cross-origin API.
tracePropagationTargets: [/^\//, 'https://api.myapp.com'],
// โโ Noise โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// On top of the built-in list (`Script error.`, ResizeObserver loops,
// browser-extension frames).
ignoreErrors: ['AbortError', 'The user aborted a request'],
// โโ Redaction โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// Every URL the SDK sends โ request query params, page URLs, pageviews,
// referrers, replay โ is masked for token, code, key, signature, โฆ already.
// These add to that list.
maskQueryParams: ['invite'],
// Runs before the value is ever on the wire โ the only place that helps for
// data that should not leave the device at all. Return null to drop.
beforeSend: (record) => {
if (record.kind === 'error' && record.errorMessage?.includes('@')) return null;
return record;
},
debug: import.meta.env.DEV,
});
Server โ the tunnel
Any runtime that speaks Request/Response: Bun, Elysia, Hono, Next route
handlers, TanStack Start, Remix, Deno, Workers. In Next it lives at
app/api/sentrinel/route.ts โ not app/api/_sentrinel/, which the App Router
treats as a private folder and never routes to. A server that mounts it by path
should answer the old /api/_sentrinel too, for pages built before the default
changed: isSentrinelTunnelPath(pathname) matches both.
import { createSentrinelTunnel } from '@sentrinel/plugin/tunnel';
export const POST = createSentrinelTunnel({
serverUrl: 'https://api.sentrinel.dev',
// Pinned here, never read from the batch. A browser-supplied app name is a
// claim from an untrusted source โ without pinning, anyone who found the
// endpoint could write into a different app in your account.
appName: 'admin',
env: 'prod',
apiKey: process.env.SENTRINEL_API_KEY!, // never reaches the client
release: process.env.GIT_SHA,
module: 'web', // the default โ browser data is its own module
// An open endpoint that will buffer anything is a memory-exhaustion target.
maxBodyBytes: 256 * 1024,
// Read server-side and overrides whatever the browser claimed. An identity a
// page asserts about itself is a claim, not a fact.
consumerIdentifier: (request) => userIdFromSession(request),
beforeForward: (batch, request) => batch, // null drops the batch
debug: process.env.NODE_ENV !== 'production',
});
What gets captured automatically
| Signal | Source |
|---|---|
Uncaught errors โ session crashed |
window error event |
Unhandled rejections โ session crashed |
unhandledrejection |
Handled errors โ session errored |
captureError() |
Request timing, status, masked query params โ as client rows (kind: "client", module web), never in the backend's endpoint metrics |
patched fetch |
Network failures (status 0) |
patched fetch |
| Breadcrumbs: clicks, navigation, requests | DOM + history patch |
| One session per page load | pagehide / visibilitychange |
| Web vitals: LCP, CLS, INP | PerformanceObserver |
| Language, user agent, cores, connection, screen | navigator, screen |
Manual API
sentrinel.captureError(err, { orderId: 'o_1' });
sentrinel.addBreadcrumb('tapped pay', { category: 'ui', data: { amount: 42 } });
sentrinel.identify('user_123'); // same as setUser; links this device's guest history
sentrinel.reset(); // sign-out: back to guest:<device id>
sentrinel.setContext({ tier: 'pro' });
await sentrinel.flush();
await sentrinel.close(); // unpatch, end the session, send
Until identify(), records belong to guest:<device id> โ the persisted
anonymous id โ rather than to nobody, and every record carries device.id. The
backend plugins read the same id from x-sentrinel-consumer when their own
consumerIdentifier finds no one, so a signed-out visitor's page and API calls
land on one consumer.
Delivery: a batch stays queued until the tunnel answers 2xx (bounded, with
backoff); a failed batch's session state is resent current, not stale; on
pagehide everything waiting goes by sendBeacon or a keepalive fetch.
Source maps
Upload the map from CI with an API key, tagged with the release the SDK reports, and stacks are symbolicated at ingest โ before fingerprinting, so issues group by real source location:
curl -X POST https://your-sentrinel/api/ingest/symbols \
-H "X-API-Key: $SENTRINEL_API_KEY" -H "Content-Type: application/json" \
-d '{"appName":"web","env":"prod","release":"2026.8.2",
"kind":"sourcemap","file":"app.js","content":"<the .map file>"}'
A server key may upload; a mobile key may not โ it ships inside an app bundle, and a leaked bundle key that could upload symbol artifacts could rewrite every stack in the release.
Not covered
XMLHttpRequest (only fetch is patched), and native crash symbolication โ
dSYM and ProGuard artifacts upload and store, but no stack is rewritten from
them.
Full detail: BROWSER.md.
OpenTelemetry without a plugin
Any OpenTelemetry SDK or Collector can export straight to Sentrinel. This works for any language โ Go, Rust, Java, Python, Ruby, .NET โ not just JS/Dart.
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.sentrinel.dev
OTEL_EXPORTER_OTLP_PROTOCOL=http/json
OTEL_EXPORTER_OTLP_HEADERS=x-api-key=snt_otlp_your_key_here
GenAI spans (gen_ai.request.model + gen_ai.usage.*_tokens) are priced
automatically and appear on the LLM cost dashboard page.
What gets collected
| OTel signal | Dashboard page |
|---|---|
| Traces / Spans | Traces waterfall |
| GenAI span attributes | LLM cost |
| Resource attributes | service.name names the part (module) of the key's app |
Backend environment variables
These control the Sentrinel API server itself. Set them in .env or your
deployment platform (Dokploy, Docker, etc.).
# โโ Storage โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
DATABASE_URL=postgresql://sentrinel:<password>@postgres:5432/sentrinel
TELEMETRY_STORE=clickhouse # "postgres" or "clickhouse"
CLICKHOUSE_DB=sentrinel
CLICKHOUSE_USER=sentrinel
CLICKHOUSE_PASSWORD=<password>
CLICKHOUSE_URL=http://clickhouse:8123
# โโ Durable ingest log โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Used automatically whenever a broker answers; the store is written
# directly when none does. Ingest fails over between the two in both
# directions, so neither a dead broker nor a dead store loses telemetry.
SENTRINEL_REDPANDA_BROKERS=redpanda:9092 # unset = localhost:19092
SENTRINEL_INGEST_PIPELINE=auto # "redpanda"/"direct" pin the preference only
SENTRINEL_INGEST_FAILOVER_COOLDOWN_MS=30000
SENTRINEL_INGEST_PROBE_MS=15000
SENTRINEL_INGEST_PUBLISH_TIMEOUT_MS=5000
# โโ Network โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SENTRINEL_API_PORT=3001
PUBLIC_API_URL=https://api.sentrinel.dev # compiled into dashboard at build time
PUBLIC_DASHBOARD_URL=https://app.sentrinel.dev
# โโ Auth & security โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SENTRINEL_REQUIRE_AUTH=true # enforce session auth on dashboard routes
SENTRINEL_REQUIRE_INGEST_KEY=true # require API keys for ingestion
SENTRINEL_DISABLE_SIGNUP=false # lock signup after first user
SENTRINEL_ALLOWED_ORIGINS=https://app.sentrinel.dev,http://localhost:3000
# origins allowed to send the session cookie;
# any origin may call the API without it
SENTRINEL_COOKIE_SAMESITE=lax
SENTRINEL_COOKIE_DOMAIN=
# โโ Billing, trials & the operator console โโโโโโโโโโโโโโโโโโ
SENTRINEL_ADMIN_EMAILS= # comma-separated; added to the owner, not instead of
SENTRINEL_TRIAL_DAYS=14 # 0 disables trials (self-hosted wants this)
SENTRINEL_INGEST_GRACE_DAYS=7 # keep accepting telemetry this long after a block
# โโ Retention โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
RETENTION_LOGS_DAYS=30 # raw request/app log retention
RETENTION_ERRORS_DAYS=90 # error occurrences (kept longer)
RETENTION_METRICS_DAYS=400 # aggregated metrics (~13 months)
RETENTION_REPLAY_DAYS=14 # session replay recordings
RETENTION_CUSTOM_METRICS_DAYS=400 # custom metrics (small, kept long)
# โโ Connection pools โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
DATABASE_POOL_SIZE=10
DATABASE_READ_POOL_SIZE=10
DATABASE_REPLICA_URL= # optional read replica
Key settings explained
| Variable | Why it matters |
|---|---|
TELEMETRY_STORE=clickhouse |
Production recommended. Postgres works for dev/small deployments. |
SENTRINEL_REQUIRE_INGEST_KEY=true |
Don't turn this off. Prevents unauthenticated data writes. |
PUBLIC_API_URL |
Dashboard builds need this at compile time. Changing it requires a rebuild. |
RETENTION_LOGS_DAYS |
Controls disk usage. 30 days is a good default. |
RETENTION_ERRORS_DAYS |
Error occurrences outlive raw logs: they are a fraction of the volume and the thing people actually go back to. They also back the issues list โ an issue whose occurrences had expired would open onto an empty detail page while the issue itself still existed. |
RETENTION_METRICS_DAYS |
400 days gives ~13 months of history. |
RETENTION_REPLAY_DAYS |
Session recordings are the largest thing stored per unit of value, so they get their own, shorter clock. Nobody watches a replay from six weeks ago. |
STRIPE_SECRET_KEY |
Turns on self-serve checkout. Leave it unset and the billing page falls back to "talk to us" โ trials, quotas and the blocking gate all still work, because enforcement never depended on the provider. |
STRIPE_WEBHOOK_SECRET |
Every webhook is signature-checked. Without this, subscription changes made in Stripe never reach Sentrinel, so an org that paid stays blocked. |
SENTRINEL_ADMIN_EMAILS |
Extra operators who may open Platform admin and change any org's billing. Deliberately an env var, not a database column: a column is one compromised signup away from being set, an env var needs redeploy access. These are added to the product owner rather than replacing them โ naming a colleague must not be the thing that removes your own access, since that is only undoable by redeploying. |
SENTRINEL_TRIAL_DAYS |
How long a newly created org may use Sentrinel before paying. Existing orgs are never backfilled onto a trial clock โ they stay active. Set to 0 for self-hosted, where there is nobody to bill. |
SENTRINEL_INGEST_GRACE_DAYS |
How long telemetry keeps being accepted after the dashboard blocks. Cutting ingest instantly means that by the time someone pays, the window they needed is gone. After this, ingest answers 402. |
What each signal captures
Request metrics (always collected)
In-memory aggregation, flushed every 30s. Exact regardless of sampling.
| Field | Description |
|---|---|
| Request count | Total requests per endpoint per minute |
| Success count | Requests with status < 400 |
| Error count | Requests with status >= 400 |
| Response time | avg, min, max, p50, p95, p99 |
| Request/response size | Bytes transferred |
| Status codes | Distribution (200, 404, 500, etc.) |
Dashboard pages: Traffic, Performance, Errors, Consumers
Request logs (when requestLogging.enabled: true)
Individual request/response records with full detail.
| Field | Description |
|---|---|
| Method, path, status | HTTP method, URL path, status code |
| Response time | Latency in milliseconds |
| Request/response size | Bytes |
| Consumer identifier | Which client made the call |
| Request headers | Full headers (masked) |
| Request body | Full body (masked, truncated) |
| Response body | Full body (masked, truncated) |
| Query parameters | URL params (masked) |
| Error message | If status >= 400 |
| Trace ID | Links to distributed trace |
| Business context | Fields from addRequestContext() |
| Sample rate | How this record was sampled |
Dashboard pages: Request Logs, Traffic (endpoint detail), Performance (Apdex)
Application logs (when logging.enabled or logCapture.enabled)
Structured log records correlated to requests.
| Field | Description |
|---|---|
| Level | debug, info, warn, error |
| Message | Stable, groupable string |
| Category | Hierarchical (e.g., "api.checkout") |
| Attributes | Structured fields (user_id, amount, etc.) |
| Request ID | Links to the request |
| Trace ID | Links to the distributed trace |
| Span ID | Links to the specific span |
| Sequence | Order within request |
Dashboard pages: Logs, Request Logs (Logs tab)
Errors (auto-collected for status >= 400)
Fingerprinted and grouped into issues with occurrence counting.
| Field | Description |
|---|---|
| Error type | Exception class or HTTP status |
| Error message | Human-readable description |
| Stack trace | Full call stack (when available) |
| Fingerprint | 16-char hash for grouping |
| Title | Auto-generated from type + message |
| Culprit | Top frame in your code |
| Occurrences | How many times this bug fired |
| First/last seen | Time range |
| Regression | Auto-detected if resolved bug reappears |
Dashboard pages: Issues, Errors
Distributed traces (auto-collected for every request)
| Field | Description |
|---|---|
| Trace ID | Unique per request |
| Root span | The HTTP request itself |
| Child spans | DB queries, external calls, custom spans |
| Span kind | SERVER, CLIENT, DB, INTERNAL, PRODUCER, CONSUMER |
| Duration | Per-span timing |
| Attributes | Custom key-value pairs |
| Status | OK or ERROR |
Dashboard pages: Traces (waterfall), Request Logs (Trace tab)
Resource metrics (auto-collected)
| Field | Description |
|---|---|
| CPU usage | Percentage |
| Memory RSS | Resident Set Size |
| Memory heap total | Total heap allocation |
| Memory heap used | Currently used heap |
Dashboard pages: Resources
LLM cost (auto-detected from GenAI spans)
| Field | Description |
|---|---|
| Provider | openai, anthropic, google, etc. |
| Model | gpt-4o, claude-3, etc. |
| Input/output tokens | Per-call token counts |
| Cost (USD) | Auto-computed from price table |
| Consumer | Which client made the call |
| Endpoint | Which API route triggered it |
Dashboard pages: LLM cost
Release health (mobile sessions)
| Field | Description |
|---|---|
| Session ID | Unique per foreground stretch โ ended when the app is backgrounded |
| Status | ok, errored (an error the app survived), crashed (a fatal error), abnormal (killed with no report) |
| Release version | Which build |
| Environment | prod, staging, dev |
| Device OS/version | iOS/Android version |
| Duration | Session length |
Dashboard pages: Release Health
Data masking
Masking runs in your process, before anything leaves it. A masked field never reaches the network, let alone Sentrinel's disk.
A built-in list always applies โ you do not configure it. It used to apply
only when you passed patterns of your own, so the default configuration shipped
Authorization headers and session cookies verbatim. Your patterns now add to
the list; they can never remove from it.
| Where | Masked by default |
|---|---|
| Headers | authorization, proxy-authorization, cookie, set-cookie, x-api-key, x-auth-token, and any name ending in token or containing secret, password, api-key, credential |
| Query strings | token, key, api_key, code, password, signature, sig, secret, auth, session, jwt, access_token, and any name ending in token/signature or containing secret/password/credential (so X-Amz-Signature, X-Amz-Credential) |
| Body fields, at any depth | password, passwd, pwd, secret, token and *_token/*Token, api_key/apiKey, authorization, card number fields, cvv/cvc, pin, ssn, otp |
Names are compared lower-cased with punctuation removed, so access_token,
accessToken and Access-Token are one rule. tokens_used (an LLM bill) is
not a secret and is not masked.
Bodies are masked as JSON, as application/x-www-form-urlencoded, and as
multipart text fields. A JSON body cut off at maxBodySize no longer parses โ
it is still masked, by a text scan of its "key": value pairs, never sent as-is.
Add your own:
requestLogging: {
maskHeaders: [/^x-tenant-secret$/i],
maskQueryParams: ["invite"],
maskBodyFields: [/^iban$/i, "dateOfBirth"],
}
A string matches the name exactly (case-insensitive); a RegExp is tested against it.
Sampling safety
Three properties make sampling safe:
Errors and slow requests are never sampled out.
sampleRateapplies only to successful, fast requests โ the ones you were never going to read.Metrics stay exact. Counters are computed in-process before sampling, so a 1% sample rate still yields correct request counts and error rates. Only the individual log rows are thinned.
Every row records the rate it was captured at, so counts derived from raw logs can be extrapolated honestly rather than silently under-reporting.
Recommended sample rates
| Traffic level | sampleRate |
Why |
|---|---|---|
| Development | 1.0 |
You want every request |
| Low (< 100 req/s) | 0.5 |
Keep half, still plenty of detail |
| Medium (100-1k req/s) | 0.1 |
10% is enough for debugging |
| High (> 1k req/s) | 0.01 |
1% for volume, errors always kept |
Distributed tracing
Traces connect the full request path: Flutter tap โ API โ database โ external
service. The root span is always the HTTP request. Child spans are created with
traceSpan().
Manual spans
import { traceSpan, traced } from "@sentrinel/plugin";
// Wrap a block
const user = await traceSpan("db.findUser", async (span) => {
span.setAttribute("db.system", "postgresql");
span.setAttribute("db.operation", "SELECT");
return db.users.findById(id);
});
// Wrap a function at definition
const getProducts = traced("db.getProducts", () => db.products.find());
Auto-trace an entire service
import { traceObject } from "@sentrinel/plugin";
const db = traceObject(new DatabaseClient(), "db");
// Every method on db is now auto-traced as "db.*"
Cross-service calls
import { sentrinelFetch } from "@sentrinel/plugin";
// Automatically propagates traceparent header
const res = await sentrinelFetch("https://payments.internal/v1/charges", {
method: "POST",
body: JSON.stringify({ amount }),
});
Flutter โ backend correlation
The Flutter SDK sends traceparent โ plus x-sentrinel-consumer and
x-sentrinel-device โ on requests to the hosts in tracePropagationTargets.
The backend plugin picks them up and continues the same trace, under the same
person and install. The list is empty by default, so a third-party API never
receives your trace or user ids: name your own backends.
Span kinds
Use the right kind for accurate waterfall coloring:
| Kind | Use for |
|---|---|
SERVER |
Incoming HTTP request (auto-created) |
CLIENT |
Outgoing HTTP call |
DB |
Database query |
INTERNAL |
Business logic |
PRODUCER |
Message queue publish |
CONSUMER |
Message queue consume |
Structured logging deep dive
Why structured logging
console.log(\user ${id} failed checkout`)` is easy to write and impossible to
query. You cannot filter by user, group by failure reason, or tie it to the
request that produced it.
Structured logging fixes this by separating the message (stable, groupable) from the attributes (filterable fields).
Context is inherited, not repeated
withContext({ userId: user.id, tenantId: org.id, tier: user.tier }, async () => {
await processOrder();
// every log inside carries those three fields
// even three levels deep, in code that never heard of a user
});
Categories are hierarchical
const log = getLogger(["api", "checkout"]);
// logs under "api.checkout"
const sub = log.getChild("db");
// logs under "api.checkout.db"
// Filter by "api" to see everything in the API subsystem
Canonical wide events
Instead of scattered log lines, attach rich context to the request itself:
addRequestContext({
tier: user.tier,
cartTotal,
experiment: "new-pricing",
outcome: "success",
});
"Slow checkouts for enterprise customers in the new pricing experiment" becomes one query rather than a correlation exercise.
Everything is linked
- The request row carries the trace id and your
addRequestContext()fields - Every log record carries the request id, trace id and span id
- The trace carries the request id, so the waterfall links back
- An error occurrence carries both, linking to the exact request
What you see in the dashboard
| Dashboard page | Requires | Shows |
|---|---|---|
| Apps | Plugin installed | Overview cards per service |
| Traffic | Metrics (auto) | Request volume, endpoints, response times |
| Errors | Errors (auto for >= 400) | Error rates, status breakdown |
| Issues | Errors with stack traces | Fingerprinted error groups, occurrence counts |
| Performance | Metrics (auto) + Request logs | p50/p95/p99, Apdex, slowest endpoints |
| Consumers | Consumer identifier set | Per-client metrics, usage breakdown |
| Request logs | requestLogging.enabled: true |
Individual request entries with full detail |
| Logs | logging.enabled or logCapture.enabled |
Structured logs with filtering |
| Traces | traceSpan() or OTLP |
Distributed trace waterfalls |
| Resources | Metrics (auto) | CPU and memory over time |
| Uptime | Health checks configured | HTTP checks, uptime percentage |
| Alerts | Alert rules configured | Threshold alerts with notifications |
| SLOs | SLOs configured | Error budget, burn-down |
| Cron monitors | Monitors configured | Job check-in status |
| LLM cost | GenAI spans | Token usage, cost by model |
| Release health | Flutter release set |
Crash-free rate per release |
| Dashboards | Custom widgets | Arranged views |
| Status pages | Public config | Customer-facing status |
| SQL console | Any telemetry data | Read-only SQL queries |
Troubleshooting
Nothing shows up
- Check API health:
curl http://localhost:3001/health - Check
serverUrl: Must point to the API, not the dashboard - Check API key: Must match
appName+env - Check
requestLogging.enabled: true: Metrics work without it, request logs don't - Check
excludePaths: Your endpoint might be excluded
Logs not appearing
logging.enabledis off by default. Addlogging: { minLevel: "debug" }.logCapture.enabledis off by default. AddlogCapture: { enabled: true, minLevel: "debug" }.
Traces missing
- No
traceSpan()calls = only the root HTTP span appears. Wrap key operations. - For Flutter: the backend's host must be in
tracePropagationTargets, or notraceparentis sent.
Flutter crashes not showing
- Make sure
runAppis inside theappcallback ofSentrinelFlutter.run() - Set
releaseโ without it, release health shows "unknown" - Framework and zone errors are unhandled errors, not crashes โ look in Issues,
and at
erroredsessions, not onlycrashedones - Without
SentrinelFlutter, callSentrinel.onBackground()when paused - On native Android, pass
storageDirectory = filesDirtoSentrinel.start
403 errors in logs
The API key doesn't match appName + env. Create a new key in the dashboard
that matches both values.
Reference: all plugin options
| Option | Type | Default | Backend | Flutter |
|---|---|---|---|---|
serverUrl |
string |
โ | required | required |
appName |
string |
โ | required | required |
env |
string |
"dev" |
required | required |
apiKey |
string |
โ | recommended | recommended |
version / release |
string |
โ | deploy markers | crash-free rate |
flushInterval |
number / Duration |
30000 / 30s |
batch interval | batch interval |
consumerIdentifier |
string / (ctx) => string |
โ | client ID | client ID |
excludePaths |
(string|RegExp)[] |
[] |
paths to ignore | โ |
debug |
boolean |
false |
verbose logging | โ |
requestLogging.enabled |
boolean |
false |
request log rows | โ |
requestLogging.sampleRate |
number |
1 |
fraction kept | โ |
requestLogging.slowRequestThresholdMs |
number |
2000 |
always-capture ms | โ |
requestLogging.logRequestHeaders |
boolean |
false |
include headers | โ |
requestLogging.logRequestBody |
boolean |
false |
include req body | โ |
requestLogging.logResponseBody |
boolean |
false |
include res body | โ |
requestLogging.maxBodySize |
number |
65536 |
bytes of a body ever read | โ |
requestLogging.maskHeaders |
(string|RegExp)[] |
built-in list | extra headers to redact | โ |
requestLogging.maskQueryParams |
(string|RegExp)[] |
built-in list | extra params to redact | โ |
requestLogging.maskBodyFields |
(string|RegExp)[] |
built-in list | extra body fields to redact | โ |
consumerHeaderPattern |
RegExp |
โ | trust x-sentrinel-consumer values beyond guest: |
โ |
sendTimeoutMs |
number |
10000 |
one POST before retry | โ |
retry.maxQueued / retry.maxQueuedBytes |
number |
100 / 8MB |
per payload type | โ |
buffer.maxRequestLogs / maxAppLogs / maxErrors / maxTraces |
number |
10k / 10k / 5k / 5k | oldest dropped past this | โ |
processHooks |
boolean | { flushOnExit, captureErrors, timeoutMs } |
on (off when NODE_ENV=test) |
flush on exit, report crashes | โ |
logCapture.enabled |
boolean |
false |
capture console.* | โ |
logCapture.minLevel |
string |
"info" |
min level | โ |
logCapture.maxPerRequest |
number |
50 |
per-request cap | โ |
logCapture.maxMessageLength |
number |
2000 |
truncation | โ |
logging.minLevel |
string |
"debug" |
min buffered level | โ |
logging.echo |
boolean |
false |
mirror to stdout | โ |