Skip to content

Commit 1aba28d

Browse files
committed
ref(core): Add more specific event mechanisms to openAiIntegration
1 parent af69b45 commit 1aba28d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/core/src/utils/openai/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ function instrumentMethod<T extends unknown[], R>(
258258
captureException(error, {
259259
mechanism: {
260260
handled: false,
261+
type: 'openai.stream',
262+
data: {
263+
function: methodPath,
264+
},
261265
},
262266
});
263267
span.end();
@@ -283,7 +287,15 @@ function instrumentMethod<T extends unknown[], R>(
283287
addResponseAttributes(span, result, finalOptions.recordOutputs);
284288
return result;
285289
} catch (error) {
286-
captureException(error);
290+
captureException(error, {
291+
mechanism: {
292+
handled: false,
293+
type: 'openai',
294+
data: {
295+
function: methodPath,
296+
},
297+
},
298+
});
287299
throw error;
288300
}
289301
},

packages/core/src/utils/openai/streaming.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function processResponsesApiEvent(
152152
captureException(streamEvent, {
153153
mechanism: {
154154
handled: false,
155+
type: 'openai.stream-response',
155156
},
156157
});
157158
return;

0 commit comments

Comments
 (0)