jupyter-resource-usage icon indicating copy to clipboard operation
jupyter-resource-usage copied to clipboard

add JSON content type in response header

Open shreddd opened this issue 4 years ago • 4 comments

For the JSON API (currently /metrics but /api/nbresuse moving forward), it might be useful to add a "application/json" content type response header (which may allow for slightly easier parsing in certain clients).

Also - is there a set of upcoming changes / plans for nbresuse wrt the prometheus vs. JSON endpoints; the support for the statusbar etc.?

Before we contribute additional changes, it might be good to know what the plan is, so that we can figure out how best to target changes. I'm piecing together activity from various issues, but it would be good to see what was finally agreed upon moving forward.

shreddd avatar Jun 17 '20 00:06 shreddd

Thanks @shreddd.

Also - is there a set of upcoming changes / plans for nbresuse wrt the prometheus vs. JSON endpoints; the support for the statusbar etc.?

Here is a short summary. But let's open a new meta issue right after to keep that separate from adding the JSON content type to the response header.

One plan would be to:

  • Keep the /metrics endpoint for the 0.3.x releases to not break backward compatibility with the lab status bar and other extensions that rely on nbresuse.
  • Drop the /metrics endpoint in 0.4.x so it doesn't shadow the Prometheus endpoint anymore
  • Either in a 0.3.x release or in 0.4.x: add a new /api/nbresuse/v1 endpoint to retrieve the metrics as JSON (just like the current /metrics endpoint). However the format of the response is still to be defined
  • Another thing on the roadmap is to report kernel specific metrics: https://github.com/yuvipanda/nbresuse/issues/31
  • Potentially add more metrics (Network I/O or other metrics supported by psutil).

Of course this is open to suggestions. We can discuss more in the separate issue.

jtpio avatar Jun 17 '20 08:06 jtpio

Opened https://github.com/yuvipanda/nbresuse/issues/58 to keep track of the nbresuse roadmap.

This issue is now pinned to improve visibility:

image

jtpio avatar Jun 17 '20 08:06 jtpio

Marking this current issue as a "good first issue", as it would require adding the content type to the endpoint in: https://github.com/yuvipanda/nbresuse/blob/master/nbresuse/api.py

jtpio avatar Jun 17 '20 08:06 jtpio

OK - thanks - super helpful. I may have one of our summer interns help with this.

shreddd avatar Jun 19 '20 00:06 shreddd