cloud_controller_ng icon indicating copy to clipboard operation
cloud_controller_ng copied to clipboard

Hostname - possibility to identify actual CF's app instance?

Open krismarc opened this issue 7 months ago • 2 comments

Hey there,

Seems like CF's api is unaware of actual hostnames of application processes.

Wouldn't it be beneficial to have hostname included in eg stats? So we can easily identify instance to eg. restart specific instance only.

Since we know host IP and other container attributes, this wouldn't probably cost any additional processing time, no?

cf curl /v3/processes/94f9a32a-8c89-4d6d-bcac-fcd9b489c20c/stats | jq -r .
{
  "resources": [
    {
      "type": "web",
      "index": 0,
      "state": "RUNNING",
      "routable": true,
      "host": "100.106.178.59",
      "instance_internal_ip": "11.254.97.6",
      "uptime": 873203,
      "mem_quota": 2147483648,
      "disk_quota": 10737418240,
      "log_rate_limit": -1,
      "fds_quota": 16384,
      "isolation_segment": null,
      "details": null,
      "instance_ports": [
        {
          "external": 0,
          "internal": 8080,
          "external_tls_proxy_port": 61002,
          "internal_tls_proxy_port": 61001
        },
        {
          "external": 0,
          "internal": 8080,
          "external_tls_proxy_port": null,
          "internal_tls_proxy_port": 61443
        },
        {
          "external": 0,
          "internal": 2222,
          "external_tls_proxy_port": 61003,
          "internal_tls_proxy_port": 61002
        }
      ],
      "usage": {
        "time": "2025-06-04T10:12:53+00:00",
        "cpu": 0.006661531415403901,
        "cpu_entitlement": 0.07833967451462209,
        "mem": 639707986,
        "disk": 1208496128,
        "log_rate": 1073
      }
    },
    {
      "type": "web",
      "index": 1,
      "state": "RUNNING",
      "routable": true,
      "host": "100.106.210.23",
      "instance_internal_ip": "11.249.24.8",
      "uptime": 886817,
      "mem_quota": 2147483648,
      "disk_quota": 10737418240,
      "log_rate_limit": -1,
      "fds_quota": 16384,
      "isolation_segment": null,
      "details": null,
      "instance_ports": [
        {
          "external": 0,
          "internal": 8080,
          "external_tls_proxy_port": 61007,
          "internal_tls_proxy_port": 61001
        },
        {
          "external": 0,
          "internal": 8080,
          "external_tls_proxy_port": null,
          "internal_tls_proxy_port": 61443
        },
        {
          "external": 0,
          "internal": 2222,
          "external_tls_proxy_port": 61008,
          "internal_tls_proxy_port": 61002
        }
      ],
      "usage": {
        "time": "2025-06-04T10:12:53+00:00",
        "cpu": 0.004324711435490253,
        "cpu_entitlement": 0.0508586487237521,
        "mem": 555906599,
        "disk": 1151676416,
        "log_rate": 0
      }
    }
  ]
}

krismarc avatar Jun 04 '25 10:06 krismarc

I just had a brief look at the code:

The isntance guid seems to be known already? https://github.com/cloudfoundry/cloud_controller_ng/blob/b328c8f22a8ebcef698d102ffbc995481b1d2c05/lib/cloud_controller/diego/reporters/instances_stats_reporter.rb#L79

and it's just not presented? https://github.com/cloudfoundry/cloud_controller_ng/blob/b328c8f22a8ebcef698d102ffbc995481b1d2c05/app/presenters/v3/process_stats_presenter.rb#L41

krismarc avatar Jun 04 '25 10:06 krismarc

ah, seems like this was added in 3.191 😃 and we are not yet there.. https://github.com/cloudfoundry/cloud_controller_ng/commit/f50766e85545feff582be64788638cfc9abc0b09

krismarc avatar Jun 04 '25 11:06 krismarc