-
Notifications
You must be signed in to change notification settings - Fork 102
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
Adding kernel specific metrics to nbresuse #40 #41
Conversation
The sample metrics are attached here for reference. The kernel specific metrics can be found at the end of the file. This has hub metrics as well since I was testing from hub so please ignore them. |
Thanks @Gsbreddy! |
Yes it does. Will add more features as discussed in future PR’s.
…On Wed, 20 May 2020 at 23:16, Jeremy Tuloup ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In nbresuse/prometheus.py
<#41 (comment)>:
> + return None
+
+ for session in sessions:
+ kernel = session['kernel']
+ kernel_id = kernel['id']
+ kernel_process = find_process(kernel_id)
+ if kernel_process:
+ kernel_memory[kernel_id] = kernel_process.memory_info()._asdict()
+
+ raise gen.Return(kernel_memory)
+
+ @staticmethod
+ def _kernel_processes():
+ for proc in process_iter():
+ try:
+ if 'ipykernel_launcher' in proc.cmdline():
It looks like this could be tweaked to also handle other kernels than
ipykernel?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#41 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB26ANOWAMNOINIR6SS4AL3RSQJQNANCNFSM4NGFADAA>
.
|
Using kernel_spec_manager now so that we can support more kernels like xpython etc. even if they are installed using conda or pip.
Thanks @Gsbreddy for working on this. I submitted a small fix in https://github.com/Gsbreddy/nbresuse/pull/1. |
Fix handling of kernel specs in kernel metrics
Trying it locally with the xeus-python wheel (installed from PyPI). It looks like it is not picked up because the argv doesn't fully match the command of the process:
While the {
"display_name": "xpython",
"argv": [
"python3.8",
"-m",
"xpython_launcher",
"-f",
"{connection_file}"
],
"language": "python"
} |
Looks like |
Yes, with something like |
It looks like it is coming from Since |
Yeah, we can do the same here as well. Then the match will work. |
executable is 'python' or 'python3', use sys.executable. These will typically be the same, but if the current process is in an env and has been launched by abspath without activating the env, python on PATH may not be sys.executable, but it should be.
I handled this using |
Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
Just tested locally and the
However it will still be reported even after the kernel has been shut down. I guess we will want to remove it from the list? Otherwise the frontends will need to query the list of running kernels separately and filter the metrics taking into account only the running kernels? |
Although with Prometheus it's usually preferred for the metrics to be persisted (time series data). |
This would give information on the usage trend of the user. |
Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
Tested with In follow-ups PRs, we could:
Thanks again @Gsbreddy for working on this 👍 cc @krinsman who has commit rights and might want to have a look. |
I agree. I think we can go with #19 and have an API with previous JSON response( I am working on making this work with JupyterLab. So I will update once done. |
Using a JSON response from |
Using JSON response. Similar to version 0.3.3
…On Thu, 28 May 2020 at 16:25, Jeremy Tuloup ***@***.***> wrote:
I am working on making this work with JupyterLab. So I will update once
done.
Using a JSON response from /api/nbresuse/v1? Or by parsing the Prometheus
metrics with regexes?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB26ANKR6EO2CCDO22TLM2DRTY7JNANCNFSM4NGFADAA>
.
|
Sounds good! |
I will raise a PR once I finish that work. Can we close this or should we wait till next PR? |
Where do you plan to do that? In nbresuse? In JupyterLab? In another extension like the jupyterlab-system-monitor? |
I am planning it in nbresuse and then make a subsequent change in JupyterLab to call new api( |
👍 (I thought it was about using the kernel metrics from this PR) |
@krinsman @jtpio |
Thanks @Gsbreddy, it looks promising! I'll give it a try locally soon. |
Can you take a look at this ? |
This will address the issue #40