Skip to content

Commit 478c23b

Browse files
committed
re-export from framework sdks
1 parent 95fd6b1 commit 478c23b

File tree

9 files changed

+17
-10
lines changed

9 files changed

+17
-10
lines changed

packages/astro/src/server/middleware.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
getActiveSpan,
77
getClient,
88
getCurrentScope,
9+
getTracingMetaTags,
910
setHttpStatus,
1011
startSpan,
1112
withIsolationScope,
@@ -189,16 +190,13 @@ function addMetaTagToHead(htmlChunk: string, scope: Scope, client: Client, span?
189190
if (typeof htmlChunk !== 'string') {
190191
return htmlChunk;
191192
}
192-
const { 'sentry-trace': sentryTrace, baggage } = getTraceData(span, scope, client);
193+
const metaTags = getTracingMetaTags(span, scope, client);
193194

194-
if (!sentryTrace) {
195+
if (!metaTags) {
195196
return htmlChunk;
196197
}
197198

198-
const sentryTraceMeta = `<meta name="sentry-trace" content="${sentryTrace}"/>`;
199-
const baggageMeta = baggage && `<meta name="baggage" content="${baggage}"/>`;
200-
201-
const content = `<head>\n${sentryTraceMeta}`.concat(baggageMeta ? `\n${baggageMeta}` : '', '\n');
199+
const content = `<head>${metaTags}`;
202200

203201
return htmlChunk.replace('<head>', content);
204202
}

packages/astro/test/server/middleware.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ describe('sentryMiddleware', () => {
3434
});
3535
vi.spyOn(SentryNode, 'getActiveSpan').mockImplementation(getSpanMock);
3636
vi.spyOn(SentryNode, 'getClient').mockImplementation(() => ({}) as Client);
37-
vi.spyOn(SentryNode, 'getTraceData').mockImplementation(() => ({
38-
'sentry-trace': '123',
39-
baggage: 'abc',
40-
}));
37+
vi.spyOn(SentryNode, 'getTracingMetaTags').mockImplementation(
38+
() => `
39+
<meta name="sentry-trace" content="123">
40+
<meta name="baggage" content="abc">
41+
`,
42+
);
4143
vi.spyOn(SentryCore, 'getDynamicSamplingContextFromSpan').mockImplementation(() => ({
4244
transaction: 'test',
4345
}));

packages/aws-serverless/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export {
2121
getGlobalScope,
2222
getIsolationScope,
2323
getTraceData,
24+
getTracingMetaTags,
2425
setCurrentClient,
2526
Scope,
2627
SDK_VERSION,

packages/bun/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export {
4141
getGlobalScope,
4242
getIsolationScope,
4343
getTraceData,
44+
getTracingMetaTags,
4445
setCurrentClient,
4546
Scope,
4647
SDK_VERSION,

packages/cloudflare/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export {
5656
getActiveSpan,
5757
getRootSpan,
5858
getTraceData,
59+
getTracingMetaTags,
5960
startSpan,
6061
startInactiveSpan,
6162
startSpanManual,

packages/deno/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export {
5656
getActiveSpan,
5757
getRootSpan,
5858
getTraceData,
59+
getTracingMetaTags,
5960
startSpan,
6061
startInactiveSpan,
6162
startSpanManual,

packages/google-cloud-serverless/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export {
2121
getGlobalScope,
2222
getIsolationScope,
2323
getTraceData,
24+
getTracingMetaTags,
2425
setCurrentClient,
2526
Scope,
2627
SDK_VERSION,

packages/sveltekit/src/server/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export {
5252
getSpanDescendants,
5353
getSpanStatusFromHttpCode,
5454
getTraceData,
55+
getTracingMetaTags,
5556
graphqlIntegration,
5657
hapiIntegration,
5758
httpIntegration,

packages/vercel-edge/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export {
5656
getActiveSpan,
5757
getRootSpan,
5858
getTraceData,
59+
getTracingMetaTags,
5960
startSpan,
6061
startInactiveSpan,
6162
startSpanManual,

0 commit comments

Comments
 (0)