File tree Expand file tree Collapse file tree 5 files changed +13
-3
lines changed Expand file tree Collapse file tree 5 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ IncomingEdgeMetrics.prototype.report = function (data) {
3838 if ( data . transportDelay < 0 ) {
3939 return
4040 }
41- var serviceKey = data . serviceKey === undefined
41+ var serviceKey = data . serviceKey == null
4242 ? 'root' : data . serviceKey
4343 var edge = this . _getEdge ( data . protocol , serviceKey )
4444
Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ Collector.prototype.flush = function () {
155155 return result
156156}
157157
158+ Collector . prototype . setServiceKey = function ( serviceKey ) {
159+ this . serviceKey = serviceKey
160+ this . tracer . setServiceKey ( serviceKey )
161+ }
162+
158163// Purely for cache management
159164Collector . prototype . end = function ( briefcase ) {
160165 if ( ! briefcase ) {
Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ inherits(Tracer, Agent)
3131
3232Tracer . prototype . initialize = function ( opts ) {
3333 Agent . prototype . initialize . call ( this , opts )
34- this . collector . serviceKey = this . serviceKey = opts . serviceKey
34+ this . serviceKey = opts . serviceKey
35+ this . collector . setServiceKey ( opts . serviceKey )
3536}
3637
3738Tracer . prototype . start = function ( ) {
Original file line number Diff line number Diff line change @@ -303,6 +303,10 @@ Tracer.prototype.getTransactionId = function (briefcase) {
303303 return history [ 0 ] [ 1 ] . r
304304}
305305
306+ Tracer . prototype . setServiceKey = function ( serviceKey ) {
307+ this . serviceKey = serviceKey
308+ }
309+
306310module . exports = Tracer
307311module . exports . create = function ( options ) {
308312 return new Tracer ( options )
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ apiCalls.forEach(function (name) {
6565 t . pass ( 'collector sends ' + name )
6666 if ( typeof requestBody === 'object' ) {
6767 t . pass ( 'requestBody is valid JSON' )
68- console . log ( requestBody )
68+ console . log ( JSON . stringify ( requestBody ) )
6969 ok ( )
7070 } else {
7171 var buffer = new Buffer ( requestBody , 'hex' )
You can’t perform that action at this time.
0 commit comments