A meta endpoint serving hostname and other basic info#68
A meta endpoint serving hostname and other basic info#68
Conversation
agent/src/main.rs
Outdated
| .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.
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.
/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.
(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.
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
/metaendpoint serving (for now) the agent's hostname.This is the most basic implementation; other metadata could/should probably be contained in here as well.