cloud_controller_ng icon indicating copy to clipboard operation
cloud_controller_ng copied to clipboard

No support for "include" for /v3/processes

Open Martin-Lakov opened this issue 6 years ago • 5 comments

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

Martin-Lakov avatar Aug 26 '19 14:08 Martin-Lakov

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.

cf-gitbot avatar Aug 26 '19 14:08 cf-gitbot

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.

cwlbraa avatar Sep 13 '19 21:09 cwlbraa

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.

enchobelezirev avatar Nov 08 '19 11:11 enchobelezirev

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?

cwlbraa avatar Nov 20 '19 18:11 cwlbraa

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.

Gerg avatar Nov 25 '19 17:11 Gerg