@opentelemetry/instrumentation-http
Advanced tools
Comparing version 0.35.1 to 0.36.0
@@ -45,3 +45,2 @@ /// <reference types="node" /> | ||
* @param request The original request object. | ||
* @param options The arguments to the original function. | ||
* @param span representing the current operation | ||
@@ -48,0 +47,0 @@ * @param startTime representing the start time of the request to calculate duration in Metric |
@@ -28,2 +28,3 @@ "use strict"; | ||
const events_1 = require("events"); | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
/** | ||
@@ -186,3 +187,2 @@ * Http instrumentation instrumentation for Opentelemetry | ||
* @param request The original request object. | ||
* @param options The arguments to the original function. | ||
* @param span representing the current operation | ||
@@ -192,3 +192,3 @@ * @param startTime representing the start time of the request to calculate duration in Metric | ||
*/ | ||
_traceClientRequest(request, hostname, span, startTime, metricAttributes) { | ||
_traceClientRequest(request, span, startTime, metricAttributes) { | ||
if (this._getConfig().requestHook) { | ||
@@ -291,3 +291,3 @@ this._callRequestHook(span, request); | ||
const ctx = api_1.propagation.extract(api_1.ROOT_CONTEXT, headers); | ||
const span = instrumentation._startHttpSpan(`${component.toLocaleUpperCase()} ${method}`, spanOptions, ctx); | ||
const span = instrumentation._startHttpSpan(method, spanOptions, ctx); | ||
const rpcMetadata = { | ||
@@ -362,3 +362,2 @@ type: core_2.RPCType.HTTP, | ||
} | ||
const operationName = `${component.toUpperCase()} ${method}`; | ||
const { hostname, port } = utils.extractHostnameAndPort(optionsParsed); | ||
@@ -377,3 +376,3 @@ const attributes = utils.getOutgoingRequestAttributes(optionsParsed, { | ||
}; | ||
const span = instrumentation._startHttpSpan(operationName, spanOptions); | ||
const span = instrumentation._startHttpSpan(method, spanOptions); | ||
const parentContext = api_1.context.active(); | ||
@@ -403,3 +402,3 @@ const requestContext = api_1.trace.setSpan(parentContext, span); | ||
api_1.context.bind(parentContext, request); | ||
return instrumentation._traceClientRequest(request, hostname, span, startTime, metricAttributes); | ||
return instrumentation._traceClientRequest(request, span, startTime, metricAttributes); | ||
}); | ||
@@ -415,2 +414,6 @@ }; | ||
}); | ||
const route = attributes[semantic_conventions_1.SemanticAttributes.HTTP_ROUTE]; | ||
if (route) { | ||
span.updateName(`${request.method || 'GET'} ${route}`); | ||
} | ||
if (this._getConfig().applyCustomAttributesOnSpan) { | ||
@@ -417,0 +420,0 @@ (0, instrumentation_1.safeExecuteInTheMiddle)(() => this._getConfig().applyCustomAttributesOnSpan(span, request, response), () => { }, true); |
@@ -387,3 +387,3 @@ "use strict"; | ||
if (requestUrl) { | ||
attributes[semantic_conventions_1.SemanticAttributes.HTTP_TARGET] = requestUrl.pathname || '/'; | ||
attributes[semantic_conventions_1.SemanticAttributes.HTTP_TARGET] = requestUrl.path || '/'; | ||
} | ||
@@ -452,2 +452,6 @@ if (userAgent !== undefined) { | ||
spanAttributes[semantic_conventions_1.SemanticAttributes.NET_HOST_PORT]; | ||
if (spanAttributes[semantic_conventions_1.SemanticAttributes.HTTP_ROUTE] !== undefined) { | ||
metricAttributes[semantic_conventions_1.SemanticAttributes.HTTP_ROUTE] = | ||
spanAttributes[semantic_conventions_1.SemanticAttributes.HTTP_ROUTE]; | ||
} | ||
return metricAttributes; | ||
@@ -454,0 +458,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.35.1"; | ||
export declare const VERSION = "0.36.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.35.1'; | ||
exports.VERSION = '0.36.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-http", | ||
"version": "0.35.1", | ||
"version": "0.36.0", | ||
"description": "OpenTelemetry http/https automatic instrumentation package.", | ||
@@ -48,7 +48,7 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@opentelemetry/api": "^1.3.0", | ||
"@opentelemetry/context-async-hooks": "1.9.1", | ||
"@opentelemetry/sdk-metrics": "1.9.1", | ||
"@opentelemetry/sdk-trace-base": "1.9.1", | ||
"@opentelemetry/sdk-trace-node": "1.9.1", | ||
"@opentelemetry/api": "1.4.1", | ||
"@opentelemetry/context-async-hooks": "1.10.0", | ||
"@opentelemetry/sdk-metrics": "1.10.0", | ||
"@opentelemetry/sdk-trace-base": "1.10.0", | ||
"@opentelemetry/sdk-trace-node": "1.10.0", | ||
"@types/mocha": "10.0.0", | ||
@@ -77,5 +77,5 @@ "@types/node": "18.6.5", | ||
"dependencies": { | ||
"@opentelemetry/core": "1.9.1", | ||
"@opentelemetry/instrumentation": "0.35.1", | ||
"@opentelemetry/semantic-conventions": "1.9.1", | ||
"@opentelemetry/core": "1.10.0", | ||
"@opentelemetry/instrumentation": "0.36.0", | ||
"@opentelemetry/semantic-conventions": "1.10.0", | ||
"semver": "^7.3.5" | ||
@@ -85,3 +85,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "279458e7ddf16f7ddca5fe60c78672e05fafce66" | ||
"gitHead": "56e6b1bb890f844b8963a146780d0b9cfa8abd0d" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172803
1336
+ Added@opentelemetry/core@1.10.0(transitive)
+ Added@opentelemetry/instrumentation@0.36.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.10.0(transitive)
+ Addedrequire-in-the-middle@6.0.0(transitive)
- Removed@opentelemetry/core@1.9.1(transitive)
- Removed@opentelemetry/instrumentation@0.35.1(transitive)
- Removed@opentelemetry/semantic-conventions@1.9.1(transitive)
- Removedrequire-in-the-middle@5.2.0(transitive)
Updated@opentelemetry/core@1.10.0