Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new /api/nbresuse/v1 endpoint #52

Open
jtpio opened this issue Jun 12, 2020 · 4 comments
Open

Add a new /api/nbresuse/v1 endpoint #52

jtpio opened this issue Jun 12, 2020 · 4 comments

Comments

@jtpio
Copy link
Member

jtpio commented Jun 12, 2020

#45 restored the /metrics endpoint, so that JupyterLab (and other frontends) can display the metrics:

image

The reason to move away from /metrics is to not shadow the default Prometheus endpoint (see #22 for more infos).

However this is a breaking change. We should carefully plan the rollout to avoid confusing users with an older version of JupyterLab. For the classic notebook this is not really an issue as the notebook extension is bundled with the package on PyPI.

cc @Gsbreddy who has already started working on this in side PRs.

@jtpio
Copy link
Member Author

jtpio commented Jun 12, 2020

For now the code in the API handler:

https://github.com/yuvipanda/nbresuse/blob/ba1f4e794082fbac6865cb8c36e38b03155423fb/nbresuse/api.py#L21-L60

Duplicates some of the logic of the Prometheus handler, which relies on a PSUtilMetricsLoader:

https://github.com/yuvipanda/nbresuse/blob/ba1f4e794082fbac6865cb8c36e38b03155423fb/nbresuse/metrics.py#L9

It would be nice if both could share the same approach when it comes to retrieving metrics from psutil.

@jtpio
Copy link
Member Author

jtpio commented Jun 12, 2020

It would be interesting to have a look at the glances API: https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API

Glances relies on psutil to provide aggregated metrics from the host machine.

There might be some ideas that could be applied to nbresuse if we start expanding the API surface.

@yuvipanda
Copy link
Collaborator

#68 provides /api/metrics/v1, without removing /metrics. We can probably tweak it more in a /api/metrics/v2

@Gsbreddy
Copy link

We can add the per kernel metrics #41 since this has been a long ask for lots of people. I myself am using this in my org but was overriding /metrics to enable this capability. Now that the soft deprecate went it, I think we can integrate #41 onto /api/metrics/v2. Also CPU per kernel as well is a big addition. What do you guys think?
@yuvipanda @jtpio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants