@appsignal/nodejs
Advanced tools
Comparing version
@@ -18,3 +18,3 @@ "use strict"; | ||
function optionsToOriginString(options) { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b, _c, _d, _e, _f; | ||
let protocol = "http:"; | ||
@@ -33,3 +33,3 @@ let hostname = "localhost"; | ||
protocol = (_d = options.protocol) !== null && _d !== void 0 ? _d : protocol; | ||
hostname = (_e = options.hostname) !== null && _e !== void 0 ? _e : hostname; | ||
hostname = (_f = (_e = options.hostname) !== null && _e !== void 0 ? _e : options.host) !== null && _f !== void 0 ? _f : hostname; | ||
} | ||
@@ -36,0 +36,0 @@ return `${protocol}//${hostname}`; |
@@ -153,3 +153,4 @@ "use strict"; | ||
else { | ||
extension_wrapper_1.span.closeSpan(this._ref); | ||
const { sec, nsec } = utils_1.hrTime(); | ||
extension_wrapper_1.span.closeSpanWithTimestamp(this._ref, sec, nsec); | ||
return this; | ||
@@ -188,3 +189,4 @@ } | ||
else { | ||
this._ref = extension_wrapper_1.span.createChildSpan(spanOrContext.ref()); | ||
const { sec, nsec } = utils_1.hrTime(); | ||
this._ref = extension_wrapper_1.span.createChildSpanWithTimestamp(spanOrContext.ref(), sec, nsec); | ||
} | ||
@@ -211,3 +213,4 @@ } | ||
else { | ||
this._ref = extension_wrapper_1.span.createRootSpan(namespace); | ||
const { sec, nsec } = utils_1.hrTime(); | ||
this._ref = extension_wrapper_1.span.createRootSpanWithTimestamp(namespace, sec, nsec); | ||
} | ||
@@ -214,0 +217,0 @@ } |
@@ -0,1 +1,3 @@ | ||
/// <reference types="node" /> | ||
import perf_hooks from "perf_hooks"; | ||
/** | ||
@@ -23,1 +25,10 @@ * Retrieve a valid version number from a `package.json` in a given | ||
export declare function isWritable(path: string): boolean; | ||
/** | ||
* Returns a high-resolution time tuple containing the current time in seconds and nanoseconds. | ||
* | ||
* @function | ||
*/ | ||
export declare function hrTime(performance?: perf_hooks.Performance): { | ||
sec: number; | ||
nsec: number; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isWritable = exports.getAgentTimestamps = exports.getPackageVerson = void 0; | ||
exports.hrTime = exports.isWritable = exports.getAgentTimestamps = exports.getPackageVerson = void 0; | ||
const tslib_1 = require("tslib"); | ||
const fs_1 = tslib_1.__importDefault(require("fs")); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const perf_hooks_1 = tslib_1.__importDefault(require("perf_hooks")); | ||
const NANOSECOND_DIGITS = 9; | ||
const SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS); | ||
/** | ||
@@ -51,1 +54,19 @@ * Retrieve a valid version number from a `package.json` in a given | ||
exports.isWritable = isWritable; | ||
/** | ||
* Returns a high-resolution time tuple containing the current time in seconds and nanoseconds. | ||
* | ||
* @function | ||
*/ | ||
function hrTime(performance = perf_hooks_1.default.performance) { | ||
const origin = numberToHrtime(performance.timeOrigin); | ||
const now = numberToHrtime(performance.now()); | ||
return { sec: origin[0] + now[0], nsec: origin[1] + now[1] }; | ||
} | ||
exports.hrTime = hrTime; | ||
function numberToHrtime(epochMillis) { | ||
const epochSeconds = epochMillis / 1000; | ||
const seconds = Math.trunc(epochSeconds); | ||
const nanoseconds = Number((epochSeconds - seconds).toFixed(NANOSECOND_DIGITS)) * | ||
SECOND_TO_NANOSECONDS; | ||
return [seconds, nanoseconds]; | ||
} |
{ | ||
"name": "@appsignal/nodejs", | ||
"version": "2.3.4", | ||
"version": "2.3.5", | ||
"main": "dist/index", | ||
@@ -40,3 +40,3 @@ "types": "dist/index", | ||
"clean:ext": "rimraf ext/appsignal-agent ext/libappsignal.a ext/appsignal.* ext/*.tar.gz ext/*.report", | ||
"preinstall": "if test -d src; then npm run build; fi", | ||
"preinstall": "node scripts/extension/prebuild.js", | ||
"install": "node scripts/extension/extension.js", | ||
@@ -43,0 +43,0 @@ "link:npm": "npm link", |
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
420359
0.43%100
1.01%4805
1.31%25
8.7%7
16.67%