Skip to content

Commit 1fcd07b

Browse files
committed
s/getTracingMetaTags/getTraceMetaTags
1 parent 478c23b commit 1fcd07b

File tree

15 files changed

+26
-24
lines changed

15 files changed

+26
-24
lines changed

dev-packages/node-integration-tests/suites/tracing/meta-tags/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ app.get('/test', (_req, res) => {
1818
response: `
1919
<html>
2020
<head>
21-
${Sentry.getTracingMetaTags()}
21+
${Sentry.getTraceMetaTags()}
2222
</head>
2323
<body>
2424
Hi :)

dev-packages/node-integration-tests/suites/tracing/meta-tags/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';
22

3-
describe('getTracingMetaTags', () => {
3+
describe('getTraceMetaTags', () => {
44
afterAll(() => {
55
cleanupChildProcesses();
66
});

packages/astro/src/server/middleware.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
getActiveSpan,
77
getClient,
88
getCurrentScope,
9-
getTracingMetaTags,
9+
getTraceMetaTags,
1010
setHttpStatus,
1111
startSpan,
1212
withIsolationScope,
@@ -15,8 +15,6 @@ import type { Client, Scope, Span, SpanAttributes } from '@sentry/types';
1515
import { addNonEnumerableProperty, objectify, stripUrlQueryAndFragment } from '@sentry/utils';
1616
import type { APIContext, MiddlewareResponseHandler } from 'astro';
1717

18-
import { getTraceData } from '@sentry/node';
19-
2018
type MiddlewareOptions = {
2119
/**
2220
* If true, the client IP will be attached to the event by calling `setUser`.
@@ -190,7 +188,7 @@ function addMetaTagToHead(htmlChunk: string, scope: Scope, client: Client, span?
190188
if (typeof htmlChunk !== 'string') {
191189
return htmlChunk;
192190
}
193-
const metaTags = getTracingMetaTags(span, scope, client);
191+
const metaTags = getTraceMetaTags(span, scope, client);
194192

195193
if (!metaTags) {
196194
return htmlChunk;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('sentryMiddleware', () => {
3434
});
3535
vi.spyOn(SentryNode, 'getActiveSpan').mockImplementation(getSpanMock);
3636
vi.spyOn(SentryNode, 'getClient').mockImplementation(() => ({}) as Client);
37-
vi.spyOn(SentryNode, 'getTracingMetaTags').mockImplementation(
37+
vi.spyOn(SentryNode, 'getTraceMetaTags').mockImplementation(
3838
() => `
3939
<meta name="sentry-trace" content="123">
4040
<meta name="baggage" content="abc">

packages/aws-serverless/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export {
2121
getGlobalScope,
2222
getIsolationScope,
2323
getTraceData,
24-
getTracingMetaTags,
24+
getTraceMetaTags,
2525
setCurrentClient,
2626
Scope,
2727
SDK_VERSION,

packages/bun/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export {
4141
getGlobalScope,
4242
getIsolationScope,
4343
getTraceData,
44-
getTracingMetaTags,
44+
getTraceMetaTags,
4545
setCurrentClient,
4646
Scope,
4747
SDK_VERSION,

packages/cloudflare/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export {
5656
getActiveSpan,
5757
getRootSpan,
5858
getTraceData,
59-
getTracingMetaTags,
59+
getTraceMetaTags,
6060
startSpan,
6161
startInactiveSpan,
6262
startSpanManual,

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export {
8383
export { parseSampleRate } from './utils/parseSampleRate';
8484
export { applySdkMetadata } from './utils/sdkMetadata';
8585
export { getTraceData } from './utils/traceData';
86-
export { getTracingMetaTags } from './utils/meta';
86+
export { getTraceMetaTags } from './utils/meta';
8787
export { DEFAULT_ENVIRONMENT } from './constants';
8888
export { addBreadcrumb } from './breadcrumbs';
8989
export { functionToStringIntegration } from './integrations/functiontostring';

packages/core/src/utils/meta.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@ import type { Client, Scope, Span } from '@sentry/types';
22
import { getTraceData } from './traceData';
33

44
/**
5-
* Returns a string of meta tags that represent the tracing data.
5+
* Returns a string of meta tags that represent the current trace data.
66
*
77
* You can use this to propagate a trace from your server-side rendered Html to the browser.
8+
* This function returns up to two meta tags, `sentry-trace` and `baggage`, depending on the
9+
* current trace data state.
10+
*
11+
* @example
812
* Usage example:
913
*
1014
* ```js
1115
* function renderHtml() {
1216
* return `
1317
* <head>
14-
* ${getTracingMetaTags()}
18+
* ${getTraceMetaTags()}
1519
* </head>
1620
* `;
1721
* }
1822
* ```
1923
*
2024
* @returns
2125
*/
22-
export function getTracingMetaTags(span?: Span, scope?: Scope, client?: Client): string {
26+
export function getTraceMetaTags(span?: Span, scope?: Scope, client?: Client): string {
2327
return Object.entries(getTraceData(span, scope, client))
2428
.map(([key, value]) => `<meta name="${key}" content="${value}"/>`)
2529
.join('\n');
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { getTracingMetaTags } from '../../../src/utils/meta';
1+
import { getTraceMetaTags } from '../../../src/utils/meta';
22
import * as TraceDataModule from '../../../src/utils/traceData';
33

4-
describe('getTracingMetaTags', () => {
4+
describe('getTraceMetaTags', () => {
55
it('renders baggage and sentry-trace values to stringified Html meta tags', () => {
66
jest.spyOn(TraceDataModule, 'getTraceData').mockReturnValueOnce({
77
'sentry-trace': '12345678901234567890123456789012-1234567890123456-1',
88
baggage: 'sentry-environment=production',
99
});
1010

11-
expect(getTracingMetaTags()).toBe(`<meta name="sentry-trace" content="12345678901234567890123456789012-1234567890123456-1"/>
11+
expect(getTraceMetaTags()).toBe(`<meta name="sentry-trace" content="12345678901234567890123456789012-1234567890123456-1"/>
1212
<meta name="baggage" content="sentry-environment=production"/>`);
1313
});
1414

@@ -17,14 +17,14 @@ describe('getTracingMetaTags', () => {
1717
'sentry-trace': '12345678901234567890123456789012-1234567890123456-1',
1818
});
1919

20-
expect(getTracingMetaTags()).toBe(
20+
expect(getTraceMetaTags()).toBe(
2121
'<meta name="sentry-trace" content="12345678901234567890123456789012-1234567890123456-1"/>',
2222
);
2323
});
2424

2525
it('returns an empty string if neither sentry-trace nor baggage values are available', () => {
2626
jest.spyOn(TraceDataModule, 'getTraceData').mockReturnValueOnce({});
2727

28-
expect(getTracingMetaTags()).toBe('');
28+
expect(getTraceMetaTags()).toBe('');
2929
});
3030
});

packages/deno/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export {
5656
getActiveSpan,
5757
getRootSpan,
5858
getTraceData,
59-
getTracingMetaTags,
59+
getTraceMetaTags,
6060
startSpan,
6161
startInactiveSpan,
6262
startSpanManual,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export {
2121
getGlobalScope,
2222
getIsolationScope,
2323
getTraceData,
24-
getTracingMetaTags,
24+
getTraceMetaTags,
2525
setCurrentClient,
2626
Scope,
2727
SDK_VERSION,

packages/node/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export {
9696
getCurrentScope,
9797
getIsolationScope,
9898
getTraceData,
99-
getTracingMetaTags,
99+
getTraceMetaTags,
100100
withScope,
101101
withIsolationScope,
102102
captureException,

packages/sveltekit/src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export {
5252
getSpanDescendants,
5353
getSpanStatusFromHttpCode,
5454
getTraceData,
55-
getTracingMetaTags,
55+
getTraceMetaTags,
5656
graphqlIntegration,
5757
hapiIntegration,
5858
httpIntegration,

packages/vercel-edge/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export {
5656
getActiveSpan,
5757
getRootSpan,
5858
getTraceData,
59-
getTracingMetaTags,
59+
getTraceMetaTags,
6060
startSpan,
6161
startInactiveSpan,
6262
startSpanManual,

0 commit comments

Comments
 (0)