-
Notifications
You must be signed in to change notification settings - Fork 1
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
A meta endpoint serving hostname and other basic info #68
base: main
Are you sure you want to change the base?
Conversation
agent/src/main.rs
Outdated
@@ -236,7 +236,8 @@ fn init_router(state: &Arc<RunnerState>) -> Router { | |||
|
|||
let mut router: Router<Arc<RunnerState>, Body> = Router::new() | |||
.route("/monitor/ping", get(ping)) | |||
.route("/monitor/status", get(monitor_status)); | |||
.route("/monitor/status", get(monitor_status)) | |||
.route("/meta", get(meta)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we stick this under something like /meta/hostinfo
? I want the /meta/ namespace to be open to future expansion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/status
is the name I chose because it should include a lot more than host info. Here's an example response blob that contains some of the information I consider essential for lightweight runtime inspection of a process.
{
"git": "b2277c7",
"hostname": "unobtanium.local",
"node": "name-of-agent",
"stats": {
"requestCount": 0,
"statuses": {}
},
"uptime": 22.108189125
}
Plus whatever else is cheap to extract from a running process: peer counts? etc. Uptime is particularly useful to me. PID if we have it. (these two together can signal crash loops.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Getting the git hash involves a little build-time Rust fun that will show you how all that works.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, great input! Will add the very easy stats details to my PR and create separate issues for those that are more complex.
what about a route of
…? |
A
/meta
endpoint serving (for now) the agent's hostname.This is the most basic implementation; other metadata could/should probably be contained in here as well.