Skip to content
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
1 change: 1 addition & 0 deletions app/presenters/v3/process_stats_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def found_instance_stats_hash(index, stats)
{
type: @type,
index: index,
instance_guid: stats[:stats][:instance_guid],
state: stats[:state],
routable: stats[:routable],
host: stats[:stats][:host],
Expand Down
1 change: 1 addition & 0 deletions docs/v3/source/includes/api_resources/_processes.erb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
{
"type": "web",
"index": 0,
"instance_guid": "e49f448e-54d2-4c33-61a3-5335",
"state": "RUNNING",
"usage": {
"time": "2016-03-23T23:17:30.476314154Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Name | Type | Description
---- | ---- | -----------
**type** | _string_ | Process type; a unique identifier for processes belonging to an app
**index** | _integer_ | The zero-based index of running instances
**instance_guid** | _string_ | The unique identifier of the instance
**state** | _string_ | The state of the instance; valid values are `RUNNING`, `CRASHED`, `STARTING`, `STOPPING`, `DOWN`
**routable** | _boolean_ | Whether or not the instance is routable (determined by the readiness check of the app). If app readiness checks and routability are unsupported by Diego, this will return as `null`.
**usage** | _object_ | Object containing actual usage data for the instance; the value is `{}` when usage data is unavailable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def build_info(state, actual_lrp, process, stats, quota_stats, log_cache_errors)
name: process.name,
uris: process.uris,
host: actual_lrp.actual_lrp_net_info.address,
instance_guid: actual_lrp.actual_lrp_instance_key.instance_guid,
port: get_default_port(actual_lrp.actual_lrp_net_info),
net_info: actual_lrp.actual_lrp_net_info.to_h,
uptime: nanoseconds_to_seconds((Time.now.to_f * 1e9) - actual_lrp.since),
Expand Down
2 changes: 2 additions & 0 deletions spec/request/processes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@
name: process.name,
uris: process.uris,
host: 'toast',
instance_guid: 'some-diego-instance-id',
net_info: net_info_1,
uptime: 12_345,
mem_quota: process[:memory] * 1024 * 1024,
Expand Down Expand Up @@ -556,6 +557,7 @@
'type' => 'worker',
'index' => 0,
'state' => 'RUNNING',
'instance_guid' => 'some-diego-instance-id',
'routable' => true,
'isolation_segment' => 'very-isolated',
'details' => 'some-details',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
name: process.name,
uris: process.uris,
host: 'lrp-host',
instance_guid: 'instance-a',
port: 2222,
net_info: lrp_1_net_info.to_h,
uptime: two_days_in_seconds,
Expand Down Expand Up @@ -159,6 +160,7 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
name: process.name,
uris: process.uris,
host: 'lrp-host',
instance_guid: 'instance-a',
port: 2222,
net_info: lrp_1_net_info.to_h,
uptime: two_days_in_seconds,
Expand Down Expand Up @@ -213,6 +215,7 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
name: process.name,
uris: process.uris,
host: 'lrp-host',
instance_guid: 'instance-a',
port: 2222,
net_info: lrp_1_net_info.to_h,
uptime: two_days_in_seconds,
Expand Down Expand Up @@ -459,6 +462,7 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
name: process.name,
uris: process.uris,
host: 'lrp-host',
instance_guid: 'instance-a',
port: 2222,
net_info: lrp_1_net_info.to_h,
uptime: two_days_in_seconds,
Expand Down Expand Up @@ -592,6 +596,7 @@ def make_actual_lrp(instance_guid:, index:, state:, error:, since:)
name: process.name,
uris: process.uris,
host: 'lrp-host',
instance_guid: 'instance-a',
port: 2222,
net_info: lrp_1_net_info.to_h,
uptime: two_days_in_seconds,
Expand Down
9 changes: 9 additions & 0 deletions spec/unit/presenters/v3/process_stats_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ module VCAP::CloudController::Presenters::V3
name: process.name,
uris: process.uris,
host: 'myhost',
instance_guid: 'instance-a',
net_info: net_info_1,
uptime: 12_345,
mem_quota: process[:memory] * 1024 * 1024,
Expand All @@ -89,6 +90,7 @@ module VCAP::CloudController::Presenters::V3
name: process.name,
uris: process.uris,
host: 'toast',
instance_guid: 'instance-b',
net_info: net_info_2,
uptime: 42,
mem_quota: process[:memory] * 1024 * 1024,
Expand Down Expand Up @@ -122,6 +124,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[0][:type]).to eq(process.type)
expect(result[0][:index]).to eq(0)
expect(result[0][:state]).to eq('RUNNING')
expect(result[0][:instance_guid]).to eq('instance-a')
expect(result[0][:routable]).to be(true)
expect(result[0][:details]).to be_nil
expect(result[0][:isolation_segment]).to eq('hecka-compliant')
Expand All @@ -143,6 +146,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[1][:type]).to eq(process.type)
expect(result[1][:index]).to eq(1)
expect(result[1][:state]).to eq('CRASHED')
expect(result[1][:instance_guid]).to eq('instance-b')
expect(result[1][:routable]).to be(false)
expect(result[1][:details]).to eq('some-details')
expect(result[1][:isolation_segment]).to be_nil
Expand Down Expand Up @@ -178,6 +182,7 @@ module VCAP::CloudController::Presenters::V3
name: process.name,
uris: process.uris,
host: 'myhost',
instance_guid: 'instance-a',
net_info: net_info_1,
uptime: 12_345,
mem_quota: process[:memory] * 1024 * 1024,
Expand Down Expand Up @@ -217,6 +222,7 @@ module VCAP::CloudController::Presenters::V3
name: process.name,
uris: process.uris,
host: 'myhost',
instance_guid: 'instance-a',
net_info: net_info_1,
uptime: 12_345,
mem_quota: process[:memory] * 1024 * 1024,
Expand Down Expand Up @@ -286,6 +292,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[0][:details]).to be_nil
expect(result[0][:isolation_segment]).to eq('hecka-compliant')
expect(result[0][:host]).to eq('myhost')
expect(result[0][:instance_guid]).to eq('instance-a')
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(12_345)
Expand All @@ -312,6 +319,7 @@ module VCAP::CloudController::Presenters::V3
name: process.name,
uris: process.uris,
host: 'myhost',
instance_guid: 'instance-a',
net_info: net_info_1,
uptime: 12_345,
fds_quota: process.file_descriptors,
Expand All @@ -330,6 +338,7 @@ module VCAP::CloudController::Presenters::V3
expect(result[0][:details]).to be_nil
expect(result[0][:isolation_segment]).to eq('hecka-compliant')
expect(result[0][:host]).to eq('myhost')
expect(result[0][:instance_guid]).to eq('instance-a')
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(12_345)
Expand Down
Loading