Skip to content

Commit 5cd3457

Browse files
authored
feat(nuxt): Log when adding HTML trace meta tags (#16044)
Logging the tracing meta tags makes debugging [things like this](#16039) easier.
1 parent 263eeee commit 5cd3457

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/nuxt/src/runtime/utils.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ClientOptions, Context } from '@sentry/core';
2+
import { logger } from '@sentry/core';
23
import { captureException, getClient, getTraceMetaTags } from '@sentry/core';
34
import type { VueOptions } from '@sentry/vue/src/types';
45
import type { CapturedErrorContext } from 'nitropack';
@@ -37,6 +38,7 @@ export function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): v
3738
const metaTags = getTraceMetaTags();
3839

3940
if (metaTags) {
41+
logger.log('Adding Sentry tracing meta tags to HTML page:', metaTags);
4042
head.push(metaTags);
4143
}
4244
}

packages/nuxt/test/runtime/plugins/server.test.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { getTraceMetaTags } from '@sentry/core';
22
import { type Mock, afterEach, describe, expect, it, vi } from 'vitest';
33
import { addSentryTracingMetaTags } from '../../../src/runtime/utils';
44

5-
vi.mock('@sentry/core', () => ({
6-
getTraceMetaTags: vi.fn(),
7-
}));
5+
vi.mock(import('@sentry/core'), async importOriginal => {
6+
const mod = await importOriginal();
7+
return {
8+
...mod,
9+
getTraceMetaTags: vi.fn(),
10+
};
11+
});
812

913
describe('addSentryTracingMetaTags', () => {
1014
afterEach(() => {

0 commit comments

Comments
 (0)