@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/index.d.cts
CHANGED
|
@@ -351,6 +351,25 @@ declare function waitForReady(timeoutMs?: number): Promise<void>;
|
|
|
351
351
|
/**
|
|
352
352
|
* Simplified public state query for external consumers.
|
|
353
353
|
* Hides implementation details like coexistence scenarios.
|
|
354
|
+
*
|
|
355
|
+
* The returned `tracing` field is the canonical user-observable signal
|
|
356
|
+
* for OTel coexistence outcomes:
|
|
357
|
+
*
|
|
358
|
+
* - `"active"` — the SDK owns the OTel provider and is exporting spans.
|
|
359
|
+
* - `"coexistence"` — another OTel provider was detected and the SDK
|
|
360
|
+
* either auto-attached its span processor or found one already
|
|
361
|
+
* present. Spans are exported through the existing pipeline.
|
|
362
|
+
* - `"degraded"` — the SDK is exporting but the core lifecycle entered
|
|
363
|
+
* `ACTIVE_DEGRADED` (e.g., a non-fatal export failure).
|
|
364
|
+
* - `"not-configured"` — the SDK could not configure tracing. Covers
|
|
365
|
+
* `OtelState.UNCONFIGURED`, `OtelState.CONFIGURING`, and
|
|
366
|
+
* `OtelState.COEXISTENCE_FAILED` (the DISC-1556 Next 16 production
|
|
367
|
+
* "auto-attach returned null" path). When the value is
|
|
368
|
+
* `"not-configured"` after `registerGlasstrace()` has resolved,
|
|
369
|
+
* spans are NOT reaching the Glasstrace exporter and the manual
|
|
370
|
+
* `createGlasstraceSpanProcessor()` workaround should be applied.
|
|
371
|
+
* See `runtime-state.json`'s `lastError` field for the structured
|
|
372
|
+
* failure record.
|
|
354
373
|
*/
|
|
355
374
|
declare function getStatus(): {
|
|
356
375
|
ready: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -351,6 +351,25 @@ declare function waitForReady(timeoutMs?: number): Promise<void>;
|
|
|
351
351
|
/**
|
|
352
352
|
* Simplified public state query for external consumers.
|
|
353
353
|
* Hides implementation details like coexistence scenarios.
|
|
354
|
+
*
|
|
355
|
+
* The returned `tracing` field is the canonical user-observable signal
|
|
356
|
+
* for OTel coexistence outcomes:
|
|
357
|
+
*
|
|
358
|
+
* - `"active"` — the SDK owns the OTel provider and is exporting spans.
|
|
359
|
+
* - `"coexistence"` — another OTel provider was detected and the SDK
|
|
360
|
+
* either auto-attached its span processor or found one already
|
|
361
|
+
* present. Spans are exported through the existing pipeline.
|
|
362
|
+
* - `"degraded"` — the SDK is exporting but the core lifecycle entered
|
|
363
|
+
* `ACTIVE_DEGRADED` (e.g., a non-fatal export failure).
|
|
364
|
+
* - `"not-configured"` — the SDK could not configure tracing. Covers
|
|
365
|
+
* `OtelState.UNCONFIGURED`, `OtelState.CONFIGURING`, and
|
|
366
|
+
* `OtelState.COEXISTENCE_FAILED` (the DISC-1556 Next 16 production
|
|
367
|
+
* "auto-attach returned null" path). When the value is
|
|
368
|
+
* `"not-configured"` after `registerGlasstrace()` has resolved,
|
|
369
|
+
* spans are NOT reaching the Glasstrace exporter and the manual
|
|
370
|
+
* `createGlasstraceSpanProcessor()` workaround should be applied.
|
|
371
|
+
* See `runtime-state.json`'s `lastError` field for the structured
|
|
372
|
+
* failure record.
|
|
354
373
|
*/
|
|
355
374
|
declare function getStatus(): {
|
|
356
375
|
ready: boolean;
|
package/dist/index.js
CHANGED
package/dist/node-entry.cjs
CHANGED
|
@@ -22112,9 +22112,11 @@ This message will not appear once Glasstrace is added to your provider config.`
|
|
|
22112
22112
|
}
|
|
22113
22113
|
function emitGuidanceMessage() {
|
|
22114
22114
|
const isSentry = detectSentry();
|
|
22115
|
+
const isProduction = typeof process !== "undefined" && process.env?.NODE_ENV === "production";
|
|
22116
|
+
const level = isProduction ? "error" : "warn";
|
|
22115
22117
|
if (isSentry) {
|
|
22116
22118
|
sdkLog(
|
|
22117
|
-
|
|
22119
|
+
level,
|
|
22118
22120
|
`[glasstrace] An existing OTel TracerProvider is registered but Glasstrace could not auto-attach its span processor.
|
|
22119
22121
|
Add Glasstrace to your Sentry config:
|
|
22120
22122
|
|
|
@@ -22127,7 +22129,7 @@ Add Glasstrace to your Sentry config:
|
|
|
22127
22129
|
);
|
|
22128
22130
|
} else {
|
|
22129
22131
|
sdkLog(
|
|
22130
|
-
|
|
22132
|
+
level,
|
|
22131
22133
|
`[glasstrace] An existing OTel TracerProvider is registered but Glasstrace could not auto-attach its span processor.
|
|
22132
22134
|
Add Glasstrace to your provider configuration:
|
|
22133
22135
|
|
|
@@ -22254,11 +22256,27 @@ async function runCoexistencePath(existingProvider, config2) {
|
|
|
22254
22256
|
setOtelState(OtelState.COEXISTENCE_FAILED);
|
|
22255
22257
|
emitLifecycleEvent("otel:configured", { state: OtelState.COEXISTENCE_FAILED, scenario: "C/F" });
|
|
22256
22258
|
emitLifecycleEvent("otel:injection_failed", { reason: "provider internals inaccessible" });
|
|
22259
|
+
emitLifecycleEvent("otel:failed", {
|
|
22260
|
+
category: "auto-attach-returned-null",
|
|
22261
|
+
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.",
|
|
22262
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22263
|
+
providerClass: readProviderClass(existingProvider)
|
|
22264
|
+
});
|
|
22257
22265
|
const coreState = getCoreState();
|
|
22258
22266
|
if (coreState === CoreState.ACTIVE || coreState === CoreState.KEY_RESOLVED) {
|
|
22259
22267
|
setCoreState(CoreState.ACTIVE_DEGRADED);
|
|
22260
22268
|
}
|
|
22261
22269
|
}
|
|
22270
|
+
function readProviderClass(tracerProvider) {
|
|
22271
|
+
try {
|
|
22272
|
+
const proxy = tracerProvider;
|
|
22273
|
+
const delegate = typeof proxy.getDelegate === "function" ? proxy.getDelegate() : tracerProvider;
|
|
22274
|
+
const name = delegate?.constructor?.name;
|
|
22275
|
+
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
22276
|
+
} catch {
|
|
22277
|
+
return void 0;
|
|
22278
|
+
}
|
|
22279
|
+
}
|
|
22262
22280
|
async function runRegistrationPath(config2, sessionManager) {
|
|
22263
22281
|
const exporterUrl = `${config2.endpoint}/v1/traces`;
|
|
22264
22282
|
const createOtlpExporter = (url2, headers) => new OTLPTraceExporter({ url: url2, headers });
|
|
@@ -22561,6 +22579,7 @@ init_console_capture();
|
|
|
22561
22579
|
var _projectRoot = null;
|
|
22562
22580
|
var _sdkVersion = "unknown";
|
|
22563
22581
|
var _lastScenario;
|
|
22582
|
+
var _lastError;
|
|
22564
22583
|
var _debounceTimer = null;
|
|
22565
22584
|
var _started = false;
|
|
22566
22585
|
function startRuntimeStateWriter(options) {
|
|
@@ -22583,6 +22602,10 @@ function startRuntimeStateWriter(options) {
|
|
|
22583
22602
|
_lastScenario = scenario;
|
|
22584
22603
|
debouncedWrite();
|
|
22585
22604
|
});
|
|
22605
|
+
onLifecycleEvent("otel:failed", (payload) => {
|
|
22606
|
+
_lastError = { ...payload };
|
|
22607
|
+
debouncedWrite();
|
|
22608
|
+
});
|
|
22586
22609
|
onLifecycleEvent("auth:key_resolved", () => debouncedWrite());
|
|
22587
22610
|
onLifecycleEvent("auth:claim_started", () => debouncedWrite());
|
|
22588
22611
|
onLifecycleEvent("auth:claim_completed", () => debouncedWrite());
|
|
@@ -22610,6 +22633,9 @@ function writeStateNow() {
|
|
|
22610
22633
|
auth: { state: state.auth },
|
|
22611
22634
|
otel: { state: state.otel, scenario: _lastScenario }
|
|
22612
22635
|
};
|
|
22636
|
+
if (_lastError) {
|
|
22637
|
+
runtimeState.lastError = _lastError;
|
|
22638
|
+
}
|
|
22613
22639
|
const dir = (0, import_node_path.join)(_projectRoot, ".glasstrace");
|
|
22614
22640
|
const filePath = (0, import_node_path.join)(dir, "runtime-state.json");
|
|
22615
22641
|
(0, import_node_fs.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
@@ -22654,7 +22680,7 @@ function registerGlasstrace(options) {
|
|
|
22654
22680
|
setCoreState(CoreState.REGISTERING);
|
|
22655
22681
|
startRuntimeStateWriter({
|
|
22656
22682
|
projectRoot: process.cwd(),
|
|
22657
|
-
sdkVersion: "1.3.
|
|
22683
|
+
sdkVersion: "1.3.4"
|
|
22658
22684
|
});
|
|
22659
22685
|
const config2 = resolveConfig(options);
|
|
22660
22686
|
if (config2.verbose) {
|
|
@@ -22820,8 +22846,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22820
22846
|
if (config2.verbose) {
|
|
22821
22847
|
console.info("[glasstrace] Background init firing.");
|
|
22822
22848
|
}
|
|
22823
|
-
const healthReport = collectHealthReport("1.3.
|
|
22824
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.3.
|
|
22849
|
+
const healthReport = collectHealthReport("1.3.4");
|
|
22850
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.3.4", healthReport);
|
|
22825
22851
|
if (generation !== registrationGeneration) return;
|
|
22826
22852
|
const currentState = getCoreState();
|
|
22827
22853
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -22844,7 +22870,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22844
22870
|
}
|
|
22845
22871
|
maybeInstallConsoleCapture();
|
|
22846
22872
|
if (didLastInitSucceed()) {
|
|
22847
|
-
startHeartbeat(config2, anonKeyForInit, "1.3.
|
|
22873
|
+
startHeartbeat(config2, anonKeyForInit, "1.3.4", generation, (newApiKey, accountId) => {
|
|
22848
22874
|
setAuthState(AuthState.CLAIMING);
|
|
22849
22875
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
22850
22876
|
setResolvedApiKey(newApiKey);
|