@@ -2,7 +2,6 @@ import type {
2
2
Event ,
3
3
ExtractedNodeRequestData ,
4
4
PolymorphicRequest ,
5
- Transaction ,
6
5
TransactionSource ,
7
6
WebFetchHeaders ,
8
7
WebFetchRequest ,
@@ -24,17 +23,6 @@ const DEFAULT_INCLUDES = {
24
23
const DEFAULT_REQUEST_INCLUDES = [ 'cookies' , 'data' , 'headers' , 'method' , 'query_string' , 'url' ] ;
25
24
export const DEFAULT_USER_INCLUDES = [ 'id' , 'username' , 'email' ] ;
26
25
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
-
38
26
/**
39
27
* Options deciding what parts of the request to use when enhancing an event
40
28
*/
@@ -62,45 +50,6 @@ export type AddRequestDataToEventOptions = {
62
50
63
51
export type TransactionNamingScheme = 'path' | 'methodPath' | 'handler' ;
64
52
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
-
104
53
/**
105
54
* Extracts a complete and parameterized path from the request object and uses it to construct transaction name.
106
55
* If the parameterized transaction name cannot be extracted, we fall back to the raw URL.
0 commit comments