@@ -88,28 +88,34 @@ const instrumentSentryHttp = generateInstrumentOnce<{ breadcrumbs?: boolean }>(
88
88
} ,
89
89
) ;
90
90
91
- const instrumentOtelHttp = generateInstrumentOnce < HttpInstrumentationConfig > ( `${ INTEGRATION_NAME } .otel` , config => {
92
- const instrumentation = new HttpInstrumentation ( config ) ;
93
-
94
- // We want to update the logger namespace so we can better identify what is happening here
95
- try {
96
- instrumentation [ '_diag' ] = diag . createComponentLogger ( {
97
- namespace : INSTRUMENTATION_NAME ,
98
- } ) ;
99
- // @ts -expect-error We are writing a read-only property here...
100
- instrumentation . instrumentationName = INSTRUMENTATION_NAME ;
101
- } catch {
102
- // ignore errors here...
103
- }
104
-
105
- return instrumentation ;
106
- } ) ;
91
+ /**
92
+ * We only preload this one.
93
+ * If we preload both this and `instrumentSentryHttp`, it leads to weird issues with instrumentation.
94
+ */
95
+ export const instrumentOtelHttp = generateInstrumentOnce < HttpInstrumentationConfig > (
96
+ `${ INTEGRATION_NAME } .otel` ,
97
+ config => {
98
+ const instrumentation = new HttpInstrumentation ( config ) ;
99
+
100
+ // We want to update the logger namespace so we can better identify what is happening here
101
+ try {
102
+ instrumentation [ '_diag' ] = diag . createComponentLogger ( {
103
+ namespace : INSTRUMENTATION_NAME ,
104
+ } ) ;
105
+ // @ts -expect-error We are writing a read-only property here...
106
+ instrumentation . instrumentationName = INSTRUMENTATION_NAME ;
107
+ } catch {
108
+ // ignore errors here...
109
+ }
110
+
111
+ return instrumentation ;
112
+ } ,
113
+ ) ;
107
114
108
115
/**
109
116
* Instrument the HTTP module.
110
- * This can only be instrumented once! If this called again later, we just update the options.
111
117
*/
112
- export const instrumentHttp = Object . assign (
118
+ const instrumentHttp = Object . assign (
113
119
function ( options : HttpOptions = { } ) {
114
120
// This is the "regular" OTEL instrumentation that emits spans
115
121
if ( options . spans !== false ) {
0 commit comments