@hypertrace/nodejsagent
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -49,4 +49,9 @@ "use strict"; | ||
span.setStatus({ code: api_1.SpanStatusCode.UNSET }); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.RPC_GRPC_STATUS_CODE, api_1.SpanStatusCode.OK.toString() // this wasn't matching server behavior of unset = Ok | ||
); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.RPC_GRPC_STATUS_CODE, 0); | ||
// This will set a SpanStatus=1 which is different from grpc status | ||
// if no error, use grpc 0 for OK | ||
// span.setAttribute( | ||
// SemanticAttributes.RPC_GRPC_STATUS_CODE, | ||
// SpanStatusCode.OK.toString() // this wasn't matching server behavior of unset = Ok | ||
// ); | ||
} | ||
@@ -53,0 +58,0 @@ span.end(); |
@@ -109,2 +109,3 @@ "use strict"; | ||
let bodyCapture = createAndAddBodyCapture(span, call.request, 'request'); | ||
setPeerData(span, call); | ||
let filterResult = Registry_1.Registry.getInstance().applyFilters(span, name, call.metadata.getMap(), bodyCapture === null || bodyCapture === void 0 ? void 0 : bodyCapture.processableString(), Filter_1.REQUEST_TYPE.RPC); | ||
@@ -176,2 +177,4 @@ if (filterResult) { | ||
}); | ||
span.setAttribute("rpc.system", "grpc"); | ||
span.setAttribute("grpc.content_type", "application/grpc"); | ||
addMetadataToSpan(span, metadata, 'request'); | ||
@@ -217,2 +220,16 @@ createAndAddBodyCapture(span, args[0], 'request'); | ||
exports.addMetadataToSpan = addMetadataToSpan; | ||
function setPeerData(span, call) { | ||
let socket = call.call.stream.session.socket; | ||
if (!socket) { | ||
return; | ||
} | ||
const remoteAddress = socket.remoteAddress; | ||
const remotePort = socket.remotePort; | ||
if (remoteAddress) { | ||
span.setAttribute("net.peer.ip", remoteAddress); | ||
} | ||
if (remotePort) { | ||
span.setAttribute("net.peer.port", remotePort); | ||
} | ||
} | ||
function createAndAddBodyCapture(span, bodyObject, type) { | ||
@@ -219,0 +236,0 @@ try { |
@@ -95,4 +95,12 @@ "use strict"; | ||
span.setStatus({ code: api_1.SpanStatusCode.UNSET }); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.RPC_GRPC_STATUS_CODE, api_1.SpanStatusCode.OK.toString()); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.RPC_GRPC_STATUS_CODE, 0); | ||
// This will set a SpanStatus which is different from grpc status | ||
// if no error, use grpc 0 for OK | ||
// span.setAttribute( | ||
// SemanticAttributes.RPC_GRPC_STATUS_CODE, | ||
// SpanStatusCode.OK.toString() | ||
// ); | ||
} | ||
span.setAttribute("rpc.system", "grpc"); | ||
span.setAttribute("grpc.content_type", "application/grpc"); | ||
(0, GrpcJsHypertraceInstrumentation_1.createAndAddBodyCapture)(span, value, 'response'); | ||
@@ -99,0 +107,0 @@ span.end(); |
{ | ||
"name": "@hypertrace/nodejsagent", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Hypertrace Node.js Agent", | ||
@@ -5,0 +5,0 @@ "author": "Traceable Inc.", |
409358
7507