Skip to content

Commit f49e957

Browse files
committed
s/TRACEPARENT_REGEXP/SENTRY_TRACE_REGEX
1 parent a2b4790 commit f49e957

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

packages/node/test/integrations/http.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as sentryCore from '@sentry/core';
22
import { Hub } from '@sentry/hub';
33
import * as hubModule from '@sentry/hub';
4-
import { addExtensionMethods, Span, TRACEPARENT_REGEXP, Transaction } from '@sentry/tracing';
4+
import { addExtensionMethods, SENTRY_TRACE_REGEX, Span, Transaction } from '@sentry/tracing';
55
import * as http from 'http';
66
import * as nock from 'nock';
77

@@ -75,7 +75,7 @@ describe('tracing', () => {
7575
const sentryTraceHeader = request.getHeader('sentry-trace') as string;
7676

7777
expect(sentryTraceHeader).toBeDefined();
78-
expect(TRACEPARENT_REGEXP.test(sentryTraceHeader)).toBe(true);
78+
expect(SENTRY_TRACE_REGEX.test(sentryTraceHeader)).toBe(true);
7979
});
8080

8181
it("doesn't attach the sentry-trace header to outgoing sentry requests", () => {

packages/tracing/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ export {
2626
extractTraceparentData,
2727
getActiveTransaction,
2828
hasTracingEnabled,
29+
SENTRY_TRACE_REGEX,
2930
stripUrlQueryAndFragment,
30-
TRACEPARENT_REGEXP,
3131
} from './utils';

packages/tracing/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getCurrentHub, Hub } from '@sentry/hub';
22
import { Options, TraceparentData, Transaction } from '@sentry/types';
33

4-
export const TRACEPARENT_REGEXP = new RegExp(
4+
export const SENTRY_TRACE_REGEX = new RegExp(
55
'^[ \\t]*' + // whitespace
66
'([0-9a-f]{32})?' + // trace_id
77
'-?([0-9a-f]{16})?' + // span_id
@@ -33,7 +33,7 @@ export function hasTracingEnabled(
3333
* @returns Object containing data from the header, or undefined if traceparent string is malformed
3434
*/
3535
export function extractTraceparentData(traceparent: string): TraceparentData | undefined {
36-
const matches = traceparent.match(TRACEPARENT_REGEXP);
36+
const matches = traceparent.match(SENTRY_TRACE_REGEX);
3737
if (matches) {
3838
let parentSampled: boolean | undefined;
3939
if (matches[3] === '1') {

packages/tracing/test/browser/request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ describe('callbacks', () => {
214214

215215
expect(setRequestHeader).toHaveBeenCalledWith(
216216
'sentry-trace',
217-
expect.stringMatching(tracingUtils.TRACEPARENT_REGEXP),
217+
expect.stringMatching(tracingUtils.SENTRY_TRACE_REGEX),
218218
);
219219
});
220220

packages/tracing/test/hub.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { logger } from '@sentry/utils';
88
import { BrowserTracing } from '../src/browser/browsertracing';
99
import { addExtensionMethods } from '../src/hubextensions';
1010
import { Transaction } from '../src/transaction';
11-
import { extractTraceparentData, TRACEPARENT_REGEXP } from '../src/utils';
11+
import { extractTraceparentData, SENTRY_TRACE_REGEX } from '../src/utils';
1212
import { addDOMPropertiesToGlobal, getSymbolObjectKeyByName, testOnlyIfNodeVersionAtLeast } from './testutils';
1313

1414
addExtensionMethods();
@@ -371,7 +371,7 @@ describe('Hub', () => {
371371

372372
// check that sentry-trace header is added to request
373373
expect(headers).toEqual(
374-
expect.objectContaining({ 'sentry-trace': expect.stringMatching(TRACEPARENT_REGEXP) }),
374+
expect.objectContaining({ 'sentry-trace': expect.stringMatching(SENTRY_TRACE_REGEX) }),
375375
);
376376

377377
// check that sampling decision is passed down correctly
@@ -413,7 +413,7 @@ describe('Hub', () => {
413413

414414
// check that sentry-trace header is added to request
415415
expect(headers).toEqual(
416-
expect.objectContaining({ 'sentry-trace': expect.stringMatching(TRACEPARENT_REGEXP) }),
416+
expect.objectContaining({ 'sentry-trace': expect.stringMatching(SENTRY_TRACE_REGEX) }),
417417
);
418418

419419
// check that sampling decision is passed down correctly

packages/tracing/test/span.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BrowserClient } from '@sentry/browser';
22
import { Hub, makeMain, Scope } from '@sentry/hub';
33

44
import { Span, SpanStatus, Transaction } from '../src';
5-
import { TRACEPARENT_REGEXP } from '../src/utils';
5+
import { SENTRY_TRACE_REGEX } from '../src/utils';
66

77
describe('Span', () => {
88
let hub: Hub;
@@ -95,10 +95,10 @@ describe('Span', () => {
9595

9696
describe('toTraceparent', () => {
9797
test('simple', () => {
98-
expect(new Span().toTraceparent()).toMatch(TRACEPARENT_REGEXP);
98+
expect(new Span().toTraceparent()).toMatch(SENTRY_TRACE_REGEX);
9999
});
100100
test('with sample', () => {
101-
expect(new Span({ sampled: true }).toTraceparent()).toMatch(TRACEPARENT_REGEXP);
101+
expect(new Span({ sampled: true }).toTraceparent()).toMatch(SENTRY_TRACE_REGEX);
102102
});
103103
});
104104

0 commit comments

Comments
 (0)