Skip to content

Commit 904e26b

Browse files
committed
add a comment
1 parent 356875c commit 904e26b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/node/src/integrations/tracing/openai/instrumentation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,14 @@ export class SentryOpenAiInstrumentation extends InstrumentationBase<Instrumenta
9797
});
9898
}
9999

100-
// Also wrap the default export if it points to the original constructor
100+
// Wrap the default export if it points to the original constructor
101+
// Constructor replacement - handle read-only properties
102+
// The OpenAI property might have only a getter, so use defineProperty
101103
if (exports.default === Original) {
102104
try {
103105
exports.default = WrappedOpenAI;
104106
} catch (error) {
107+
// If direct assignment fails, override the property descriptor
105108
Object.defineProperty(exports, 'default', {
106109
value: WrappedOpenAI,
107110
writable: true,

0 commit comments

Comments
 (0)