@probelabs/probe-chat 0.6.0-rc175 → 0.6.0-rc176
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/appTracer.js +21 -0
- package/package.json +1 -1
package/appTracer.js
CHANGED
|
@@ -895,6 +895,27 @@ class AppTracer {
|
|
|
895
895
|
return span;
|
|
896
896
|
}
|
|
897
897
|
|
|
898
|
+
/**
|
|
899
|
+
* Record a generic event (used by completionPrompt and other features)
|
|
900
|
+
* This provides compatibility with SimpleAppTracer interface
|
|
901
|
+
* Adds an event to the existing session span rather than creating a new span
|
|
902
|
+
*/
|
|
903
|
+
// visor-disable: Events are added to existing spans per OpenTelemetry convention - recordEvent semantically means adding an event, not creating a span. Both SimpleAppTracer and AppTracer now consistently add events.
|
|
904
|
+
recordEvent(name, attributes = {}) {
|
|
905
|
+
const sessionId = attributes['session.id'] || 'unknown';
|
|
906
|
+
const sessionSpan = this.sessionSpans.get(sessionId);
|
|
907
|
+
|
|
908
|
+
if (sessionSpan) {
|
|
909
|
+
// Add event to the existing session span
|
|
910
|
+
sessionSpan.addEvent(name, {
|
|
911
|
+
'app.event.timestamp': Date.now(),
|
|
912
|
+
...attributes
|
|
913
|
+
});
|
|
914
|
+
} else if (process.env.DEBUG_CHAT === '1') {
|
|
915
|
+
console.log(`[DEBUG] AppTracer: recordEvent called but no session span for ${sessionId}`);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
898
919
|
/**
|
|
899
920
|
* Clean up any remaining active spans for a session
|
|
900
921
|
*/
|
package/package.json
CHANGED