Skip to content

Commit cb0494e

Browse files
committed
ref: Code review
1 parent 44cb67e commit cb0494e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

packages/apm/src/integrations/tracing.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ export class Tracing implements Integration {
298298
traceId = span.traceId;
299299
parentSpanId = span.parentSpanId;
300300
sampled = span.sampled;
301+
Tracing._log(
302+
`[Tracing] found 'sentry-meta' '<meta />' continuing trace with: trace_id: ${traceId} span_id: ${parentSpanId}`,
303+
);
301304
}
302-
Tracing._log(
303-
`[Tracing] found 'sentry-meta' '<meta />' continuing trace with: trace_id: ${traceId} span_id: ${parentSpanId}`,
304-
);
305305
}
306306

307307
return hub.startTransaction({
@@ -317,16 +317,8 @@ export class Tracing implements Integration {
317317
* Returns the value of a meta tag
318318
*/
319319
private static _getMeta(metaName: string): string | null {
320-
const metas = document.getElementsByTagName('meta');
321-
322-
// tslint:disable-next-line: prefer-for-of
323-
for (let i = 0; i < metas.length; i++) {
324-
if (metas[i].getAttribute('name') === metaName) {
325-
return metas[i].getAttribute('content');
326-
}
327-
}
328-
329-
return null;
320+
const el = document.querySelector(`meta[name=${metaName}]`);
321+
return el ? el.getAttribute('content') : null;
330322
}
331323

332324
/**

0 commit comments

Comments
 (0)