getScheme() === 'sentry') { // utopia/logger DSN (`sentry://PROJECT_ID:KEY@HOST/`) -> standard Sentry DSN (`https://KEY@HOST/PROJECT_ID`). $sentryDsn = 'https://' . ($dsn->getPassword() ?? '') . '@' . $dsn->getHost() . '/' . ($dsn->getUser() ?? ''); $isProduction = System::getEnv('_APP_ENV', 'development') === 'production'; Span::addExporter( new Exporter\Sentry( dsn: $sentryDsn, environment: $isProduction ? 'production' : 'staging', release: System::getEnv('_APP_VERSION', 'UNKNOWN'), serverName: System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()), ), sampler: static fn (Span $span): bool => $span->getError() !== null, ); } } catch (Throwable $error) { Console::warning('Failed to register Realtime Sentry span exporter: ' . $error->getMessage()); } // Print spans to stdout for local visibility on editions where app/init/span.php — which already // installs a Pretty exporter — isn't loaded (it's gated on `_APP_EDITION === 'self-hosted'`). if (System::getEnv('_APP_EDITION', 'self-hosted') !== 'self-hosted') { Span::addExporter(new Exporter\Pretty(), function (Span $span): bool { if (\str_starts_with($span->getAction(), 'listener.')) { return $span->getError() !== null; } return true; }); }