Skip to content

Commit feab8af

Browse files
authored
ref(v8): Remove addRequestDataToTransaction util (#11369)
See #11368, where this is deprecated on v7.
1 parent 26da63a commit feab8af

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

packages/utils/src/requestdata.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {
22
Event,
33
ExtractedNodeRequestData,
44
PolymorphicRequest,
5-
Transaction,
65
TransactionSource,
76
WebFetchHeaders,
87
WebFetchRequest,
@@ -24,17 +23,6 @@ const DEFAULT_INCLUDES = {
2423
const DEFAULT_REQUEST_INCLUDES = ['cookies', 'data', 'headers', 'method', 'query_string', 'url'];
2524
export const DEFAULT_USER_INCLUDES = ['id', 'username', 'email'];
2625

27-
type InjectedNodeDeps = {
28-
cookie: {
29-
parse: (cookieStr: string) => Record<string, string>;
30-
};
31-
url: {
32-
parse: (urlStr: string) => {
33-
query: string | null;
34-
};
35-
};
36-
};
37-
3826
/**
3927
* Options deciding what parts of the request to use when enhancing an event
4028
*/
@@ -62,45 +50,6 @@ export type AddRequestDataToEventOptions = {
6250

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

65-
/**
66-
* Sets parameterized route as transaction name e.g.: `GET /users/:id`
67-
* Also adds more context data on the transaction from the request
68-
*/
69-
export function addRequestDataToTransaction(
70-
transaction: Transaction | undefined,
71-
req: PolymorphicRequest,
72-
// TODO(v8): Remove this parameter in v8
73-
_deps?: InjectedNodeDeps,
74-
): void {
75-
if (!transaction) return;
76-
77-
// TODO(v8): SEMANTIC_ATTRIBUTE_SENTRY_SOURCE is in core, align this once we merge utils & core
78-
// eslint-disable-next-line deprecation/deprecation
79-
if (!transaction.attributes['sentry.source'] || transaction.attributes['sentry.source'] === 'url') {
80-
// Attempt to grab a parameterized route off of the request
81-
const [name, source] = extractPathForTransaction(req, { path: true, method: true });
82-
transaction.updateName(name);
83-
// TODO(v8): SEMANTIC_ATTRIBUTE_SENTRY_SOURCE is in core, align this once we merge utils & core
84-
transaction.setAttribute('sentry.source', source);
85-
}
86-
transaction.setAttribute('url', req.originalUrl || req.url);
87-
if (req.baseUrl) {
88-
transaction.setAttribute('baseUrl', req.baseUrl);
89-
}
90-
91-
const query = extractQueryParams(req);
92-
if (typeof query === 'string') {
93-
transaction.setAttribute('query', query);
94-
} else if (query) {
95-
Object.keys(query).forEach(key => {
96-
const val = query[key];
97-
if (typeof val === 'string' || typeof val === 'number') {
98-
transaction.setAttribute(`query.${key}`, val);
99-
}
100-
});
101-
}
102-
}
103-
10453
/**
10554
* Extracts a complete and parameterized path from the request object and uses it to construct transaction name.
10655
* If the parameterized transaction name cannot be extracted, we fall back to the raw URL.

0 commit comments

Comments
 (0)