cloudfoundry / cloud_controller_ng

Cloud Foundry Cloud Controller
Apache License 2.0
191 stars 357 forks source link

No support for "include" for /v3/processes #1422

Open Martin-Lakov opened 5 years ago

Martin-Lakov commented 5 years ago

Issue

It seems that the V3 API has somewhat limited support for the include query parameter. When talking about the processes resource it's not supported at all whereas it makes a ton of sense to have it present so that one can obtain information about:

  1. The application to which this process is related
  2. The CF org & space in which the application resides
  3. The current process stats

This way it will be perfectly possible to obtain information for applications by sending just one instead of multiple requests enabling the implementation of dashboards etc. or even raising alerts for threshold being reached.

Context

Monitoring applications state for apps running in CF

cf-gitbot commented 5 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/168110257

The labels on this github issue will be updated when the story is started.

cwlbraa commented 5 years ago

I think this has to be on some roadmap somewhere, especially for apps, spaces, and orgs. The API design logic of these include parameters is documented here: https://github.com/cloudfoundry/cc-api-v3-style-guide#including-related-resources

The one thing is that I don't think we'd do this for /v3/processes?include=stats. Includes are intended only to be for resources, whereas "stats" is more like an "action" in the v3 API - we have to call out to a backend service (Diego or Eirini/k8s) to get that information. I think we'd would be open and interested in some sort of bulk stats endpoint, though, but would be hesitant about making it look as though we were just returning more resources from our database.

enchobelezirev commented 4 years ago

Hello @cwlbraa,

Are there any plans this to be supported in the API? From my point of view, there is also need to add it to the apps endpoint in order to provide possibility to get the processes for the current application.

cwlbraa commented 4 years ago

Hey @enchobelezirev ! does http://v3-apidocs.cloudfoundry.org/version/3.78.0/index.html#list-processes-for-app not solve your problem? Is there a specific reason you need app and process information in a single request? Broadly, can you tell me more about what you're trying to do?

Gerg commented 4 years ago

I think something like GET /v3/apps?include=process would be useful to add to the API. It is a bit different than currently supported includes because an app can have multiple processes. This means the API will probably need to paginate included resources, which we don't have a final design for currently.

Like @cwlbraa mentioned, stats are a difficult case for the API because the stats data comes from the container runtime (currently Diego). Depending on your use case, it might make sense for you to consume metrics directly from Diego.