mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
feat: pass env into bs tracing
This commit is contained in:
@@ -3,6 +3,7 @@ HEXCLAVE_BULLDOZER_SERVER_SECRET=# shared secret callers (the backend) must pres
|
||||
|
||||
# Sentry
|
||||
BULLDOZER_JS_SENTRY_DSN=# error-reporting DSN for the bulldozer-js process. Leave empty to turn Sentry off. Falls back to SENTRY_DSN if unset
|
||||
BULLDOZER_JS_SENTRY_ENVIRONMENT=# Sentry environment label for THIS deployment (e.g. "production", "staging", "dev"). Lets prod vs dev bulldozer be separated in Sentry even when both run NODE_ENV=production.
|
||||
|
||||
# Storage
|
||||
HEXCLAVE_BULLDOZER_JS_LMDB_PATH=# folder for the on-disk LMDB store. Defaults to ./.data/bulldozer-js-lmdb
|
||||
|
||||
@@ -3,6 +3,7 @@ HEXCLAVE_BULLDOZER_SERVER_SECRET=mock_bulldozer_server_secret
|
||||
|
||||
# Sentry
|
||||
BULLDOZER_JS_SENTRY_DSN=
|
||||
BULLDOZER_JS_SENTRY_ENVIRONMENT=development
|
||||
|
||||
# Storage
|
||||
HEXCLAVE_BULLDOZER_JS_LMDB_PATH=.data/bulldozer-js-lmdb
|
||||
|
||||
@@ -21,7 +21,7 @@ import "./load-env.js";
|
||||
import { instrumentation, traceSpan } from "./otel.js";
|
||||
import { createPaymentsSchema, itemQuantitiesLedgerUpperBoundAsOf } from "./payments/schema/index.js";
|
||||
import type { CustomerType, Json, SubscriptionRow, TransactionRow } from "./payments/schema/types.js";
|
||||
import { initSentry } from "./sentry.js";
|
||||
import { initSentry, resolveBulldozerSentryEnvironment } from "./sentry.js";
|
||||
|
||||
const sentryEnabled = initSentry();
|
||||
|
||||
@@ -1035,6 +1035,7 @@ const startupFields = {
|
||||
port: app.server?.port ?? port,
|
||||
pid: process.pid,
|
||||
nodeVersion: process.version,
|
||||
sentryEnvironment: resolveBulldozerSentryEnvironment(),
|
||||
lowLevelBackend: process.env.HEXCLAVE_BULLDOZER_JS_LOW_LEVEL_BACKEND ?? "lmdb",
|
||||
usingTmpLmdb: process.env.HEXCLAVE_BULLDOZER_JS_USE_TMP_LMDB === "1",
|
||||
disableHeapReadCache: process.env.HEXCLAVE_BULLDOZER_JS_DISABLE_PILEDRIVER_HEAP_READ_CACHE === "1",
|
||||
|
||||
@@ -4,6 +4,12 @@ import { ignoreUnhandledRejection } from "@hexclave/shared/dist/utils/promises";
|
||||
import { sentryBaseConfig } from "@hexclave/shared/dist/utils/sentry";
|
||||
import { nicify } from "@hexclave/shared/dist/utils/strings";
|
||||
|
||||
export function resolveBulldozerSentryEnvironment(): string {
|
||||
const configured = process.env.BULLDOZER_JS_SENTRY_ENVIRONMENT?.trim();
|
||||
if (configured) return configured;
|
||||
return process.env.NODE_ENV === "production" ? "production" : "development";
|
||||
}
|
||||
|
||||
// Init Sentry for the bulldozer-js process and route `captureError`/`captureWarning` to it. No-ops
|
||||
// without a DSN, in which case errors still hit the default console sink. Returns whether Sentry was
|
||||
// actually configured, so the boot path can decide whether to emit the startup signal to Sentry
|
||||
@@ -15,7 +21,7 @@ export function initSentry(): boolean {
|
||||
Sentry.init({
|
||||
...sentryBaseConfig,
|
||||
dsn,
|
||||
environment: process.env.NODE_ENV === "production" ? "production" : "development",
|
||||
environment: resolveBulldozerSentryEnvironment(),
|
||||
sendDefaultPii: false,
|
||||
tracesSampleRate: 0,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user