File tree Expand file tree Collapse file tree
lib/providers/httpTransaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ HttpTransaction.prototype.onClientReceive = function (data) {
146146 var trace = this . _initTrace ( data )
147147
148148 if ( data . err ) {
149- trace . isSampled = true
149+ trace . isForceSampled = true
150150 }
151151
152152 trace . events . push ( {
@@ -172,11 +172,9 @@ HttpTransaction.prototype.onServerSend = function (data) {
172172 type : HttpTransaction . SERVER_SEND
173173 } )
174174
175- var isSampled = trace . isSampled || ( 1 / this . sampleRate ) > Math . random ( )
176- if ( data . mustCollect || isSampled ) {
177- trace . isForceSampled = ! ! data . mustCollect
178- delete trace . isSampled
179-
175+ trace . isSampled = ( 1 / this . sampleRate ) > Math . random ( )
176+ trace . isForceSampled = trace . isForceSampled || ! ! data . mustCollect
177+ if ( trace . isForceSampled || trace . isSampled ) {
180178 this . traces . push ( trace )
181179 }
182180
Original file line number Diff line number Diff line change @@ -392,6 +392,7 @@ describe('The HttpTransaction module', function () {
392392 span : url ,
393393 host : host ,
394394 trace : id ,
395+ isSampled : true ,
395396 isForceSampled : false ,
396397 service : service ,
397398 statusCode : 301 ,
You can’t perform that action at this time.
0 commit comments