Socket
Socket
Sign inDemoInstall

@sentry/profiling-node

Package Overview
Dependencies
Maintainers
12
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/profiling-node - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

binaries/sentry_cpu_profiler-v111-darwin-x64.node

2

lib/cpu_profiler.d.ts

@@ -36,3 +36,3 @@ export declare function importCppBindingsModule(): PrivateV8CpuProfilerBindings;

startProfiling(name: string): void;
stopProfiling(name: string, threadId: number): RawThreadCpuProfile | null;
stopProfiling(name: string, threadId: number, projectRootDir: string | null): RawThreadCpuProfile | null;
}

@@ -39,0 +39,0 @@ interface V8CpuProfilerBindings {

@@ -11,2 +11,3 @@ "use strict";

const worker_threads_1 = require("worker_threads");
const utils_1 = require("./utils");
function importCppBindingsModule() {

@@ -17,2 +18,5 @@ const name = `sentry_cpu_profiler-v${node_abi_1.default.getAbi(process.versions.node, 'node')}-${os_1.default.platform()}-${os_1.default.arch()}.node`;

exports.importCppBindingsModule = importCppBindingsModule;
// Resolve the project root dir so we can try and compute a filename relative to it.
// We forward this to C++ code so we dont end up post-processing frames in JS.
const projectRootDirectory = (0, utils_1.getProjectRootDirectory)();
const privateBindings = importCppBindingsModule();

@@ -24,5 +28,5 @@ const CpuProfilerBindings = {

stopProfiling(name) {
return privateBindings.stopProfiling(name, worker_threads_1.threadId);
return privateBindings.stopProfiling(name, worker_threads_1.threadId, projectRootDirectory);
}
};
exports.CpuProfilerBindings = CpuProfilerBindings;

@@ -23,2 +23,6 @@ "use strict";

const uniqueTransactionName = `${transactionContext.name} ${(0, utils_1.uuid4)()}`;
// profilesSampleRate is multiplied with tracesSampleRate to get the final sampling rate.
if (!transaction.sampled) {
return transaction;
}
if (profilesSampleRate === undefined) {

@@ -25,0 +29,0 @@ if ((0, env_1.isDebugBuild)()) {

@@ -54,1 +54,2 @@ import type { SdkMetadata, DsnComponents, Event, EventEnvelope } from '@sentry/types';

export declare function maybeRemoveProfileFromSdkMetadata(event: Event | ProfiledEvent): Event;
export declare function getProjectRootDirectory(): string | null;

@@ -6,6 +6,12 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.maybeRemoveProfileFromSdkMetadata = exports.isProfiledTransactionEvent = exports.createProfilingEventEnvelope = exports.enrichWithThreadInformation = void 0;
exports.getProjectRootDirectory = exports.maybeRemoveProfileFromSdkMetadata = exports.isProfiledTransactionEvent = exports.createProfilingEventEnvelope = exports.enrichWithThreadInformation = void 0;
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
const worker_threads_1 = require("worker_threads");
const utils_1 = require("@sentry/utils");
const env_1 = require("./env");
// We require the file because if we import it, it will be included in the bundle.
// I guess tsc does not check file contents when it's imported.
// eslint-disable-next-line
const { root_directory } = require('./../root.js');
const THREAD_ID_STRING = String(worker_threads_1.threadId);

@@ -72,3 +78,3 @@ const THREAD_NAME = worker_threads_1.isMainThread ? 'main' : 'worker';

function createProfilingEventEnvelope(event, dsn, metadata, tunnel) {
var _a, _b, _c, _d, _e;
var _a, _b, _c, _d;
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);

@@ -89,2 +95,19 @@ const rawProfile = event.sdkProcessingMetadata['profile'];

const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : Date.now();
const traceId = (_c = (_b = (_a = event === null || event === void 0 ? void 0 : event.contexts) === null || _a === void 0 ? void 0 : _a['trace']) === null || _b === void 0 ? void 0 : _b['trace_id']) !== null && _c !== void 0 ? _c : '';
// Log a warning if the profile has an invalid traceId (should be uuidv4).
// All profiles and transactions are rejected if this is the case and we want to
// warn users that this is happening if they enable debug flag
if ((0, env_1.isDebugBuild)()) {
if (traceId.length !== 32) {
utils_1.logger.log('[Profiling] Invalid traceId: ' + traceId + ' on profiled event');
}
}
// Log a warning if the profile has less than 2 samples so users can know why
// they are not seeing any profiling data and we cant avoid the back and forth
// of asking them to provide us with a dump of the profile data.
if ((0, env_1.isDebugBuild)()) {
if (enrichedThreadProfile.samples.length <= 1) {
utils_1.logger.log('[Profiling] Profile has less than 2 samples');
}
}
const profile = {

@@ -95,6 +118,6 @@ event_id: (0, utils_1.uuid4)(),

version: '1',
release: ((_a = event.sdk) === null || _a === void 0 ? void 0 : _a.version) || 'unknown',
release: event.release || '',
runtime: {
name: 'node',
version: process.versions.node || 'unknown'
version: process.versions.node || ''
},

@@ -107,3 +130,3 @@ os: {

device: {
locale: (_b = (process.env['LC_ALL'] || process.env['LC_MESSAGES'] || process.env['LANG'] || process.env['LANGUAGE'])) !== null && _b !== void 0 ? _b : 'unknown locale',
locale: (_d = (process.env['LC_ALL'] || process.env['LC_MESSAGES'] || process.env['LANG'] || process.env['LANGUAGE'])) !== null && _d !== void 0 ? _d : '',
model: MODEL,

@@ -119,3 +142,3 @@ manufacturer: TYPE,

id: event.event_id || (0, utils_1.uuid4)(),
trace_id: (_e = (_d = (_c = event === null || event === void 0 ? void 0 : event.contexts) === null || _c === void 0 ? void 0 : _c['trace']) === null || _d === void 0 ? void 0 : _d['trace_id']) !== null && _e !== void 0 ? _e : '',
trace_id: traceId,
active_thread_id: THREAD_ID_STRING,

@@ -129,3 +152,2 @@ relative_start_ns: '0',

{
// @ts-expect-error profile is not yet a type in @sentry/types
type: 'profile'

@@ -154,1 +176,9 @@ },

exports.maybeRemoveProfileFromSdkMetadata = maybeRemoveProfileFromSdkMetadata;
// Requires the root.js file which exports __dirname, this is then forwarded to our native
// addon where we remove the absolute path from each frame to generate a project relatvie filename
function getProjectRootDirectory() {
var _a;
const components = path_1.default.resolve(root_directory).split('/node_modules');
return (_a = components === null || components === void 0 ? void 0 : components[0]) !== null && _a !== void 0 ? _a : null;
}
exports.getProjectRootDirectory = getProjectRootDirectory;
{
"name": "@sentry/profiling-node",
"version": "0.0.12",
"version": "0.0.13",
"description": "Sampling based nodejs profiler.",

@@ -12,3 +12,3 @@ "main": "lib/index.js",

"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},

@@ -19,2 +19,3 @@ "files": [

"binding.gyp",
"root.js",
"LICENSE",

@@ -36,3 +37,3 @@ "README.md",

"build": "npm run build:bindings && npm run build:lib",
"build:lib": "tsc",
"build:lib": "tsc -p ./tsconfig.json",
"build:configure": "node-gyp configure",

@@ -61,7 +62,7 @@ "build:bindings": "node-gyp build",

"dependencies": {
"@sentry/hub": "^7.16.0",
"@sentry/node": "^7.16.0",
"@sentry/hub": "^7.31.1",
"@sentry/node": "^7.31.1",
"@sentry/tracing": "^7.16.0",
"@sentry/types": "^7.16.0",
"@sentry/utils": "^7.16.0",
"@sentry/types": "^7.31.1",
"@sentry/utils": "^7.31.1",
"nan": "^2.17.0",

@@ -68,0 +69,0 @@ "node-abi": "^3.28.0",

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc