Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

nodejs-express: appsody build provides limited metrics #725

Closed
Kamran64 opened this issue Mar 20, 2020 · 0 comments · Fixed by #726
Closed

nodejs-express: appsody build provides limited metrics #725

Kamran64 opened this issue Mar 20, 2020 · 0 comments · Fixed by #726
Assignees
Labels
stack/nodejs-express Issues related to nodejs-express stack
Milestone

Comments

@Kamran64
Copy link
Collaborator

Kamran64 commented Mar 20, 2020

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:

  1. Initialise a nodejs-express project
  2. appsody build and run the built app
  3. See the lack of metrics at the /metrics endpoint
  4. 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
@Kamran64 Kamran64 added the stack/nodejs-express Issues related to nodejs-express stack label Mar 20, 2020
@Kamran64 Kamran64 self-assigned this Mar 20, 2020
@neeraj-laad neeraj-laad added this to the Milestone-19 milestone Mar 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stack/nodejs-express Issues related to nodejs-express stack
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants