Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display instance internal IP address on Process Stats endpoint #3378

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/presenters/v3/process_stats_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ def instance_stats_hash(index, stats)

def found_instance_stats_hash(index, stats)
{
type: @type,
index: index,
state: stats[:state],
host: stats[:stats][:host],
uptime: stats[:stats][:uptime],
mem_quota: stats[:stats][:mem_quota],
type: @type,
index: index,
state: stats[:state],
host: stats[:stats][:host],
instance_internal_ip: stats[:stats][:net_info][:instance_address],
uptime: stats[:stats][:uptime],
mem_quota: stats[:stats][:mem_quota],
disk_quota: stats[:stats][:disk_quota],
log_rate_limit: stats[:stats][:log_rate_limit],
fds_quota: stats[:stats][:fds_quota],
Expand Down
2 changes: 2 additions & 0 deletions docs/v3/source/includes/api_resources/_processes.erb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"disk": 69705728
},
"host": "10.244.16.10",
"instance_internal_ip": "10.255.93.167",
"instance_ports": [
{
"external": 64546,
Expand Down Expand Up @@ -218,6 +219,7 @@
"disk_quota": null,
"fds_quota": 16384,
"host": "",
"instance_internal_ip": "",
"instance_ports": null,
"isolation_segment": null,
"log_rate_limit": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Name | Type | Description
**usage.disk** | _integer_ | The current disk usage of the instance
**usage.log_rate** | _integer_ | The current logging usage of the instance
**host** | _string_ | The host the instance is running on
**instance_internal_ip** | _string_ | The internal IP address of the instance
**instance_ports** | _object_ | JSON array of port mappings between the network-exposed port used to communicate with the app (`external`) and port opened to the running process that it can listen on (`internal`)
**uptime** | _integer_ | The uptime in seconds for the instance
**mem_quota** | _integer_ | The current maximum memory allocated for the instance; the value is `null` when memory quota data is unavailable
Expand Down
4 changes: 3 additions & 1 deletion spec/request/processes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@
let(:net_info_1) {
{
address: '1.2.3.4',
instance_address: '5.6.7.8',
ports: [
{
host_port: 8080,
Expand Down Expand Up @@ -538,7 +539,8 @@
'disk' => 1024,
'log_rate' => 1024,
},
'host' => 'toast',
'host' => 'toast',
'instance_internal_ip' => '5.6.7.8',
'instance_ports' => [
{
'external' => 8080,
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/presenters/v3/process_stats_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module VCAP::CloudController::Presenters::V3
let(:net_info_1) {
{
address: '1.2.3.4',
instance_address: '5.6.7.8',
ports: [
{
host_port: 8080,
Expand All @@ -31,6 +32,7 @@ module VCAP::CloudController::Presenters::V3
let(:net_info_2) {
{
address: '',
instance_address: '',
ports: nil
}
}
Expand Down Expand Up @@ -116,6 +118,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[0][:details]).to eq(nil)
expect(result[0][:isolation_segment]).to eq('hecka-compliant')
expect(result[0][:host]).to eq('myhost')
expect(result[0][:instance_internal_ip]).to eq('5.6.7.8')
expect(result[0][:instance_ports]).to eq(instance_ports_1)
expect(result[0][:uptime]).to eq(12345)
expect(result[0][:mem_quota]).to eq(process[:memory] * 1024 * 1024)
Expand Down Expand Up @@ -156,6 +159,7 @@ module VCAP::CloudController::Presenters::V3
let(:net_info_1) {
{
address: '1.2.3.4',
instance_address: '5.6.7.8',
ports: [
{
host_port: 8080,
Expand Down Expand Up @@ -193,6 +197,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[0][:details]).to eq(nil)
expect(result[0][:isolation_segment]).to eq('hecka-compliant')
expect(result[0][:host]).to eq('myhost')
expect(result[0][:instance_internal_ip]).to eq('5.6.7.8')
expect(result[0][:instance_ports]).to eq(instance_ports_1)
expect(result[0][:uptime]).to eq(12345)
expect(result[0][:mem_quota]).to eq(process[:memory] * 1024 * 1024)
Expand Down Expand Up @@ -235,6 +240,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[0][:details]).to eq(nil)
expect(result[0][:isolation_segment]).to eq('hecka-compliant')
expect(result[0][:host]).to eq('myhost')
expect(result[0][:instance_internal_ip]).to eq('5.6.7.8')
expect(result[0][:instance_ports]).to eq(instance_ports_1)
expect(result[0][:uptime]).to eq(12345)
expect(result[0][:mem_quota]).to be_nil
Expand Down