Comments (7)
Same here! Node v14.15.2
Warning: Accessing non-existent property '__ddProbeAttached__' of module exports inside circular dependency
from appmetrics.
Same here, Node v14.16.1
from appmetrics.
It's internal code unfortunately (so I cannot share it at this time), but my team managed to replace the appmetrics module completely in Node.js 14.x using methods available in the standard library
from appmetrics.
Any update on this issue?
from appmetrics.
@jokeyrhyme can you explain how you removed this package and got the required metrics?
from appmetrics.
- we have setTimeout/setInterval jobs that use
os.cpus()
,os.freemem()
,os.totalmem()
,perf_hooks.PerformanceObserver
,perf_hooks.monitorEventLoopDelay()
, etc to collect data - and we have some conversion logic to turn this data into values that correspond to appmetrics.eventloop.latency.* , appmetrics.gc.* , appmetrics.loop.* , appmetrics.memory.*
- we have completely dropped appmetrics (mostly out of necessity, since it seems abandoned and incompatible with modern Node.js)
from appmetrics.
this is what i could come up with
// timer start time
let trackingTime = process.hrtime();
// last cpu usage to get difference from current cpu usage (the diff will give usage over timer period)
let lastCpuUsage = process.cpuUsage();
// histogram for event loop monitoring
const histogram = perf_hooks.monitorEventLoopDelay();
histogram.enable();
// monitor cpu, memory, event loop
const monitor = () => {
// end time for the timer (diff from start time by passing as arg)
// hrtime gives nanosecond resolution ([0] seconds, [1] remaining nanoseconds)
const delta = process.hrtime(trackingTime);
const nanosec = delta[0] * 1e9 + delta[1];
// get cpu usage (user and system)
const cpuUsage = process.cpuUsage();
// diff from last cpu usage to get % usage over timer interval
const userUsage = ((cpuUsage.user - lastCpuUsage.user) / nanosec) * 1000;
const systemUsage = ((cpuUsage.system - lastCpuUsage.system) / nanosec) * 1000;
transportClient.gauge('cpu.process', userUsage);
transportClient.gauge('cpu.system', systemUsage);
// update last cpu usage for next timer cycle
lastCpuUsage = cpuUsage;
// get process memory usage
// Resident Set Size, is the amount of space occupied in the main memory device
// (that is a subset of the total allocated memory) for the process
// including all C++ and JavaScript objects and code
const memoryUsage = process.memoryUsage();
transportClient.gauge('memory.process.physical', memoryUsage.rss);
transportClient.gauge('eventloop.latency.min', histogram.min / 1e6);
transportClient.gauge('eventloop.latency.max', histogram.max / 1e6);
transportClient.gauge('eventloop.latency.avg', histogram.mean / 1e6);
// reset histogram to start new cycle
histogram.reset();
// update timer time for getting diff for next cycle
trackingTime = process.hrtime();
};
// collect process metrics every 5 seconds
setInterval(monitor, 5000);
any comments are welcome
from appmetrics.
Related Issues (20)
- Man-in-the-Middle vulnerability in dependency https-proxy-agent HOT 2
- Including appmetrics breaks promisified setTimeout HOT 1
- Windows automated tests broken on all node versions except 10
- Unable to install appmetrics HOT 15
- Probably stupid question, but is it supposed to run via HTTPS? HOT 17
- Build fails with GCC version 10.1.0 HOT 4
- Outdated node-gyp dependency throws error upon npm i HOT 1
- monitor HTTP HOT 2
- install appmetrics failed with node 14 HOT 5
- 5.1.1 segfaults node HOT 2
- SHA-1 Weak Authentication Algorithm vulnerability in dependency "request" HOT 6
- Error with node:14-alpine3.13 image HOT 3
- incompatible with socket.io@3 and @4 - Exception thrown "TypeError: Cannot read property 'on' of undefined" HOT 5
- unable to install on Fedora 34 HOT 5
- Unable to install library from npm HOT 5
- Error with node:14.17.6-alpine3.14 image HOT 1
- Prototype pollution vulnerability in `[email protected]`
- Can't compile HOT 2
- is this being maintained? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appmetrics.