@glasstrace/sdk 1.14.0 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -23685,6 +23685,13 @@ async function tryImport(moduleId) {
23685
23685
  return null;
23686
23686
  }
23687
23687
  }
23688
+ function warnPrismaInstrumentationUnavailable(verbose, detail) {
23689
+ if (!verbose) return;
23690
+ sdkLog(
23691
+ "warn",
23692
+ `[glasstrace] @prisma/instrumentation ${detail}; Prisma query spans will not be captured. If you use Prisma and expect database spans, add @prisma/instrumentation as a direct dependency (some package managers, e.g. pnpm, do not expose transitive copies).`
23693
+ );
23694
+ }
23688
23695
  async function configureOtel(config2, sessionManager) {
23689
23696
  setOtelState(OtelState.CONFIGURING);
23690
23697
  await new Promise((resolve3) => {
@@ -23792,7 +23799,14 @@ async function runRegistrationPath(config2, sessionManager) {
23792
23799
  const PrismaInstrumentation = prismaModule2.PrismaInstrumentation;
23793
23800
  if (PrismaInstrumentation) {
23794
23801
  otelConfig.instrumentations = [new PrismaInstrumentation()];
23802
+ } else {
23803
+ warnPrismaInstrumentationUnavailable(
23804
+ config2.verbose,
23805
+ "was loaded but did not export PrismaInstrumentation"
23806
+ );
23795
23807
  }
23808
+ } else {
23809
+ warnPrismaInstrumentationUnavailable(config2.verbose, "could not be loaded");
23796
23810
  }
23797
23811
  vercelOtel.registerOTel(otelConfig);
23798
23812
  const vercelProxy = trace.getTracerProvider();
@@ -23847,9 +23861,22 @@ async function runRegistrationPath(config2, sessionManager) {
23847
23861
  const inst = new PrismaInstrumentation();
23848
23862
  inst.setTracerProvider(provider);
23849
23863
  inst.enable();
23850
- } catch {
23864
+ } catch (err) {
23865
+ if (config2.verbose) {
23866
+ sdkLog(
23867
+ "warn",
23868
+ `[glasstrace] @prisma/instrumentation failed to initialize: ${err instanceof Error ? err.message : String(err)}. Prisma query spans will not be captured.`
23869
+ );
23870
+ }
23851
23871
  }
23872
+ } else {
23873
+ warnPrismaInstrumentationUnavailable(
23874
+ config2.verbose,
23875
+ "was loaded but did not export PrismaInstrumentation"
23876
+ );
23852
23877
  }
23878
+ } else {
23879
+ warnPrismaInstrumentationUnavailable(config2.verbose, "could not be loaded");
23853
23880
  }
23854
23881
  setOtelState(OtelState.OWNS_PROVIDER);
23855
23882
  emitLifecycleEvent("otel:configured", { state: OtelState.OWNS_PROVIDER, scenario: "A" });
@@ -24710,11 +24737,11 @@ function registerGlasstrace(options) {
24710
24737
  setCoreState(CoreState.REGISTERING);
24711
24738
  maybeWarnStaleAgentInstructions({
24712
24739
  projectRoot: process.cwd(),
24713
- sdkVersion: "1.14.0"
24740
+ sdkVersion: "1.15.1"
24714
24741
  });
24715
24742
  startRuntimeStateWriter({
24716
24743
  projectRoot: process.cwd(),
24717
- sdkVersion: "1.14.0"
24744
+ sdkVersion: "1.15.1"
24718
24745
  });
24719
24746
  const config2 = resolveConfig(options);
24720
24747
  setSideEffectVerboseFlag(config2.verbose);
@@ -24882,8 +24909,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
24882
24909
  if (config2.verbose) {
24883
24910
  console.info("[glasstrace] Background init firing.");
24884
24911
  }
24885
- const healthReport = collectHealthReport("1.14.0");
24886
- const initResult = await performInit(config2, anonKeyForInit, "1.14.0", healthReport);
24912
+ const healthReport = collectHealthReport("1.15.1");
24913
+ const initResult = await performInit(config2, anonKeyForInit, "1.15.1", healthReport);
24887
24914
  if (generation !== registrationGeneration) return;
24888
24915
  const currentState = getCoreState();
24889
24916
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -24906,7 +24933,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
24906
24933
  }
24907
24934
  maybeInstallConsoleCapture();
24908
24935
  if (didLastInitSucceed()) {
24909
- startHeartbeat(config2, anonKeyForInit, "1.14.0", generation, (newApiKey, accountId) => {
24936
+ startHeartbeat(config2, anonKeyForInit, "1.15.1", generation, (newApiKey, accountId) => {
24910
24937
  setAuthState(AuthState.CLAIMING);
24911
24938
  emitLifecycleEvent("auth:claim_started", { accountId });
24912
24939
  setResolvedApiKey(newApiKey);