File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -130,14 +130,12 @@ function getTracer() {
130
130
} ) ;
131
131
132
132
if ( env . INTERNAL_OTEL_TRACE_EXPORTER_URL ) {
133
- const headers = env . INTERNAL_OTEL_TRACE_EXPORTER_AUTH_HEADERS
134
- ? ( JSON . parse ( env . INTERNAL_OTEL_TRACE_EXPORTER_AUTH_HEADERS ) as Record < string , string > )
135
- : undefined ;
133
+ const headers = parseInternalTraceHeaders ( ) ?? { } ;
136
134
137
135
const exporter = new OTLPTraceExporter ( {
138
136
url : env . INTERNAL_OTEL_TRACE_EXPORTER_URL ,
139
137
timeoutMillis : 15_000 ,
140
- headers : headers ,
138
+ headers,
141
139
} ) ;
142
140
143
141
provider . addSpanProcessor (
@@ -206,3 +204,13 @@ export function attributesFromAuthenticatedEnv(env: AuthenticatedEnvironment): A
206
204
[ SemanticEnvResources . USER_ID ] : env . orgMember ?. userId ,
207
205
} ;
208
206
}
207
+
208
+ function parseInternalTraceHeaders ( ) : Record < string , string > | undefined {
209
+ try {
210
+ return env . INTERNAL_OTEL_TRACE_EXPORTER_AUTH_HEADERS
211
+ ? ( JSON . parse ( env . INTERNAL_OTEL_TRACE_EXPORTER_AUTH_HEADERS ) as Record < string , string > )
212
+ : undefined ;
213
+ } catch {
214
+ return ;
215
+ }
216
+ }
Original file line number Diff line number Diff line change @@ -109,9 +109,9 @@ export class Logger {
109
109
currentSpan && currentSpan . isRecording ( ) ? currentSpan ?. spanContext ( ) . spanId : undefined ,
110
110
} ;
111
111
112
- // If the span is not recording, and it's a debug log, don't log it
112
+ // If the span is not recording, and it's a debug log, mark it so we can filter it out when we forward it
113
113
if ( currentSpan && ! currentSpan . isRecording ( ) && level === "debug" ) {
114
- return ;
114
+ structuredLog . skipForwarding = true ;
115
115
}
116
116
117
117
loggerFunction ( JSON . stringify ( structuredLog , this . #jsonReplacer) ) ;
You can’t perform that action at this time.
0 commit comments