@hypertrace/nodejsagent
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -14,15 +14,15 @@ "use strict"; | ||
Logging_1.logger.debug(event); | ||
let apiGatewayVersion = event["version"]; | ||
if (apiGatewayVersion === "2.0") { | ||
if (lambdaRequestContext['http']) { | ||
let httpContext = lambdaRequestContext['http']; | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_METHOD, httpContext['method']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_SCHEME, headers['x-forwarded-proto']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_TARGET, httpContext['path']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_HOST, headers['host']); | ||
} | ||
// event["version"] is not always present | ||
// the request context will have an `http` field if v2 | ||
if (lambdaRequestContext['http']) { | ||
let httpContext = lambdaRequestContext['http']; | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_METHOD, httpContext['method']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_SCHEME, headers['x-forwarded-proto']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_TARGET, httpContext['path']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_HOST, headers['host']); | ||
} | ||
else if (apiGatewayVersion === "1.0") { | ||
else { | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_METHOD, event['httpMethod']); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_SCHEME, headers['x-forwarded-proto']); | ||
let proto_header = headers['x-forwarded-proto'] || headers['X-Forwarded-Proto']; | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_SCHEME, proto_header); | ||
span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_TARGET, event['path']); | ||
@@ -29,0 +29,0 @@ span.setAttribute(semantic_conventions_1.SemanticAttributes.HTTP_HOST, lambdaRequestContext['domainName']); |
{ | ||
"name": "@hypertrace/nodejsagent", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Hypertrace Node.js Agent", | ||
@@ -5,0 +5,0 @@ "author": "Traceable Inc.", |
408154