Skip to content

feat: add metrics publisher for NT #1791

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

samfreund
Copy link
Member

this might work, but it still needs testing.

we don't know if it actually publishes, also don't know how much resources this'll consume

@samfreund samfreund requested a review from a team as a code owner February 19, 2025 18:22
@samfreund samfreund marked this pull request as draft February 19, 2025 18:22
@samfreund
Copy link
Member Author

Also add a way to toggle this in settings.

@mcm001
Copy link
Contributor

mcm001 commented Feb 19, 2025

Also add a way to toggle this in settings.

Nah. Keep it on. IMO this kind of participant metrics could be good to have as a NT protocol extnesion

@@ -129,6 +129,24 @@ public String getIpAddress() {
return addr;
}

public HashMap<String, String> getMetrics() {
HashMap<String, String> metrics = new HashMap<String, String>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What drove you to use a HashMap here? It looks like this code is duplicated from publishMetrics. Can we switch both to a Jackson serializable Java POD class? And we might consider a NT struct here as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used a hashmap cause we use it in the publishMetrics as well. When you say NT struct, do you mean like a subtable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think a hashmap might be the best option as it lets us easily iterate through everything

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a struct is the best option for publishing to NT then a shared type between photonlib and the backend for accessing the data

@Gold856 Gold856 linked an issue Mar 20, 2025 that may be closed by this pull request
@mcm001 mcm001 force-pushed the feat-publish-coprocessor-metrics branch from 2432619 to ee9d7ed Compare April 13, 2025 17:50
@mcm001
Copy link
Contributor

mcm001 commented Apr 13, 2025

Refactored to publish a protobuf, not sure if this actually better but
image

@mcm001
Copy link
Contributor

mcm001 commented Apr 13, 2025

Let's refactor our metrics commands to print sane numbers, instead of strings. For example

  • Uptime should just be uptime_sec, and we can grab from awk '{print $1}' /proc/uptime
  • disk utilization pct should probably just be 7, not 7%

@samfreund samfreund added the enhancement New feature or request label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add host stats on NetworkTables
3 participants