Skip to content

Commit f84a690

Browse files
committed
add transactionNamingScheme option to RequestData integration
1 parent 56f31b0 commit f84a690

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

packages/node/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type {
1818
} from '@sentry/types';
1919
export type { AddRequestDataToEventOptions } from '@sentry/utils';
2020

21+
export type { TransactionNamingScheme } from './requestdata';
2122
export type { NodeOptions } from './types';
2223

2324
export {

packages/node/src/integrations/requestdata.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33

44
import { EventProcessor, Hub, Integration } from '@sentry/types';
55

6-
import { addRequestDataToEvent, AddRequestDataToEventOptions, DEFAULT_USER_INCLUDES } from '../requestdata';
6+
import {
7+
addRequestDataToEvent,
8+
AddRequestDataToEventOptions,
9+
DEFAULT_USER_INCLUDES,
10+
TransactionNamingScheme,
11+
} from '../requestdata';
712

813
type RequestDataOptions = {
914
/**
@@ -19,6 +24,9 @@ type RequestDataOptions = {
1924
user?: boolean | Array<typeof DEFAULT_USER_INCLUDES[number]>;
2025
};
2126

27+
/** Whether to identify transactions by parameterized path, parameterized path with method, or handler name */
28+
transactionNamingScheme?: TransactionNamingScheme;
29+
2230
/**
2331
* Function for adding request data to event. Defaults to `addRequestDataToEvent` from `@sentry/node` for now, but
2432
* left injectable so this integration can be moved to `@sentry/core` and used in browser-based SDKs in the future.
@@ -39,6 +47,7 @@ const DEFAULT_OPTIONS = {
3947
url: true,
4048
user: DEFAULT_USER_INCLUDES,
4149
},
50+
transactionNamingScheme: 'methodpath',
4251
};
4352

4453
/** Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/integrations`

packages/node/src/requestdata.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface AddRequestDataToEventOptions {
2525
};
2626
}
2727

28-
type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
28+
export type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
2929

3030
/**
3131
* Sets parameterized route as transaction name e.g.: `GET /users/:id`

0 commit comments

Comments
 (0)