New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

whatap

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whatap - npm Package Compare versions

Comparing version 0.4.92 to 0.4.93

2

lib/conf/config-default.js

@@ -39,3 +39,3 @@ /**

"trace_auto_service_backstack_enabled": true,
"trace_background_socket_enabled": true,
"trace_background_socket_enabled": bool('trace_background_socket_enabled', true),
"trace_node_schedule_enabled": bool('trace_node_schedule_enabled',false),

@@ -42,0 +42,0 @@ "trace_active_callstack_depth": 40,

@@ -8,21 +8,22 @@ /**

var TraceContextManager = require('../trace/trace-context-manager'),
SocketStep = require('../step/socket-step'),
conf = require('../conf/configure'),
IPUtil = require('../util/iputil'),
Logger = require('../logger');
SocketStep = require('../step/socket-step'),
conf = require('../conf/configure'),
IPUtil = require('../util/iputil'),
Logger = require('../logger');
var NetObserver = function (agent) {
var trace_background_socket_enabled = conf.getProperty('trace_background_socket_enabled', false);
conf.on('trace_background_socket_enabled', function (newProps) {
trace_background_socket_enabled = newProps;
})
var NetObserver = function(agent){
this.agent = agent;
this.packages = ['net', 'dgram'];
this.packages = ['net'];
};
NetObserver.prototype.inject = function (mod, moduleName) {
if (mod.__whatap_observe__) {
return;
}
if(mod.__whatap_observe__) { return; }
mod.__whatap_observe__ = true;
Logger.initPrint("NetObserver");
if (conf.trace_background_socket_enabled === false) {
return;
}
if ( !trace_background_socket_enabled ) { return; }

@@ -35,17 +36,18 @@ var self = this;

var ctx = lctx.context;
if (ctx == null) {
if(!ctx || !trace_background_socket_enabled){
return;
}
var host, port;
if (args.length > 1) {
host = args[1];
port = args[0];
var info, host, port;
if(args.length > 0){
info = args[0];
host = info.host;
port = info.port;
}
if (port == undefined) {
if(port == undefined){
lctx.step = null;
return;
}
ctx.socket_connecting = true;
ctx.socket_connecting=true;
ctx.footprint('Socket Connecting: ' + host + ':' + port);
ctx.footprint('Socket Connecting: ' + host+':'+port);

@@ -56,2 +58,7 @@ var step = new SocketStep();

step.port = port;
// obj.on('lookup', function(err, ip, addressType){
// if(step != null) {
// step.ipaddr = new Buffer(IPUtil.stringToBytes(ip));
// }
// });
ctx.profile.push(step);

@@ -63,6 +70,6 @@ lctx.step = step;

var step = lctx.step;
if (ctx == null || step == null) {
if(!ctx || !step || !trace_background_socket_enabled){
return;
}
ctx.socket_connecting = false;
ctx.socket_connecting=false;
step.elapsed = ctx.getElapsedTime() - step.start_time;

@@ -72,44 +79,4 @@ ctx.footprint('Socket Connecting Done');

);
aop.both(mod, ['createSocket'],
function (obj, args, lctx) {
var ctx = lctx.context;
if (ctx == null) {
return;
}
},
function (obj, args, ret, lctx) {
var ctx = lctx.context;
if (ctx == null) {
return;
}
aop.after(ret, 'send', function (_obj, _args, _ret, _lctx) {
var host, port;
if (_args.length > 2) {
host = _args[2];
port = _args[1];
}
if (port == undefined) {
lctx.step = null;
return;
}
ctx.socket_connecting = true;
ctx.footprint('Socket Connecting: ' + host + ':' + port);
var step = new SocketStep();
step.start_time = ctx.getElapsedTime();
step.ipaddr = Buffer.from(IPUtil.stringToBytes(host));
step.port = port;
ctx.socket_connecting = false;
step.elapsed = ctx.getElapsedTime() - step.start_time;
ctx.profile.push(step);
ctx.footprint('Socket Connecting Done');
})
}
);
};
exports.NetObserver = NetObserver;

@@ -36,15 +36,19 @@ /**

IPUtil.prototype.stringToBytes = function (ipStr) {
if(ipStr ===null || ipStr === undefined){
try{
if (ipStr === null || ipStr === undefined) {
return emptyBytes;
}
var ipArr = ipStr.split(".");
if (ipArr.length < 4)
return emptyBytes;
var buf = [0, 0, 0, 0];
buf[0] = wordToInt(ipArr[0]) & 0xFF;
buf[1] = wordToInt(ipArr[1]) & 0xFF;
buf[2] = wordToInt(ipArr[2]) & 0xFF;
buf[3] = wordToInt(ipArr[3]) & 0xFF;
return buf;
}catch (e) {
return emptyBytes;
}
var ipArr = ipStr.split(".");
if (ipArr.length < 4)
return emptyBytes;
var buf = [0,0,0,0];
buf[0] = wordToInt(ipArr[0]) & 0xFF;
buf[1] = wordToInt(ipArr[1]) & 0xFF;
buf[2] = wordToInt(ipArr[2]) & 0xFF;
buf[3] = wordToInt(ipArr[3]) & 0xFF;
return buf;
}

@@ -51,0 +55,0 @@

{
"name": "whatap",
"homepage": "http://www.whatap.io",
"version": "0.4.92",
"releaseDate": "20240206",
"version": "0.4.93",
"releaseDate": "20240214",
"description": "Monitoring and Profiling Service",

@@ -7,0 +7,0 @@ "main": "index.js",

@@ -10,3 +10,3 @@

*Node.js 지원 버젼: 4.3.2 이상
*Node.js 지원 버젼: 16.4.0 이상

@@ -19,3 +19,3 @@ ![step01](http://apm.whatap.io/images/icon_step01.png)

$ npm install --save whatap
$ npm install whatap

@@ -42,7 +42,18 @@

루트 디렉토리의 Node.js Application에 다음과 같은 코드를 추가 해 주세요.
루트 디렉토리에 위치한 Node.js 애플리케이션에서 Whatap 모니터링 기능을 활성화하려면,
애플리케이션의 진입점 파일에 Whatap 에이전트를 초기화하는 코드를 추가해야 합니다.
Node.js 애플리케이션에 Whatap 모니터링을 적용하는 방법은 모듈 시스템의 종류(CommonJS 또는 ECMAScript Modules, ESM)에 따라 약간 다릅니다. 아래에서는 두 가지 모듈 시스템에 대해 Whatap 에이전트를 초기화하고 사용하는 방법을 설명합니다.
#### CommonJS 모듈 시스템 사용 시
Whatap 에이전트를 CommonJS 방식으로 가져오고 초기화하려면, 다음 코드를 애플리케이션의 진입점 파일에 추가하세요:
var WhatapAgent = require('whatap').NodeAgent;
#### ECMAScript 모듈(ESM) 시스템 사용 시
ESM 방식으로 Whatap 에이전트를 가져오고 사용하려면, 다음과 같이 코드를 작성하세요:
import WhatapAgent from 'whatap';
WhatapAgent.NodeAgent;

@@ -49,0 +60,0 @@ ![step04](http://apm.whatap.io/images/icon_step04.png)

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