@probelabs/probe 0.6.0-rc299 → 0.6.0-rc301
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/bin/binaries/{probe-v0.6.0-rc299-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc301-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-aarch64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc301-aarch64-unknown-linux-musl.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-x86_64-apple-darwin.tar.gz → probe-v0.6.0-rc301-x86_64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-x86_64-pc-windows-msvc.zip → probe-v0.6.0-rc301-x86_64-pc-windows-msvc.zip} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc299-x86_64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc301-x86_64-unknown-linux-musl.tar.gz} +0 -0
- package/build/agent/ProbeAgent.js +16 -3
- package/build/agent/simpleTelemetry.js +25 -3
- package/build/tools/vercel.js +10 -1
- package/cjs/agent/ProbeAgent.cjs +187 -159
- package/cjs/agent/simpleTelemetry.cjs +19 -3
- package/cjs/index.cjs +932 -898
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +16 -3
- package/src/agent/simpleTelemetry.js +25 -3
- package/src/tools/vercel.js +10 -1
|
@@ -22,7 +22,8 @@ var simpleTelemetry_exports = {};
|
|
|
22
22
|
__export(simpleTelemetry_exports, {
|
|
23
23
|
SimpleAppTracer: () => SimpleAppTracer,
|
|
24
24
|
SimpleTelemetry: () => SimpleTelemetry,
|
|
25
|
-
initializeSimpleTelemetryFromOptions: () => initializeSimpleTelemetryFromOptions
|
|
25
|
+
initializeSimpleTelemetryFromOptions: () => initializeSimpleTelemetryFromOptions,
|
|
26
|
+
truncateForSpan: () => truncateForSpan
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(simpleTelemetry_exports);
|
|
28
29
|
var import_fs = require("fs");
|
|
@@ -138,6 +139,14 @@ function patchConsole() {
|
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
// src/agent/simpleTelemetry.js
|
|
142
|
+
function truncateForSpan(text, maxLen = 4096) {
|
|
143
|
+
if (!text || text.length <= maxLen) return text || "";
|
|
144
|
+
const half = Math.floor((maxLen - 40) / 2);
|
|
145
|
+
const omitted = text.length - half * 2;
|
|
146
|
+
return text.substring(0, half) + `
|
|
147
|
+
... [${omitted} chars omitted] ...
|
|
148
|
+
` + text.substring(text.length - half);
|
|
149
|
+
}
|
|
141
150
|
var SimpleTelemetry = class {
|
|
142
151
|
constructor(options = {}) {
|
|
143
152
|
this.serviceName = options.serviceName || "probe-agent";
|
|
@@ -530,7 +539,7 @@ var SimpleAppTracer = class {
|
|
|
530
539
|
"tokens.context_remaining": tokenData.maxContextTokens ? tokenData.maxContextTokens - (tokenData.contextTokens || 0) : null
|
|
531
540
|
});
|
|
532
541
|
}
|
|
533
|
-
async withSpan(spanName, fn, attributes = {}) {
|
|
542
|
+
async withSpan(spanName, fn, attributes = {}, onResult = null) {
|
|
534
543
|
if (!this.isEnabled()) {
|
|
535
544
|
return fn();
|
|
536
545
|
}
|
|
@@ -541,6 +550,12 @@ var SimpleAppTracer = class {
|
|
|
541
550
|
try {
|
|
542
551
|
const result = await fn();
|
|
543
552
|
span.setStatus("OK");
|
|
553
|
+
if (onResult) {
|
|
554
|
+
try {
|
|
555
|
+
onResult(span, result);
|
|
556
|
+
} catch (_) {
|
|
557
|
+
}
|
|
558
|
+
}
|
|
544
559
|
return result;
|
|
545
560
|
} catch (error) {
|
|
546
561
|
span.setStatus("ERROR");
|
|
@@ -578,5 +593,6 @@ function initializeSimpleTelemetryFromOptions(options) {
|
|
|
578
593
|
0 && (module.exports = {
|
|
579
594
|
SimpleAppTracer,
|
|
580
595
|
SimpleTelemetry,
|
|
581
|
-
initializeSimpleTelemetryFromOptions
|
|
596
|
+
initializeSimpleTelemetryFromOptions,
|
|
597
|
+
truncateForSpan
|
|
582
598
|
});
|