@opentelemetry/instrumentation-hapi
Advanced tools
Comparing version 0.23.0 to 0.24.0
@@ -20,2 +20,3 @@ "use strict"; | ||
const api = require("@opentelemetry/api"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const instrumentation_1 = require("@opentelemetry/instrumentation"); | ||
@@ -262,2 +263,8 @@ const version_1 = require("./version"); | ||
} | ||
const rpcMetadata = core_1.getRPCMetadata(api.context.active()); | ||
if ((rpcMetadata === null || rpcMetadata === void 0 ? void 0 : rpcMetadata.type) === core_1.RPCType.HTTP) { | ||
const rootSpanMetadata = utils_1.getRootSpanMetadata(route); | ||
rpcMetadata.span.updateName(rootSpanMetadata.name); | ||
rpcMetadata.span.setAttributes(rootSpanMetadata.attributes); | ||
} | ||
const metadata = utils_1.getRouteMetadata(route, pluginName); | ||
@@ -264,0 +271,0 @@ const span = instrumentation.tracer.startSpan(metadata.name, { |
@@ -13,2 +13,6 @@ import { SpanAttributes } from '@opentelemetry/api'; | ||
}; | ||
export declare const getRootSpanMetadata: (route: Hapi.ServerRoute) => { | ||
attributes: SpanAttributes; | ||
name: string; | ||
}; | ||
export declare const getExtMetadata: (extPoint: Hapi.ServerRequestExtType, pluginName?: string | undefined) => { | ||
@@ -15,0 +19,0 @@ attributes: SpanAttributes; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getExtMetadata = exports.getRouteMetadata = exports.isPatchableExtMethod = exports.isDirectExtInput = exports.isLifecycleExtEventObj = exports.isLifecycleExtType = exports.getPluginName = void 0; | ||
exports.getExtMetadata = exports.getRootSpanMetadata = exports.getRouteMetadata = exports.isPatchableExtMethod = exports.isDirectExtInput = exports.isLifecycleExtEventObj = exports.isLifecycleExtType = exports.getPluginName = void 0; | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
@@ -76,2 +76,11 @@ const types_1 = require("./types"); | ||
exports.getRouteMetadata = getRouteMetadata; | ||
const getRootSpanMetadata = (route) => { | ||
return { | ||
attributes: { | ||
[semantic_conventions_1.SemanticAttributes.HTTP_ROUTE]: route.path, | ||
}, | ||
name: `${route.method} ${route.path}`, | ||
}; | ||
}; | ||
exports.getRootSpanMetadata = getRootSpanMetadata; | ||
const getExtMetadata = (extPoint, pluginName) => { | ||
@@ -78,0 +87,0 @@ if (pluginName) { |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.23.0"; | ||
export declare const VERSION = "0.24.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.23.0'; | ||
exports.VERSION = '0.24.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-hapi", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"description": "OpenTelemetry Hapi automatic instrumentation package.", | ||
@@ -35,2 +35,3 @@ "main": "build/src/index.js", | ||
"build/src/**/*.js", | ||
"build/src/**/*.js.map", | ||
"build/src/**/*.d.ts", | ||
@@ -50,8 +51,8 @@ "doc", | ||
"@opentelemetry/api": "1.0.1", | ||
"@opentelemetry/context-async-hooks": "0.23.0", | ||
"@opentelemetry/node": "0.23.0", | ||
"@opentelemetry/tracing": "0.23.0", | ||
"@opentelemetry/context-async-hooks": "0.24.0", | ||
"@opentelemetry/node": "0.24.0", | ||
"@opentelemetry/tracing": "0.24.0", | ||
"@types/mocha": "7.0.2", | ||
"@types/node": "14.17.4", | ||
"codecov": "3.8.2", | ||
"@types/node": "14.17.5", | ||
"codecov": "3.8.3", | ||
"gts": "3.1.0", | ||
@@ -66,7 +67,8 @@ "mocha": "7.2.0", | ||
"dependencies": { | ||
"@opentelemetry/instrumentation": "^0.23.0", | ||
"@opentelemetry/semantic-conventions": "^0.23.0", | ||
"@types/hapi__hapi": "20.0.8" | ||
"@opentelemetry/core": "^0.24.0", | ||
"@opentelemetry/instrumentation": "^0.24.0", | ||
"@opentelemetry/semantic-conventions": "^0.24.0", | ||
"@types/hapi__hapi": "20.0.9" | ||
}, | ||
"gitHead": "eea5f3ef0382c3c8f6d5aca796e3babf7ad4a6c8" | ||
"gitHead": "e4757035a7b4012703a98b5609b8ac0f859e9726" | ||
} |
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
58740
21
621
5
+ Added@opentelemetry/core@^0.24.0
+ Added@opentelemetry/api-metrics@0.24.0(transitive)
+ Added@opentelemetry/core@0.24.0(transitive)
+ Added@opentelemetry/instrumentation@0.24.0(transitive)
+ Added@opentelemetry/semantic-conventions@0.24.0(transitive)
+ Added@types/hapi__hapi@20.0.9(transitive)
- Removed@opentelemetry/api-metrics@0.23.0(transitive)
- Removed@opentelemetry/instrumentation@0.23.0(transitive)
- Removed@opentelemetry/semantic-conventions@0.23.0(transitive)
- Removed@types/hapi__hapi@20.0.8(transitive)
Updated@types/hapi__hapi@20.0.9