File tree 8 files changed +38
-18
lines changed
8 files changed +38
-18
lines changed Original file line number Diff line number Diff line change
1
+ @unwebio:registry = https://npm.pkg.github.com
Original file line number Diff line number Diff line change
1
+ @unwebio:registry = https://npm.pkg.github.com
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " @sentry/ hub" ,
2
+ "name" : " @unwebio/sentry- hub" ,
3
3
"version" : " 6.16.1" ,
4
4
"description" : " Sentry hub which handles global state managment." ,
5
- "repository" : " git://github.com/getsentry /sentry-javascript.git" ,
6
- "homepage" : " https://github.com/getsentry /sentry-javascript/tree/master/packages/hub" ,
5
+ "repository" : " git://github.com/unwebio /sentry-javascript.git" ,
6
+ "homepage" : " https://github.com/unwebio /sentry-javascript/tree/master/packages/hub" ,
7
7
"author" : " Sentry" ,
8
8
"license" : " BSD-3-Clause" ,
9
9
"engines" : {
13
13
"module" : " esm/index.js" ,
14
14
"types" : " dist/index.d.ts" ,
15
15
"publishConfig" : {
16
- "access" : " public "
16
+ "access" : " restricted "
17
17
},
18
18
"dependencies" : {
19
19
"@sentry/types" : " 6.16.1" ,
Original file line number Diff line number Diff line change @@ -580,7 +580,8 @@ export function getActiveDomain(): DomainAsCarrier | undefined {
580
580
function getHubFromActiveDomain ( registry : Carrier ) : Hub {
581
581
try {
582
582
const sentry = getMainCarrier ( ) . __SENTRY__ ;
583
- const activeDomain = sentry && sentry . extensions && sentry . extensions . domain && sentry . extensions . domain . active ;
583
+ const domainModule = sentry && sentry . extensions && sentry . extensions . domain
584
+ const activeDomain = domainModule && domainModule . active ;
584
585
585
586
// If there's no active domain, just return global hub
586
587
if ( ! activeDomain ) {
@@ -589,7 +590,9 @@ function getHubFromActiveDomain(registry: Carrier): Hub {
589
590
590
591
// If there's no hub on current domain, or it's an old API, assign a new one
591
592
if ( ! hasHubOnCarrier ( activeDomain ) || getHubFromCarrier ( activeDomain ) . isOlderThan ( API_VERSION ) ) {
592
- const registryHubTopStack = getHubFromCarrier ( registry ) . getStackTop ( ) ;
593
+ const stack : any [ ] = domainModule ?. _stack
594
+ const parentCarrier = stack [ stack . length - 2 ] || registry
595
+ const registryHubTopStack = getHubFromCarrier ( parentCarrier ) . getStackTop ( ) ;
593
596
setHubOnCarrier ( activeDomain , new Hub ( registryHubTopStack . client , Scope . clone ( registryHubTopStack . scope ) ) ) ;
594
597
}
595
598
Original file line number Diff line number Diff line change
1
+ @unwebio:registry = https://npm.pkg.github.com
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " @sentry/ node" ,
2
+ "name" : " @unwebio/sentry- node" ,
3
3
"version" : " 6.16.1" ,
4
4
"description" : " Official Sentry SDK for Node.js" ,
5
- "repository" : " git://github.com/getsentry /sentry-javascript.git" ,
6
- "homepage" : " https://github.com/getsentry /sentry-javascript/tree/master/packages/node" ,
5
+ "repository" : " git://github.com/unwebio /sentry-javascript.git" ,
6
+ "homepage" : " https://github.com/unwebio /sentry-javascript/tree/master/packages/node" ,
7
7
"author" : " Sentry" ,
8
8
"license" : " BSD-3-Clause" ,
9
9
"engines" : {
13
13
"module" : " esm/index.js" ,
14
14
"types" : " dist/index.d.ts" ,
15
15
"publishConfig" : {
16
- "access" : " public "
16
+ "access" : " restricted "
17
17
},
18
18
"dependencies" : {
19
19
"@sentry/core" : " 6.16.1" ,
20
- "@sentry/ hub" : " 6.16.1" ,
20
+ "@unwebio/sentry- hub" : " 6.16.1" ,
21
21
"@sentry/tracing" : " 6.16.1" ,
22
22
"@sentry/types" : " 6.16.1" ,
23
23
"@sentry/utils" : " 6.16.1" ,
Original file line number Diff line number Diff line change @@ -117,11 +117,13 @@ function _createWrappedRequestMethodFactory(
117
117
op : 'http.client' ,
118
118
} ) ;
119
119
120
- const sentryTraceHeader = span . toTraceparent ( ) ;
121
- logger . log (
122
- `[Tracing] Adding sentry-trace header ${ sentryTraceHeader } to outgoing request to ${ requestUrl } : ` ,
123
- ) ;
124
- requestOptions . headers = { ...requestOptions . headers , 'sentry-trace' : sentryTraceHeader } ;
120
+ if ( ! requestOptions . stripTracingHeader ) {
121
+ const sentryTraceHeader = span . toTraceparent ( ) ;
122
+ logger . log (
123
+ `[Tracing] Adding sentry-trace header ${ sentryTraceHeader } to outgoing request to ${ requestUrl } : ` ,
124
+ ) ;
125
+ requestOptions . headers = { ...requestOptions . headers , 'sentry-trace' : sentryTraceHeader } ;
126
+ }
125
127
}
126
128
}
127
129
@@ -139,7 +141,17 @@ function _createWrappedRequestMethodFactory(
139
141
span . setHttpStatus ( res . statusCode ) ;
140
142
}
141
143
span . description = cleanSpanDescription ( span . description , requestOptions , req ) ;
142
- span . finish ( ) ;
144
+
145
+ res . once ( 'end' , ( ) => {
146
+ span ?. finish ( )
147
+ } )
148
+
149
+ res . once ( 'error' , ( ) => {
150
+ if ( breadcrumbsEnabled ) {
151
+ addRequestBreadcrumb ( 'response_error' , requestUrl , req ) ;
152
+ }
153
+ span ?. finish ( )
154
+ } )
143
155
}
144
156
} )
145
157
. once ( 'error' , function ( this : http . ClientRequest ) : void {
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ export function cleanSpanDescription(
73
73
}
74
74
75
75
// the node types are missing a few properties which node's `urlToOptions` function spits out
76
- export type RequestOptions = http . RequestOptions & { hash ?: string ; search ?: string ; pathname ?: string ; href ?: string } ;
76
+ export type RequestOptions = http . RequestOptions
77
+ & { hash ?: string ; search ?: string ; pathname ?: string ; href ?: string }
78
+ & { stripTracingHeader ?: boolean } ;
77
79
type RequestCallback = ( response : http . IncomingMessage ) => void ;
78
80
export type RequestMethodArgs =
79
81
| [ RequestOptions | string | URL , RequestCallback ?]
You can’t perform that action at this time.
0 commit comments