Describe the bug
As we are now using npm install --production in the final image build, the metrics shown in the /metrics endpoint seem to be limited:
# HELP os_cpu_used_ratio The ratio of the systems CPU that is currently used (values are 0-1)
# TYPE os_cpu_used_ratio gauge
os_cpu_used_ratio 0.0309476
# HELP process_cpu_used_ratio The ratio of the process CPU that is currently used (values are 0-1)
# TYPE process_cpu_used_ratio gauge
process_cpu_used_ratio 0.000952232
# HELP os_resident_memory_bytes OS memory size in bytes.
# TYPE os_resident_memory_bytes gauge
os_resident_memory_bytes 4169146368
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 50262016
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1291042816
It looks like this is because appmetrics is being loaded too late. This isn't a problem during appsody run as it gets loaded by appmetrics-dash whereas in prod mode this happens later. (line 13 of server.js):
if (!PRODUCTION) {
require('appmetrics-dash').monitor({server, app});
}
To Reproduce
Steps to reproduce the behavior:
Initialise a nodejs-express project
appsody build and run the built app
See the lack of metrics at the /metrics endpoint
Compare with appsody run /metrics endpoint to see the difference
Environment Details (please complete the following information):
OS: macOS
If applicable please specify:
CLI version: 0.5.9
Stack you are using (including the version): nodejs-express 0.4.5
Describe the bug As we are now using
npm install --production
in the final image build, the metrics shown in the/metrics
endpoint seem to be limited:It looks like this is because appmetrics is being loaded too late. This isn't a problem during
appsody run
as it gets loaded byappmetrics-dash
whereas in prod mode this happens later. (line 13 ofserver.js
):To Reproduce Steps to reproduce the behavior:
appsody build
and run the built appappsody run
/metrics endpoint to see the differenceEnvironment Details (please complete the following information):
If applicable please specify: