@glasstrace/sdk 0.17.2 → 0.17.3
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 +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/index.cjs +40 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/init.cjs
CHANGED
|
@@ -18096,7 +18096,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
|
|
|
18096
18096
|
}
|
|
18097
18097
|
const baseConfig = resolveConfig({ apiKey: devKey });
|
|
18098
18098
|
const config2 = { ...baseConfig, apiKey: devKey };
|
|
18099
|
-
const sdkVersion = true ? "0.17.
|
|
18099
|
+
const sdkVersion = true ? "0.17.3" : "0.0.0-dev";
|
|
18100
18100
|
const result = await verifyInitReachable(config2, anonKey, sdkVersion);
|
|
18101
18101
|
if (result.ok) {
|
|
18102
18102
|
return { outcome: "verified" };
|
package/dist/cli/init.js
CHANGED
|
@@ -509,7 +509,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
|
|
|
509
509
|
}
|
|
510
510
|
const baseConfig = resolveConfig({ apiKey: devKey });
|
|
511
511
|
const config = { ...baseConfig, apiKey: devKey };
|
|
512
|
-
const sdkVersion = true ? "0.17.
|
|
512
|
+
const sdkVersion = true ? "0.17.3" : "0.0.0-dev";
|
|
513
513
|
const result = await verifyInitReachable(config, anonKey, sdkVersion);
|
|
514
514
|
if (result.ok) {
|
|
515
515
|
return { outcome: "verified" };
|
package/dist/index.cjs
CHANGED
|
@@ -20759,6 +20759,17 @@ init_console_capture();
|
|
|
20759
20759
|
|
|
20760
20760
|
// src/lifecycle.ts
|
|
20761
20761
|
var import_node_events = require("node:events");
|
|
20762
|
+
|
|
20763
|
+
// src/signal-handler.ts
|
|
20764
|
+
var coexistenceState = "unknown";
|
|
20765
|
+
function setCoexistenceState(s) {
|
|
20766
|
+
coexistenceState = s;
|
|
20767
|
+
}
|
|
20768
|
+
function getCoexistenceState() {
|
|
20769
|
+
return coexistenceState;
|
|
20770
|
+
}
|
|
20771
|
+
|
|
20772
|
+
// src/lifecycle.ts
|
|
20762
20773
|
var CoreState = {
|
|
20763
20774
|
IDLE: "IDLE",
|
|
20764
20775
|
REGISTERING: "REGISTERING",
|
|
@@ -21078,13 +21089,19 @@ function registerSignalHandlers() {
|
|
|
21078
21089
|
if (_signalHandlersRegistered) return;
|
|
21079
21090
|
if (typeof process === "undefined" || typeof process.once !== "function") return;
|
|
21080
21091
|
_signalHandlersRegistered = true;
|
|
21092
|
+
const otherSigtermListeners = process.listenerCount("SIGTERM");
|
|
21093
|
+
const otherSigintListeners = process.listenerCount("SIGINT");
|
|
21081
21094
|
const handler = (signal) => {
|
|
21082
21095
|
void executeShutdown().finally(() => {
|
|
21083
21096
|
if (_signalHandler) {
|
|
21084
21097
|
process.removeListener("SIGTERM", _signalHandler);
|
|
21085
21098
|
process.removeListener("SIGINT", _signalHandler);
|
|
21086
21099
|
}
|
|
21087
|
-
|
|
21100
|
+
const otherListeners = signal === "SIGTERM" ? otherSigtermListeners : otherSigintListeners;
|
|
21101
|
+
const otherProviderOwnsSignal = getCoexistenceState() === "coexisting" && otherListeners > 0;
|
|
21102
|
+
if (!otherProviderOwnsSignal) {
|
|
21103
|
+
process.kill(process.pid, signal);
|
|
21104
|
+
}
|
|
21088
21105
|
});
|
|
21089
21106
|
};
|
|
21090
21107
|
_signalHandler = handler;
|
|
@@ -21302,9 +21319,11 @@ async function configureOtel(config2, sessionManager) {
|
|
|
21302
21319
|
const probeTracer = existingProvider.getTracer("glasstrace-probe");
|
|
21303
21320
|
const anotherProviderRegistered = probeTracer.constructor.name !== "ProxyTracer";
|
|
21304
21321
|
if (anotherProviderRegistered) {
|
|
21322
|
+
setCoexistenceState("coexisting");
|
|
21305
21323
|
await runCoexistencePath(existingProvider, config2);
|
|
21306
21324
|
return;
|
|
21307
21325
|
}
|
|
21326
|
+
setCoexistenceState("sole-owner");
|
|
21308
21327
|
await runRegistrationPath(config2, sessionManager);
|
|
21309
21328
|
}
|
|
21310
21329
|
async function runCoexistencePath(existingProvider, config2) {
|
|
@@ -21384,6 +21403,19 @@ async function runRegistrationPath(config2, sessionManager) {
|
|
|
21384
21403
|
}
|
|
21385
21404
|
}
|
|
21386
21405
|
vercelOtel.registerOTel(otelConfig);
|
|
21406
|
+
const vercelProxy = trace.getTracerProvider();
|
|
21407
|
+
const vercelConcreteProvider = typeof vercelProxy.getDelegate === "function" ? vercelProxy.getDelegate() : vercelProxy;
|
|
21408
|
+
registerShutdownHook({
|
|
21409
|
+
name: "vercel-otel-shutdown",
|
|
21410
|
+
priority: 0,
|
|
21411
|
+
fn: async () => {
|
|
21412
|
+
try {
|
|
21413
|
+
await vercelConcreteProvider.shutdown?.();
|
|
21414
|
+
} catch {
|
|
21415
|
+
}
|
|
21416
|
+
}
|
|
21417
|
+
});
|
|
21418
|
+
registerBeforeExitTrigger();
|
|
21387
21419
|
setOtelState(OtelState.OWNS_PROVIDER);
|
|
21388
21420
|
emitLifecycleEvent("otel:configured", { state: OtelState.OWNS_PROVIDER, scenario: "E" });
|
|
21389
21421
|
return;
|
|
@@ -21689,7 +21721,7 @@ function registerGlasstrace(options) {
|
|
|
21689
21721
|
setCoreState(CoreState.REGISTERING);
|
|
21690
21722
|
startRuntimeStateWriter({
|
|
21691
21723
|
projectRoot: process.cwd(),
|
|
21692
|
-
sdkVersion: "0.17.
|
|
21724
|
+
sdkVersion: "0.17.3"
|
|
21693
21725
|
});
|
|
21694
21726
|
const config2 = resolveConfig(options);
|
|
21695
21727
|
if (config2.verbose) {
|
|
@@ -21707,9 +21739,10 @@ function registerGlasstrace(options) {
|
|
|
21707
21739
|
}
|
|
21708
21740
|
const existingProbe = trace.getTracerProvider().getTracer("glasstrace-probe");
|
|
21709
21741
|
const anotherProviderRegistered = existingProbe.constructor.name !== "ProxyTracer";
|
|
21710
|
-
if (
|
|
21711
|
-
|
|
21742
|
+
if (anotherProviderRegistered) {
|
|
21743
|
+
setCoexistenceState("coexisting");
|
|
21712
21744
|
}
|
|
21745
|
+
registerSignalHandlers();
|
|
21713
21746
|
const anonymous = isAnonymousMode(config2);
|
|
21714
21747
|
let effectiveKey = config2.apiKey;
|
|
21715
21748
|
initAuthState(anonymous ? AuthState.ANONYMOUS : AuthState.AUTHENTICATED);
|
|
@@ -21854,8 +21887,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
21854
21887
|
if (config2.verbose) {
|
|
21855
21888
|
console.info("[glasstrace] Background init firing.");
|
|
21856
21889
|
}
|
|
21857
|
-
const healthReport = collectHealthReport("0.17.
|
|
21858
|
-
const initResult = await performInit(config2, anonKeyForInit, "0.17.
|
|
21890
|
+
const healthReport = collectHealthReport("0.17.3");
|
|
21891
|
+
const initResult = await performInit(config2, anonKeyForInit, "0.17.3", healthReport);
|
|
21859
21892
|
if (generation !== registrationGeneration) return;
|
|
21860
21893
|
const currentState = getCoreState();
|
|
21861
21894
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -21878,7 +21911,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
21878
21911
|
}
|
|
21879
21912
|
maybeInstallConsoleCapture();
|
|
21880
21913
|
if (didLastInitSucceed()) {
|
|
21881
|
-
startHeartbeat(config2, anonKeyForInit, "0.17.
|
|
21914
|
+
startHeartbeat(config2, anonKeyForInit, "0.17.3", generation, (newApiKey, accountId) => {
|
|
21882
21915
|
setAuthState(AuthState.CLAIMING);
|
|
21883
21916
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
21884
21917
|
setResolvedApiKey(newApiKey);
|