@sailfish-ai/sf-veritas 0.2.11 → 0.2.13
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/contextManager-BkETRITg.cjs +1 -0
- package/dist/plugins/funcspanEsbuildPlugin.cjs +1 -1
- package/dist/plugins/funcspanEsbuildPlugin.mjs +1 -1
- package/dist/plugins/funcspanRollupPlugin.cjs +1 -1
- package/dist/plugins/funcspanRollupPlugin.mjs +1 -1
- package/dist/plugins/funcspanTscPlugin.cjs +1 -1
- package/dist/plugins/funcspanTscPlugin.mjs +1 -1
- package/dist/plugins/funcspanVitePlugin.cjs +1 -1
- package/dist/plugins/funcspanVitePlugin.mjs +1 -1
- package/dist/plugins/funcspanWebpackPlugin.cjs +1 -1
- package/dist/plugins/funcspanWebpackPlugin.mjs +1 -1
- package/dist/{runtimeConfig-emBNO3lJ.js → runtimeConfig-CgLfwL3X.js} +2 -2
- package/dist/{runtimeConfig-CpQ27dZD.cjs → runtimeConfig-DIsq-KCn.cjs} +6 -6
- package/dist/sf-veritas.cjs +11 -11
- package/dist/sf-veritas.mjs +28 -29
- package/dist/worker-pool-capture.cjs +1 -1
- package/dist/worker-pool-capture.mjs +1 -1
- package/dist/{workerPoolSpanCapture-B5KN-q4b.js → workerPoolSpanCapture-BYaf3NOr.js} +138 -151
- package/dist/workerPoolSpanCapture-D85i6nhQ.cjs +83 -0
- package/package.json +6 -2
- package/dist/contextManager-CGINtRN5.cjs +0 -1
- package/dist/workerPoolSpanCapture-Dg_WGjmO.cjs +0 -86
package/dist/sf-veritas.mjs
CHANGED
|
@@ -3,18 +3,18 @@ var fe = (n, e, t) => e in n ? pe(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var S = (n, e, t) => fe(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { g as l, C as J, D as he, v as ie, b as q, c as ge, a as ae } from "./contextManager-CEPhVu9T.js";
|
|
5
5
|
import { r as ft } from "./contextManager-CEPhVu9T.js";
|
|
6
|
-
import { B as D, n as F, f as me, g as ce, p as de, a as le, b as Se, m as P, c as R, d as ye, i as C, t as M, F as Ie } from "./workerPoolSpanCapture-
|
|
7
|
-
import { e as gt, s as mt } from "./workerPoolSpanCapture-
|
|
8
|
-
import { C as _e, i as _, a as
|
|
9
|
-
import {
|
|
6
|
+
import { B as D, n as F, f as me, g as ce, p as de, a as le, b as Se, m as P, c as R, d as ye, i as C, t as M, F as Ie } from "./workerPoolSpanCapture-BYaf3NOr.js";
|
|
7
|
+
import { e as gt, s as mt } from "./workerPoolSpanCapture-BYaf3NOr.js";
|
|
8
|
+
import { C as _e, i as _, a as ve, h as b, b as $e, c as be } from "./runtimeConfig-CgLfwL3X.js";
|
|
9
|
+
import { d as yt, e as It, s as _t } from "./runtimeConfig-CgLfwL3X.js";
|
|
10
10
|
import { createRequire as Fe } from "node:module";
|
|
11
11
|
import * as H from "fs";
|
|
12
12
|
import { readFileSync as Ne, appendFileSync as De } from "fs";
|
|
13
13
|
import { s as we } from "./source-map-Cr6YkjTd.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as v from "path";
|
|
15
15
|
import { glob as Ee } from "glob";
|
|
16
16
|
import { threadId as T } from "worker_threads";
|
|
17
|
-
import { s as
|
|
17
|
+
import { s as $t, t as bt, a as Ft } from "./funcSpanTransformer-CWNEWRxq.js";
|
|
18
18
|
class E extends D {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.setOperationName("IdentifyServiceDetails");
|
|
@@ -225,7 +225,7 @@ function Re() {
|
|
|
225
225
|
try {
|
|
226
226
|
e = Ue("node:http"), n && _("[patchNodeHttpInbound] node:http required successfully.");
|
|
227
227
|
} catch (r) {
|
|
228
|
-
return void
|
|
228
|
+
return void ve("Failed to require node:http:", r);
|
|
229
229
|
}
|
|
230
230
|
if (!e?.Server?.prototype) return void (n && _("[patchNodeHttpInbound] http.Server.prototype not found."));
|
|
231
231
|
const t = e.Server.prototype, s = t.emit;
|
|
@@ -456,8 +456,8 @@ class ke {
|
|
|
456
456
|
this.addTracingHeaders(u, c), m = await s(c, h), f && K.includes(m.status) ? (m = await s(c, { ...o, headers: u }), p = !0, this.captureFirstUserLines(e, 10, p)) : this.contextManager.addSupportedDomains(a);
|
|
457
457
|
const g = Date.now();
|
|
458
458
|
l().sfDebug && console.log(`[RequestInterceptor] Fetch completed: ${c}, Status: ${m.status}, Duration: ${g - i}ms`);
|
|
459
|
-
const { sessionId: y, pageVisitId: I, requestId:
|
|
460
|
-
return t.doSend({ apiKey: l().apiKey, requestId:
|
|
459
|
+
const { sessionId: y, pageVisitId: I, requestId: $ } = this.extractIdsFromTraceHeader(d);
|
|
460
|
+
return t.doSend({ apiKey: l().apiKey, requestId: $, pageVisitId: I, recordingSessionId: y, serviceUuid: l().serviceUUID, timestampStart: i.toString(), timestampEnd: g.toString(), responseCode: m.status, success: !0, error: null, url: c, method: h.method || "GET", retryWithoutTraceId: p, parentSpanId: q() }), m;
|
|
461
461
|
} catch (p) {
|
|
462
462
|
const g = Date.now();
|
|
463
463
|
l().sfDebug && console.error(`[RequestInterceptor] Fetch failed: ${c}, Error: ${p}, Duration: ${g - i}ms`);
|
|
@@ -520,9 +520,8 @@ class ke {
|
|
|
520
520
|
}
|
|
521
521
|
tryPatch(e, t) {
|
|
522
522
|
try {
|
|
523
|
-
require.resolve(t), e()
|
|
524
|
-
} catch
|
|
525
|
-
console.warn(`[RequestInterceptor] Could not patch ${t}: ${s.message}`);
|
|
523
|
+
require.resolve(t), e();
|
|
524
|
+
} catch {
|
|
526
525
|
}
|
|
527
526
|
}
|
|
528
527
|
getExcludedDomains() {
|
|
@@ -581,7 +580,7 @@ class Me {
|
|
|
581
580
|
await this._resolveInheritance(), this.debug && console.log(`[FuncSpan ConfigLoader] Loaded ${this.fileConfigs.size} file configs, ${this.functionConfigs.size} function configs`);
|
|
582
581
|
}
|
|
583
582
|
getConfig(e, t) {
|
|
584
|
-
const s = this.hasSailfishFiles ? le() : Se(), r = this._getDirectoryConfig(e), o =
|
|
583
|
+
const s = this.hasSailfishFiles ? le() : Se(), r = this._getDirectoryConfig(e), o = v.normalize(e), d = this.fileConfigs.get(o) || {};
|
|
585
584
|
let i = {};
|
|
586
585
|
if (t) {
|
|
587
586
|
const c = this.functionConfigs.get(o);
|
|
@@ -596,7 +595,7 @@ class Me {
|
|
|
596
595
|
try {
|
|
597
596
|
const s = H.readdirSync(e, { withFileTypes: !0 });
|
|
598
597
|
for (const r of s) {
|
|
599
|
-
const o =
|
|
598
|
+
const o = v.join(e, r.name);
|
|
600
599
|
r.isFile() && r.name === ".sailfish" ? t.push(o) : r.name === "node_modules" || r.isDirectory() && r.name.startsWith(".") && r.name !== ".sailfish" || r.isDirectory() && await this._walkDirectory(o, t);
|
|
601
600
|
}
|
|
602
601
|
} catch (s) {
|
|
@@ -605,7 +604,7 @@ class Me {
|
|
|
605
604
|
}
|
|
606
605
|
async _loadConfigFile(e) {
|
|
607
606
|
try {
|
|
608
|
-
const t = H.readFileSync(e, "utf-8"), s =
|
|
607
|
+
const t = H.readFileSync(e, "utf-8"), s = v.dirname(e);
|
|
609
608
|
let r = null;
|
|
610
609
|
try {
|
|
611
610
|
r = JSON.parse(t);
|
|
@@ -624,10 +623,10 @@ class Me {
|
|
|
624
623
|
}
|
|
625
624
|
async _expandFileGlobs(e, t, s) {
|
|
626
625
|
for (const [r, o] of Object.entries(t)) try {
|
|
627
|
-
const d =
|
|
626
|
+
const d = v.join(e, r), i = await Ee(d, { absolute: !0, nodir: !0, ignore: ["**/node_modules/**", "**/.git/**"] });
|
|
628
627
|
this.debug && console.log(`[FuncSpan ConfigLoader] Pattern '${r}' matched ${i.length} files`);
|
|
629
628
|
for (const c of i) {
|
|
630
|
-
const a =
|
|
629
|
+
const a = v.normalize(c), u = P(s, o);
|
|
631
630
|
this.fileConfigs.set(a, u), this.debug && i.length <= 5 && console.log(`[FuncSpan ConfigLoader] - ${c}`);
|
|
632
631
|
}
|
|
633
632
|
} catch (d) {
|
|
@@ -641,7 +640,7 @@ class Me {
|
|
|
641
640
|
this.debug && console.warn(`[FuncSpan ConfigLoader] Invalid function pattern '${r}' (expected format: 'file.ts::functionName')`);
|
|
642
641
|
continue;
|
|
643
642
|
}
|
|
644
|
-
const [i, c] = d, a =
|
|
643
|
+
const [i, c] = d, a = v.normalize(v.join(e, i));
|
|
645
644
|
this.functionConfigs.has(a) || this.functionConfigs.set(a, /* @__PURE__ */ new Map());
|
|
646
645
|
const u = this.functionConfigs.get(a), f = P(s, o);
|
|
647
646
|
u.set(c, f), this.debug && console.log(`[FuncSpan ConfigLoader] Function config: ${a}::${c}`);
|
|
@@ -650,11 +649,11 @@ class Me {
|
|
|
650
649
|
async _resolveInheritance() {
|
|
651
650
|
}
|
|
652
651
|
_getDirectoryConfig(e) {
|
|
653
|
-
let t =
|
|
652
|
+
let t = v.dirname(v.normalize(e));
|
|
654
653
|
const s = [];
|
|
655
|
-
for (; t && t !==
|
|
654
|
+
for (; t && t !== v.dirname(t); ) {
|
|
656
655
|
const r = this.directoryConfigs.get(t);
|
|
657
|
-
r && s.unshift(r), t =
|
|
656
|
+
r && s.unshift(r), t = v.dirname(t);
|
|
658
657
|
}
|
|
659
658
|
return s.reduce((r, o) => P(r, o), {});
|
|
660
659
|
}
|
|
@@ -797,7 +796,7 @@ function ot(n) {
|
|
|
797
796
|
e.sfDebug && console.error("[FuncSpan] Failed to initialize config loader:", r);
|
|
798
797
|
}), process.env.SF_WORKER_POOL_DISABLED === "true" ? e.sfDebug && console.log("[setupInterceptors] Worker pool patching DISABLED (SF_WORKER_POOL_DISABLED=true)") : Ve() || (Je(), e.sfDebug && console.log("[setupInterceptors] Worker pool patching initialized (DNS tracking enabled)"));
|
|
799
798
|
const t = new V();
|
|
800
|
-
t.setServiceUUID(e.serviceUUID),
|
|
799
|
+
t.setServiceUUID(e.serviceUUID), $e(t), (function(r = []) {
|
|
801
800
|
const o = new ke(r);
|
|
802
801
|
new Ae().doSend(o.getExcludedDomains());
|
|
803
802
|
const d = new Oe(), i = new Le();
|
|
@@ -829,8 +828,8 @@ function dt(n, e, t, s) {
|
|
|
829
828
|
const c = (function(g, y) {
|
|
830
829
|
const I = ce();
|
|
831
830
|
if (I) {
|
|
832
|
-
const
|
|
833
|
-
if (
|
|
831
|
+
const $ = de(I);
|
|
832
|
+
if ($) return process.env.SF_DEBUG === "true" && console.log(`[FuncSpan] Using HTTP header override for ${g}::${y}`), $;
|
|
834
833
|
}
|
|
835
834
|
try {
|
|
836
835
|
return xe(g, y);
|
|
@@ -858,12 +857,12 @@ function dt(n, e, t, s) {
|
|
|
858
857
|
const O = process.hrtime.bigint(), L = Date.now(), k = Number(O - h);
|
|
859
858
|
throw U({ functionName: e, filePath: t, metadata: s, args: p, result: null, error: N?.message || String(N), duration: L - m, durationNs: k, startTimeNs: h.toString(), async: !0, spanId: f, parentSpanId: u, pid: process.pid, threadId: T }), N;
|
|
860
859
|
});
|
|
861
|
-
const y = process.hrtime.bigint(), I = Date.now(),
|
|
860
|
+
const y = process.hrtime.bigint(), I = Date.now(), $ = Number(y - h);
|
|
862
861
|
let Q = null;
|
|
863
|
-
return c.capture_return_value && c.return_limit_mb > 0 && (Q = M(g, c.return_limit_mb)), U({ functionName: e, filePath: t, metadata: s, args: p, result: Q, error: null, duration: I - m, durationNs:
|
|
862
|
+
return c.capture_return_value && c.return_limit_mb > 0 && (Q = M(g, c.return_limit_mb)), U({ functionName: e, filePath: t, metadata: s, args: p, result: Q, error: null, duration: I - m, durationNs: $, startTimeNs: h.toString(), async: !1, spanId: f, parentSpanId: u, pid: process.pid, threadId: T }), u ? a.setCurrentFunctionSpanId(u) : a.clearCurrentFunctionSpanId(), g;
|
|
864
863
|
} catch (g) {
|
|
865
|
-
const y = process.hrtime.bigint(), I = Date.now(),
|
|
866
|
-
throw U({ functionName: e, filePath: t, metadata: s, args: p, result: null, error: g?.message || String(g), duration: I - m, durationNs:
|
|
864
|
+
const y = process.hrtime.bigint(), I = Date.now(), $ = Number(y - h);
|
|
865
|
+
throw U({ functionName: e, filePath: t, metadata: s, args: p, result: null, error: g?.message || String(g), duration: I - m, durationNs: $, startTimeNs: h.toString(), async: !1, spanId: f, parentSpanId: u, pid: process.pid, threadId: T }), u ? a.setCurrentFunctionSpanId(u) : a.clearCurrentFunctionSpanId(), g;
|
|
867
866
|
}
|
|
868
867
|
};
|
|
869
868
|
Object.defineProperty(r, "name", { value: e, writable: !1 });
|
|
@@ -915,7 +914,7 @@ export {
|
|
|
915
914
|
de as parseHeaderOverride,
|
|
916
915
|
ft as runWithContext,
|
|
917
916
|
mt as setFuncspanOverride,
|
|
918
|
-
|
|
917
|
+
$t as setSkipTypeScriptPlugin,
|
|
919
918
|
ot as setupInterceptors,
|
|
920
919
|
_t as shouldEnableRuntimeHooks,
|
|
921
920
|
bt as transformFunctionSpans,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./workerPoolSpanCapture-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./workerPoolSpanCapture-D85i6nhQ.cjs");exports.captureWorkerPoolOperation=e.captureWorkerPoolOperation;
|