node.js – How to find individual instances guids from the cloudfoundry

my nodejs application deployed in cloud foundry. I want collect the stats or metrics for individual instances wise.
Like instance status running/stopped/crash
and metrics cpu usage, memory usage, disk usage. I want collect this historically.
I used cloud foundry api v3/processes/:guid/stats to fetch this metrics. In this response not able to find the instance guid.
So tracking of the all time app used instances it’s not possible. 3 instances were running.
If I fetch metrics using endpoint v3/processes/:guid/stats it provided 3 instances metrics without providing instanceguid.
If I use in my app env CF_INSTANCE_GUID it’s fetch particular running instances so matching with the 3 instances also not able.since 3 instances received response.
Using instance index also it’s not possible to track the instances. If I reduce and increase the instance the index will be same for current instance and reduced instance.
So not possible to track and store and identity the stats for instances it’s not possible
Can any help me to track to the all instances like reduced and increased from the application started.

Read more here: Source link