@glasstrace/sdk 1.3.3 → 1.3.4
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/README.md +88 -0
- package/dist/{chunk-XNKG4WNQ.js → chunk-XFNK4YEW.js} +33 -7
- package/dist/chunk-XFNK4YEW.js.map +1 -0
- package/dist/cli/init.cjs +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/index.cjs +32 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1 -1
- package/dist/node-entry.cjs +32 -6
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-XNKG4WNQ.js.map +0 -1
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.
|
|
18869
|
+
const sdkVersion = true ? "1.3.4" : "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.
|
|
997
|
+
const sdkVersion = true ? "1.3.4" : "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
|
@@ -22036,9 +22036,11 @@ This message will not appear once Glasstrace is added to your provider config.`
|
|
|
22036
22036
|
}
|
|
22037
22037
|
function emitGuidanceMessage() {
|
|
22038
22038
|
const isSentry = detectSentry();
|
|
22039
|
+
const isProduction = typeof process !== "undefined" && process.env?.NODE_ENV === "production";
|
|
22040
|
+
const level = isProduction ? "error" : "warn";
|
|
22039
22041
|
if (isSentry) {
|
|
22040
22042
|
sdkLog(
|
|
22041
|
-
|
|
22043
|
+
level,
|
|
22042
22044
|
`[glasstrace] An existing OTel TracerProvider is registered but Glasstrace could not auto-attach its span processor.
|
|
22043
22045
|
Add Glasstrace to your Sentry config:
|
|
22044
22046
|
|
|
@@ -22051,7 +22053,7 @@ Add Glasstrace to your Sentry config:
|
|
|
22051
22053
|
);
|
|
22052
22054
|
} else {
|
|
22053
22055
|
sdkLog(
|
|
22054
|
-
|
|
22056
|
+
level,
|
|
22055
22057
|
`[glasstrace] An existing OTel TracerProvider is registered but Glasstrace could not auto-attach its span processor.
|
|
22056
22058
|
Add Glasstrace to your provider configuration:
|
|
22057
22059
|
|
|
@@ -22178,11 +22180,27 @@ async function runCoexistencePath(existingProvider, config2) {
|
|
|
22178
22180
|
setOtelState(OtelState.COEXISTENCE_FAILED);
|
|
22179
22181
|
emitLifecycleEvent("otel:configured", { state: OtelState.COEXISTENCE_FAILED, scenario: "C/F" });
|
|
22180
22182
|
emitLifecycleEvent("otel:injection_failed", { reason: "provider internals inaccessible" });
|
|
22183
|
+
emitLifecycleEvent("otel:failed", {
|
|
22184
|
+
category: "auto-attach-returned-null",
|
|
22185
|
+
message: "tryAutoAttachGlasstraceProcessor returned null \u2014 the existing OTel TracerProvider exposed no injection point. Spans are not reaching the Glasstrace exporter. Apply the manual createGlasstraceSpanProcessor() workaround documented in the SDK README.",
|
|
22186
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22187
|
+
providerClass: readProviderClass(existingProvider)
|
|
22188
|
+
});
|
|
22181
22189
|
const coreState = getCoreState();
|
|
22182
22190
|
if (coreState === CoreState.ACTIVE || coreState === CoreState.KEY_RESOLVED) {
|
|
22183
22191
|
setCoreState(CoreState.ACTIVE_DEGRADED);
|
|
22184
22192
|
}
|
|
22185
22193
|
}
|
|
22194
|
+
function readProviderClass(tracerProvider) {
|
|
22195
|
+
try {
|
|
22196
|
+
const proxy = tracerProvider;
|
|
22197
|
+
const delegate = typeof proxy.getDelegate === "function" ? proxy.getDelegate() : tracerProvider;
|
|
22198
|
+
const name = delegate?.constructor?.name;
|
|
22199
|
+
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
22200
|
+
} catch {
|
|
22201
|
+
return void 0;
|
|
22202
|
+
}
|
|
22203
|
+
}
|
|
22186
22204
|
async function runRegistrationPath(config2, sessionManager) {
|
|
22187
22205
|
const exporterUrl = `${config2.endpoint}/v1/traces`;
|
|
22188
22206
|
const createOtlpExporter = (url2, headers) => new OTLPTraceExporter({ url: url2, headers });
|
|
@@ -22485,6 +22503,7 @@ init_console_capture();
|
|
|
22485
22503
|
var _projectRoot = null;
|
|
22486
22504
|
var _sdkVersion = "unknown";
|
|
22487
22505
|
var _lastScenario;
|
|
22506
|
+
var _lastError;
|
|
22488
22507
|
var _debounceTimer = null;
|
|
22489
22508
|
var _started = false;
|
|
22490
22509
|
function startRuntimeStateWriter(options) {
|
|
@@ -22507,6 +22526,10 @@ function startRuntimeStateWriter(options) {
|
|
|
22507
22526
|
_lastScenario = scenario;
|
|
22508
22527
|
debouncedWrite();
|
|
22509
22528
|
});
|
|
22529
|
+
onLifecycleEvent("otel:failed", (payload) => {
|
|
22530
|
+
_lastError = { ...payload };
|
|
22531
|
+
debouncedWrite();
|
|
22532
|
+
});
|
|
22510
22533
|
onLifecycleEvent("auth:key_resolved", () => debouncedWrite());
|
|
22511
22534
|
onLifecycleEvent("auth:claim_started", () => debouncedWrite());
|
|
22512
22535
|
onLifecycleEvent("auth:claim_completed", () => debouncedWrite());
|
|
@@ -22534,6 +22557,9 @@ function writeStateNow() {
|
|
|
22534
22557
|
auth: { state: state.auth },
|
|
22535
22558
|
otel: { state: state.otel, scenario: _lastScenario }
|
|
22536
22559
|
};
|
|
22560
|
+
if (_lastError) {
|
|
22561
|
+
runtimeState.lastError = _lastError;
|
|
22562
|
+
}
|
|
22537
22563
|
const dir = (0, import_node_path.join)(_projectRoot, ".glasstrace");
|
|
22538
22564
|
const filePath = (0, import_node_path.join)(dir, "runtime-state.json");
|
|
22539
22565
|
(0, import_node_fs.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
@@ -22578,7 +22604,7 @@ function registerGlasstrace(options) {
|
|
|
22578
22604
|
setCoreState(CoreState.REGISTERING);
|
|
22579
22605
|
startRuntimeStateWriter({
|
|
22580
22606
|
projectRoot: process.cwd(),
|
|
22581
|
-
sdkVersion: "1.3.
|
|
22607
|
+
sdkVersion: "1.3.4"
|
|
22582
22608
|
});
|
|
22583
22609
|
const config2 = resolveConfig(options);
|
|
22584
22610
|
if (config2.verbose) {
|
|
@@ -22744,8 +22770,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22744
22770
|
if (config2.verbose) {
|
|
22745
22771
|
console.info("[glasstrace] Background init firing.");
|
|
22746
22772
|
}
|
|
22747
|
-
const healthReport = collectHealthReport("1.3.
|
|
22748
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.3.
|
|
22773
|
+
const healthReport = collectHealthReport("1.3.4");
|
|
22774
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.3.4", healthReport);
|
|
22749
22775
|
if (generation !== registrationGeneration) return;
|
|
22750
22776
|
const currentState = getCoreState();
|
|
22751
22777
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -22768,7 +22794,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22768
22794
|
}
|
|
22769
22795
|
maybeInstallConsoleCapture();
|
|
22770
22796
|
if (didLastInitSucceed()) {
|
|
22771
|
-
startHeartbeat(config2, anonKeyForInit, "1.3.
|
|
22797
|
+
startHeartbeat(config2, anonKeyForInit, "1.3.4", generation, (newApiKey, accountId) => {
|
|
22772
22798
|
setAuthState(AuthState.CLAIMING);
|
|
22773
22799
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
22774
22800
|
setResolvedApiKey(newApiKey);
|