@narumitw/pi-otel 0.54.3 → 0.55.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/CHANGELOG.md +14 -0
- package/README.md +5 -2
- package/dist/chunks/{chunk-DSQBXICE.ts → chunk-IXR5MVGN.ts} +12 -6
- package/dist/chunks/chunk-IXR5MVGN.ts.map +7 -0
- package/dist/chunks/{runtime-X3YFJUNH.ts → runtime-KWIFBNQ2.ts} +2 -2
- package/dist/durable-state.d.ts +0 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +3 -4
- package/dist/durable.js.map +2 -2
- package/dist/index.js +11 -7
- package/dist/index.js.map +2 -2
- package/dist/index.ts +12 -8
- package/dist/index.ts.map +2 -2
- package/dist/library-chunks/{chunk-7JGM5RS3.js → chunk-ROM6FIM7.js} +12 -6
- package/dist/library-chunks/chunk-ROM6FIM7.js.map +7 -0
- package/dist/library-chunks/{chunk-7DN64UHE.js → chunk-ZCEZBO2T.js} +3 -3
- package/dist/library-chunks/{runtime-554E6FVF.js → runtime-7TSAKORH.js} +2 -2
- package/dist/otlp-settings.d.ts +1 -0
- package/dist/tracing.d.ts +1 -0
- package/docs/durable.md +1 -1
- package/package.json +4 -4
- package/src/durable-state.ts +2 -3
- package/src/durable.ts +1 -2
- package/src/otlp-settings.ts +13 -5
- package/src/tracing.ts +10 -4
- package/dist/chunks/chunk-DSQBXICE.ts.map +0 -7
- package/dist/library-chunks/chunk-7JGM5RS3.js.map +0 -7
- /package/dist/chunks/{runtime-X3YFJUNH.ts.map → runtime-KWIFBNQ2.ts.map} +0 -0
- /package/dist/library-chunks/{chunk-7DN64UHE.js.map → chunk-ZCEZBO2T.js.map} +0 -0
- /package/dist/library-chunks/{runtime-554E6FVF.js.map → runtime-7TSAKORH.js.map} +0 -0
package/dist/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getLangfuseRuntimeInternal,
|
|
7
7
|
normalizeOtlpConnection,
|
|
8
8
|
otlpSecrets
|
|
9
|
-
} from "./chunks/chunk-
|
|
9
|
+
} from "./chunks/chunk-IXR5MVGN.ts";
|
|
10
10
|
|
|
11
11
|
// src/otel.ts
|
|
12
12
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -631,7 +631,7 @@ var TraceRecorder = class {
|
|
|
631
631
|
...mismatched && outcome === "success" ? {
|
|
632
632
|
level: "WARNING",
|
|
633
633
|
statusMessage: `Turn ${turnIndex} ended while turn ${this.turnIndex} was active.`
|
|
634
|
-
} : severityForOutcome(outcome, result.message.errorMessage)
|
|
634
|
+
} : severityForOutcome(outcome, this.captureErrorMessage(result.message.errorMessage))
|
|
635
635
|
});
|
|
636
636
|
this.turn.end();
|
|
637
637
|
this.turn = void 0;
|
|
@@ -729,7 +729,7 @@ var TraceRecorder = class {
|
|
|
729
729
|
...finiteNumber(message.usage?.reasoning) ? { "pi.usage.reasoning_tokens": message.usage.reasoning } : {},
|
|
730
730
|
...finiteNumber(message.usage?.cacheWrite1h) ? { "pi.usage.cache_write_1h_tokens": message.usage.cacheWrite1h } : {}
|
|
731
731
|
},
|
|
732
|
-
...severityForOutcome(outcome, message.errorMessage)
|
|
732
|
+
...severityForOutcome(outcome, this.captureErrorMessage(message.errorMessage))
|
|
733
733
|
});
|
|
734
734
|
state.observation.end(state.endTime);
|
|
735
735
|
this.generation = void 0;
|
|
@@ -885,7 +885,7 @@ var TraceRecorder = class {
|
|
|
885
885
|
const finalAttributes = {
|
|
886
886
|
...this.lastOutput !== void 0 ? { output: this.lastOutput } : {},
|
|
887
887
|
metadata: finalMetadata,
|
|
888
|
-
...severityForOutcome(baseOutcome, statusMessage ?? this.lastAssistant?.errorMessage)
|
|
888
|
+
...severityForOutcome(baseOutcome, statusMessage ?? this.captureErrorMessage(this.lastAssistant?.errorMessage))
|
|
889
889
|
};
|
|
890
890
|
this.root.update(finalAttributes);
|
|
891
891
|
this.root.updateTrace?.({
|
|
@@ -915,7 +915,7 @@ var TraceRecorder = class {
|
|
|
915
915
|
"pi.attempt.outcome": outcome,
|
|
916
916
|
...message?.stopReason ? { "pi.attempt.stop_reason": message.stopReason } : {}
|
|
917
917
|
},
|
|
918
|
-
...severityForOutcome(outcome, statusMessage ?? message?.errorMessage)
|
|
918
|
+
...severityForOutcome(outcome, statusMessage ?? this.captureErrorMessage(message?.errorMessage))
|
|
919
919
|
});
|
|
920
920
|
this.attempt.end();
|
|
921
921
|
this.attempt = void 0;
|
|
@@ -977,6 +977,10 @@ var TraceRecorder = class {
|
|
|
977
977
|
this.compaction.observation.end();
|
|
978
978
|
this.compaction = void 0;
|
|
979
979
|
}
|
|
980
|
+
captureErrorMessage(message) {
|
|
981
|
+
if (!this.context.captureContent || typeof message !== "string") return void 0;
|
|
982
|
+
return String(sanitizeTraceValue(message));
|
|
983
|
+
}
|
|
980
984
|
capture(value) {
|
|
981
985
|
return this.context.captureContent ? sanitizeTraceValue(value) : CONTENT_DISABLED;
|
|
982
986
|
}
|
|
@@ -1594,7 +1598,7 @@ function createOtelExtension(dependencies = {}) {
|
|
|
1594
1598
|
if (createBackend) {
|
|
1595
1599
|
runtime = createLangfuseRuntimeFromBackend(await createBackend(config));
|
|
1596
1600
|
} else {
|
|
1597
|
-
const { createLangfuseRuntime: createLangfuseRuntime2, createOtelRuntime: createOtelRuntime2 } = await import("./chunks/runtime-
|
|
1601
|
+
const { createLangfuseRuntime: createLangfuseRuntime2, createOtelRuntime: createOtelRuntime2 } = await import("./chunks/runtime-KWIFBNQ2.ts");
|
|
1598
1602
|
if (!isCurrent()) return void 0;
|
|
1599
1603
|
runtime = await (config.backend === "otlp" ? createOtelRuntime2(config) : createLangfuseRuntime2({ config, env: false }));
|
|
1600
1604
|
}
|
|
@@ -1858,11 +1862,11 @@ var otel_default = createOtelExtension();
|
|
|
1858
1862
|
|
|
1859
1863
|
// src/runtime-api.ts
|
|
1860
1864
|
async function createLangfuseRuntime(options = {}) {
|
|
1861
|
-
const runtime = await import("./chunks/runtime-
|
|
1865
|
+
const runtime = await import("./chunks/runtime-KWIFBNQ2.ts");
|
|
1862
1866
|
return runtime.createLangfuseRuntime(options);
|
|
1863
1867
|
}
|
|
1864
1868
|
async function createOtelRuntime(config) {
|
|
1865
|
-
const runtime = await import("./chunks/runtime-
|
|
1869
|
+
const runtime = await import("./chunks/runtime-KWIFBNQ2.ts");
|
|
1866
1870
|
return runtime.createOtelRuntime(config);
|
|
1867
1871
|
}
|
|
1868
1872
|
export {
|