Skip to content

A meta endpoint serving hostname and other basic info#68

Open
jkbecker wants to merge 12 commits intomainfrom
ser-74-host-identification-api-endpoint
Open

A meta endpoint serving hostname and other basic info#68
jkbecker wants to merge 12 commits intomainfrom
ser-74-host-identification-api-endpoint

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

@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