Skip to content

Commit

Permalink
add transactionNamingScheme option to RequestData integration
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Sep 19, 2022
1 parent fed0ff3 commit 124fd6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type {
} from '@sentry/types';
export type { AddRequestDataToEventOptions } from '@sentry/utils';

export type { TransactionNamingScheme } from './requestdata';
export type { NodeOptions } from './types';

export {
Expand Down
11 changes: 10 additions & 1 deletion packages/node/src/integrations/requestdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

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

import { addRequestDataToEvent, AddRequestDataToEventOptions, DEFAULT_USER_INCLUDES } from '../requestdata';
import {
addRequestDataToEvent,
AddRequestDataToEventOptions,
DEFAULT_USER_INCLUDES,
TransactionNamingScheme,
} from '../requestdata';

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

/** Whether to identify transactions by parameterized path, parameterized path with method, or handler name */
transactionNamingScheme: TransactionNamingScheme;

/**
* Function for adding request data to event. Defaults to `addRequestDataToEvent` from `@sentry/node` for now, but
* left injectable so this integration can be moved to `@sentry/core` and used in browser-based SDKs in the future.
Expand All @@ -39,6 +47,7 @@ const DEFAULT_OPTIONS = {
url: true,
user: DEFAULT_USER_INCLUDES,
},
transactionNamingScheme: 'methodpath',
};

/** Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/integrations`
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/requestdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface AddRequestDataToEventOptions {
};
}

type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
export type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';

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

0 comments on commit 124fd6d

Please sign in to comment.