@glasstrace/sdk 1.2.1 → 1.3.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/README.md +47 -0
- package/dist/{chunk-CTJO7PUZ.js → chunk-5PFPEA4C.js} +75 -9
- package/dist/chunk-5PFPEA4C.js.map +1 -0
- package/dist/{chunk-2GCN27SI.js → chunk-CRM3EYOL.js} +2 -2
- package/dist/{chunk-MD5XPCTQ.js → chunk-DW2UJUNB.js} +2 -2
- package/dist/chunk-DW2UJUNB.js.map +1 -0
- package/dist/{chunk-YMLMZCPR.js → chunk-JFR42QG5.js} +2 -2
- package/dist/{chunk-EBYISKQP.js → chunk-MQHLWSIX.js} +2 -1
- package/dist/{chunk-EBYISKQP.js.map → chunk-MQHLWSIX.js.map} +1 -1
- package/dist/{chunk-NFPDYME5.js → chunk-USLH3OTM.js} +3 -3
- package/dist/{chunk-NFPDYME5.js.map → chunk-USLH3OTM.js.map} +1 -1
- package/dist/{chunk-HV5ID2WJ.js → chunk-X4IK6KES.js} +3 -3
- package/dist/{chunk-47B2G3FE.js → chunk-XS3BO7RY.js} +2 -2
- package/dist/cli/init.cjs +1 -1
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +6 -6
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +2 -2
- package/dist/cli/uninit.cjs.map +1 -1
- package/dist/cli/uninit.js +3 -3
- package/dist/cli/validate.cjs.map +1 -1
- package/dist/cli/validate.js +2 -2
- package/dist/{edge-entry-DYl05SJ-.d.cts → edge-entry-DT9OhPTC.d.cts} +1 -1
- package/dist/{edge-entry-CFq085RZ.d.ts → edge-entry-shCc8_Y1.d.ts} +1 -1
- package/dist/edge-entry.cjs +1 -0
- package/dist/edge-entry.cjs.map +1 -1
- package/dist/edge-entry.d.cts +2 -2
- package/dist/edge-entry.d.ts +2 -2
- package/dist/edge-entry.js +2 -2
- package/dist/index.cjs +74 -4
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-CYYe3PxB.d.cts → index.d-DiI6uVEW.d.cts} +1 -1
- package/dist/{index.d-CYYe3PxB.d.ts → index.d-DiI6uVEW.d.ts} +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/node-entry.cjs +74 -4
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.d.cts +2 -2
- package/dist/node-entry.d.ts +2 -2
- package/dist/node-entry.js +7 -7
- package/dist/node-subpath.cjs.map +1 -1
- package/dist/node-subpath.d.cts +1 -1
- package/dist/node-subpath.d.ts +1 -1
- package/dist/node-subpath.js +3 -3
- package/dist/{source-map-uploader-RA4Z7TWA.js → source-map-uploader-LACAGKIW.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-CTJO7PUZ.js.map +0 -1
- package/dist/chunk-MD5XPCTQ.js.map +0 -1
- /package/dist/{chunk-2GCN27SI.js.map → chunk-CRM3EYOL.js.map} +0 -0
- /package/dist/{chunk-YMLMZCPR.js.map → chunk-JFR42QG5.js.map} +0 -0
- /package/dist/{chunk-HV5ID2WJ.js.map → chunk-X4IK6KES.js.map} +0 -0
- /package/dist/{chunk-47B2G3FE.js.map → chunk-XS3BO7RY.js.map} +0 -0
- /package/dist/{source-map-uploader-RA4Z7TWA.js.map → source-map-uploader-LACAGKIW.js.map} +0 -0
package/dist/edge-entry.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './edge-entry-
|
|
2
|
-
import './index.d-
|
|
1
|
+
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './edge-entry-DT9OhPTC.cjs';
|
|
2
|
+
import './index.d-DiI6uVEW.cjs';
|
|
3
3
|
import './v4/classic/external.cjs';
|
|
4
4
|
import './export/ReadableSpan';
|
|
5
5
|
import './Span';
|
package/dist/edge-entry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './edge-entry-
|
|
2
|
-
import './index.d-
|
|
1
|
+
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './edge-entry-shCc8_Y1.js';
|
|
2
|
+
import './index.d-DiI6uVEW.js';
|
|
3
3
|
import './v4/classic/external.cjs';
|
|
4
4
|
import './export/ReadableSpan';
|
|
5
5
|
import './Span';
|
package/dist/edge-entry.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
GlasstraceSpanProcessor,
|
|
3
3
|
SdkError,
|
|
4
4
|
captureCorrelationId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CRM3EYOL.js";
|
|
6
6
|
import "./chunk-DQ25VOKK.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-MQHLWSIX.js";
|
|
8
8
|
import "./chunk-NSBPE2FW.js";
|
|
9
9
|
export {
|
|
10
10
|
GlasstraceSpanProcessor,
|
package/dist/index.cjs
CHANGED
|
@@ -14721,6 +14721,7 @@ var init_dist = __esm({
|
|
|
14721
14721
|
FETCH_DURATION_MS: "glasstrace.fetch.duration_ms",
|
|
14722
14722
|
FETCH_TARGET: "glasstrace.fetch.target",
|
|
14723
14723
|
ENV_REFERENCED: "glasstrace.env.referenced",
|
|
14724
|
+
BUILD_HASH: "glasstrace.build.hash",
|
|
14724
14725
|
SOURCE_FILE: "glasstrace.source.file",
|
|
14725
14726
|
SOURCE_LINE: "glasstrace.source.line",
|
|
14726
14727
|
SOURCE_MAPPED: "glasstrace.source.mapped",
|
|
@@ -18346,6 +18347,19 @@ function prepareErrorResponseBody(body) {
|
|
|
18346
18347
|
return truncateErrorResponseBody(sanitized);
|
|
18347
18348
|
}
|
|
18348
18349
|
|
|
18350
|
+
// src/build-info.ts
|
|
18351
|
+
var UNSET = "";
|
|
18352
|
+
function readBuildHashFromEnv() {
|
|
18353
|
+
const raw = process.env.GLASSTRACE_BUILD_HASH;
|
|
18354
|
+
if (typeof raw !== "string") return UNSET;
|
|
18355
|
+
const trimmed = raw.trim();
|
|
18356
|
+
return trimmed.length > 0 ? trimmed : UNSET;
|
|
18357
|
+
}
|
|
18358
|
+
var cachedBuildHash = readBuildHashFromEnv();
|
|
18359
|
+
function getBuildHash() {
|
|
18360
|
+
return cachedBuildHash === UNSET ? void 0 : cachedBuildHash;
|
|
18361
|
+
}
|
|
18362
|
+
|
|
18349
18363
|
// src/enriching-exporter.ts
|
|
18350
18364
|
var ATTR = GLASSTRACE_ATTRIBUTE_NAMES;
|
|
18351
18365
|
var API_KEY_PENDING = "pending";
|
|
@@ -18461,6 +18475,10 @@ var GlasstraceExporter = class {
|
|
|
18461
18475
|
if (env) {
|
|
18462
18476
|
extra[ATTR.ENVIRONMENT] = env;
|
|
18463
18477
|
}
|
|
18478
|
+
const buildHash = getBuildHash();
|
|
18479
|
+
if (buildHash) {
|
|
18480
|
+
extra[ATTR.BUILD_HASH] = buildHash;
|
|
18481
|
+
}
|
|
18464
18482
|
const existingCid = attrs["glasstrace.correlation.id"];
|
|
18465
18483
|
if (typeof existingCid === "string") {
|
|
18466
18484
|
extra[ATTR.CORRELATION_ID] = existingCid;
|
|
@@ -22493,7 +22511,7 @@ function registerGlasstrace(options) {
|
|
|
22493
22511
|
setCoreState(CoreState.REGISTERING);
|
|
22494
22512
|
startRuntimeStateWriter({
|
|
22495
22513
|
projectRoot: process.cwd(),
|
|
22496
|
-
sdkVersion: "1.
|
|
22514
|
+
sdkVersion: "1.3.1"
|
|
22497
22515
|
});
|
|
22498
22516
|
const config2 = resolveConfig(options);
|
|
22499
22517
|
if (config2.verbose) {
|
|
@@ -22659,8 +22677,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22659
22677
|
if (config2.verbose) {
|
|
22660
22678
|
console.info("[glasstrace] Background init firing.");
|
|
22661
22679
|
}
|
|
22662
|
-
const healthReport = collectHealthReport("1.
|
|
22663
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.
|
|
22680
|
+
const healthReport = collectHealthReport("1.3.1");
|
|
22681
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.3.1", healthReport);
|
|
22664
22682
|
if (generation !== registrationGeneration) return;
|
|
22665
22683
|
const currentState = getCoreState();
|
|
22666
22684
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -22683,7 +22701,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22683
22701
|
}
|
|
22684
22702
|
maybeInstallConsoleCapture();
|
|
22685
22703
|
if (didLastInitSucceed()) {
|
|
22686
|
-
startHeartbeat(config2, anonKeyForInit, "1.
|
|
22704
|
+
startHeartbeat(config2, anonKeyForInit, "1.3.1", generation, (newApiKey, accountId) => {
|
|
22687
22705
|
setAuthState(AuthState.CLAIMING);
|
|
22688
22706
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
22689
22707
|
setResolvedApiKey(newApiKey);
|
|
@@ -22841,7 +22859,54 @@ async function handleSourceMapUpload(distDir) {
|
|
|
22841
22859
|
|
|
22842
22860
|
// src/capture-error.ts
|
|
22843
22861
|
init_esm();
|
|
22862
|
+
init_dist();
|
|
22844
22863
|
init_error_nudge();
|
|
22864
|
+
|
|
22865
|
+
// src/stack-frame.ts
|
|
22866
|
+
var PAREN_FRAME = /^\s*at\s+(?:[^()]+\s+)?\(([^()\s]+):(\d+):(\d+)\)\s*$/;
|
|
22867
|
+
var BARE_FRAME = /^\s*at\s+(?:async\s+)?([^()\s]+):(\d+):(\d+)\s*$/;
|
|
22868
|
+
var INTERNAL_FRAME_PATTERNS = [
|
|
22869
|
+
/^node:/,
|
|
22870
|
+
/^node:internal\//,
|
|
22871
|
+
/[/\\]node_modules[/\\]@glasstrace[/\\]sdk[/\\]/,
|
|
22872
|
+
/[/\\]packages[/\\]sdk[/\\]src[/\\]capture-error\./,
|
|
22873
|
+
/[/\\]packages[/\\]sdk[/\\]src[/\\]stack-frame\./
|
|
22874
|
+
];
|
|
22875
|
+
function isInternalFrame(file2) {
|
|
22876
|
+
return INTERNAL_FRAME_PATTERNS.some((re2) => re2.test(file2));
|
|
22877
|
+
}
|
|
22878
|
+
function parseTopStackFrame(stack) {
|
|
22879
|
+
if (typeof stack !== "string" || stack.length === 0) return null;
|
|
22880
|
+
let cursor = 0;
|
|
22881
|
+
while (cursor < stack.length) {
|
|
22882
|
+
const newlineAt = stack.indexOf("\n", cursor);
|
|
22883
|
+
const lineEnd = newlineAt === -1 ? stack.length : newlineAt;
|
|
22884
|
+
const line = stack.slice(cursor, lineEnd);
|
|
22885
|
+
cursor = lineEnd + 1;
|
|
22886
|
+
if (!/^\s*at\s/.test(line)) continue;
|
|
22887
|
+
let file2;
|
|
22888
|
+
let lineStr;
|
|
22889
|
+
const parenMatch = PAREN_FRAME.exec(line);
|
|
22890
|
+
if (parenMatch) {
|
|
22891
|
+
file2 = parenMatch[1];
|
|
22892
|
+
lineStr = parenMatch[2];
|
|
22893
|
+
} else {
|
|
22894
|
+
const bareMatch = BARE_FRAME.exec(line);
|
|
22895
|
+
if (bareMatch) {
|
|
22896
|
+
file2 = bareMatch[1];
|
|
22897
|
+
lineStr = bareMatch[2];
|
|
22898
|
+
}
|
|
22899
|
+
}
|
|
22900
|
+
if (!file2 || !lineStr) continue;
|
|
22901
|
+
if (isInternalFrame(file2)) continue;
|
|
22902
|
+
const lineNum = Number.parseInt(lineStr, 10);
|
|
22903
|
+
if (!Number.isFinite(lineNum) || lineNum <= 0) continue;
|
|
22904
|
+
return { file: file2, line: lineNum };
|
|
22905
|
+
}
|
|
22906
|
+
return null;
|
|
22907
|
+
}
|
|
22908
|
+
|
|
22909
|
+
// src/capture-error.ts
|
|
22845
22910
|
function captureError(error48) {
|
|
22846
22911
|
try {
|
|
22847
22912
|
const span = trace.getSpan(context.active());
|
|
@@ -22853,6 +22918,11 @@ function captureError(error48) {
|
|
|
22853
22918
|
attributes["error.type"] = error48.constructor.name;
|
|
22854
22919
|
if (error48.stack) {
|
|
22855
22920
|
attributes["error.stack"] = error48.stack;
|
|
22921
|
+
const frame = parseTopStackFrame(error48.stack);
|
|
22922
|
+
if (frame) {
|
|
22923
|
+
attributes[GLASSTRACE_ATTRIBUTE_NAMES.SOURCE_FILE] = frame.file;
|
|
22924
|
+
attributes[GLASSTRACE_ATTRIBUTE_NAMES.SOURCE_LINE] = frame.line;
|
|
22925
|
+
}
|
|
22856
22926
|
}
|
|
22857
22927
|
}
|
|
22858
22928
|
span.addEvent("glasstrace.error", attributes);
|