@glasstrace/sdk 1.3.4 → 1.3.5

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/cli/init.cjs CHANGED
@@ -18866,7 +18866,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
18866
18866
  }
18867
18867
  const baseConfig = resolveConfig({ apiKey: devKey });
18868
18868
  const config2 = { ...baseConfig, apiKey: devKey };
18869
- const sdkVersion = true ? "1.3.4" : "0.0.0-dev";
18869
+ const sdkVersion = true ? "1.3.5" : "0.0.0-dev";
18870
18870
  const result = await verifyInitReachable(config2, anonKey, sdkVersion);
18871
18871
  if (result.ok) {
18872
18872
  return { outcome: "verified" };
package/dist/cli/init.js CHANGED
@@ -994,7 +994,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
994
994
  }
995
995
  const baseConfig = resolveConfig({ apiKey: devKey });
996
996
  const config = { ...baseConfig, apiKey: devKey };
997
- const sdkVersion = true ? "1.3.4" : "0.0.0-dev";
997
+ const sdkVersion = true ? "1.3.5" : "0.0.0-dev";
998
998
  const result = await verifyInitReachable(config, anonKey, sdkVersion);
999
999
  if (result.ok) {
1000
1000
  return { outcome: "verified" };
package/dist/index.cjs CHANGED
@@ -22088,6 +22088,27 @@ function detectSentry() {
22088
22088
  }
22089
22089
  }
22090
22090
 
22091
+ // src/proxy-detection.ts
22092
+ function isProxyTracerProvider(value) {
22093
+ if (value === null || value === void 0 || typeof value !== "object") {
22094
+ return false;
22095
+ }
22096
+ return "getTracer" in value && typeof value.getTracer === "function" && "getDelegate" in value && typeof value.getDelegate === "function" && "setDelegate" in value && typeof value.setDelegate === "function" && "getDelegateTracer" in value && typeof value.getDelegateTracer === "function";
22097
+ }
22098
+ function isProxyTracer(value, ownerProvider) {
22099
+ if (value === null || value === void 0 || typeof value !== "object") {
22100
+ return false;
22101
+ }
22102
+ const structurallyShaped = "_getTracer" in value && typeof value._getTracer === "function" && "startSpan" in value && typeof value.startSpan === "function" && "startActiveSpan" in value && typeof value.startActiveSpan === "function";
22103
+ if (!structurallyShaped) {
22104
+ return false;
22105
+ }
22106
+ if (!Object.hasOwn(value, "_provider")) {
22107
+ return false;
22108
+ }
22109
+ return value._provider === ownerProvider;
22110
+ }
22111
+
22091
22112
  // src/otel-config.ts
22092
22113
  var resolvedApiKey = API_KEY_PENDING;
22093
22114
  var activeExporter = null;
@@ -22126,7 +22147,7 @@ async function configureOtel(config2, sessionManager) {
22126
22147
  });
22127
22148
  const existingProvider = trace.getTracerProvider();
22128
22149
  const probeTracer = existingProvider.getTracer("glasstrace-probe");
22129
- const anotherProviderRegistered = probeTracer.constructor.name !== "ProxyTracer";
22150
+ const anotherProviderRegistered = !isProxyTracerProvider(existingProvider) || !isProxyTracer(probeTracer, existingProvider);
22130
22151
  if (anotherProviderRegistered) {
22131
22152
  setCoexistenceState("coexisting");
22132
22153
  await runCoexistencePath(existingProvider, config2);
@@ -22604,7 +22625,7 @@ function registerGlasstrace(options) {
22604
22625
  setCoreState(CoreState.REGISTERING);
22605
22626
  startRuntimeStateWriter({
22606
22627
  projectRoot: process.cwd(),
22607
- sdkVersion: "1.3.4"
22628
+ sdkVersion: "1.3.5"
22608
22629
  });
22609
22630
  const config2 = resolveConfig(options);
22610
22631
  if (config2.verbose) {
@@ -22620,8 +22641,9 @@ function registerGlasstrace(options) {
22620
22641
  if (config2.verbose) {
22621
22642
  console.info("[glasstrace] Not production-disabled.");
22622
22643
  }
22623
- const existingProbe = trace.getTracerProvider().getTracer("glasstrace-probe");
22624
- const anotherProviderRegistered = existingProbe.constructor.name !== "ProxyTracer";
22644
+ const existingTracerProvider = trace.getTracerProvider();
22645
+ const existingProbe = existingTracerProvider.getTracer("glasstrace-probe");
22646
+ const anotherProviderRegistered = !isProxyTracerProvider(existingTracerProvider) || !isProxyTracer(existingProbe, existingTracerProvider);
22625
22647
  if (anotherProviderRegistered) {
22626
22648
  setCoexistenceState("coexisting");
22627
22649
  }
@@ -22770,8 +22792,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
22770
22792
  if (config2.verbose) {
22771
22793
  console.info("[glasstrace] Background init firing.");
22772
22794
  }
22773
- const healthReport = collectHealthReport("1.3.4");
22774
- const initResult = await performInit(config2, anonKeyForInit, "1.3.4", healthReport);
22795
+ const healthReport = collectHealthReport("1.3.5");
22796
+ const initResult = await performInit(config2, anonKeyForInit, "1.3.5", healthReport);
22775
22797
  if (generation !== registrationGeneration) return;
22776
22798
  const currentState = getCoreState();
22777
22799
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -22794,7 +22816,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
22794
22816
  }
22795
22817
  maybeInstallConsoleCapture();
22796
22818
  if (didLastInitSucceed()) {
22797
- startHeartbeat(config2, anonKeyForInit, "1.3.4", generation, (newApiKey, accountId) => {
22819
+ startHeartbeat(config2, anonKeyForInit, "1.3.5", generation, (newApiKey, accountId) => {
22798
22820
  setAuthState(AuthState.CLAIMING);
22799
22821
  emitLifecycleEvent("auth:claim_started", { accountId });
22800
22822
  setResolvedApiKey(newApiKey);