Skip to content

Commit 53ee33c

Browse files
committed
ref(core): Add more specific event mechanisms to openAiIntegration
1 parent 8f4d56f commit 53ee33c

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
@@ -257,6 +257,10 @@ function instrumentMethod<T extends unknown[], R>(
257257
captureException(error, {
258258
mechanism: {
259259
handled: false,
260+
type: 'openai.stream',
261+
data: {
262+
function: methodPath,
263+
},
260264
},
261265
});
262266
span.end();
@@ -282,7 +286,15 @@ function instrumentMethod<T extends unknown[], R>(
282286
addResponseAttributes(span, result, finalOptions.recordOutputs);
283287
return result;
284288
} catch (error) {
285-
captureException(error);
289+
captureException(error, {
290+
mechanism: {
291+
handled: false,
292+
type: 'openai',
293+
data: {
294+
function: methodPath,
295+
},
296+
},
297+
});
286298
throw error;
287299
}
288300
},

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)