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

A meta endpoint serving hostname and other basic info #68

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

jkbecker
Copy link
Contributor

@jkbecker jkbecker commented May 1, 2023

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.

@jkbecker jkbecker requested a review from shinypb May 1, 2023 16:00
@@ -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));
Copy link
Contributor

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.

Copy link
Contributor

@ceejbot ceejbot May 1, 2023

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.)

Copy link
Contributor

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.)

Copy link
Contributor Author

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.

agent/src/api/mod.rs Outdated Show resolved Hide resolved
@jkbecker jkbecker changed the title A meta endpoint serving hostname (for now) + more A meta endpoint serving hostname and other basic info May 2, 2023
@jkbecker
Copy link
Contributor Author

jkbecker commented May 2, 2023

what about a route of /agent/info for the functionality above?
that would allow for clean extension into basically self-documenting endpoints like

/agent/neighbors
/agent/load
/agent/extensions

…?

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

Successfully merging this pull request may close these issues.

3 participants