con / duct

A helper to run a command, capture stdout/stderr and details about running
MIT License
1 stars 1 forks source link

store PID as int not str #62

Closed yarikoptic closed 2 weeks ago

yarikoptic commented 3 weeks ago

ATM

{"1623049": {"pcpu": 0.0, "pmem": 0.0, "rss": 15668, "vsz": 1247012, "timestamp": "2024-06-09T11:36:56.374783-04:00"}, "1623076": {"pcpu": 3.2, "pmem": 0.0, "rss": 17204, "vsz": 20872, "timestamp": "2024-06-09T11:36:56.374816-04:00"}, "1786431": {"pcpu": 0.0, "pmem": 0.0, "rss": 3036, "vsz": 4040, "timestamp": "2024-06-09T11:36:56.374833-04:00"}, "1786646": {"pcpu": 100.0, "pmem": 0.0, "rss": 116912, "vsz": 128380, "timestamp": "2024-06-09T11:36:56.374848-04:00"}, "totals": {"pmem": 0.0, "pcpu": 103.2}}

for PIDs - imho better just to store 1623049 etc

asmacdo commented 2 weeks ago

I cast the PID to an int, but when I jsonified it, it went back to being quoted. IIUC this is required according to the JSON spec.

From RFC 8259: A name is a string.

https://datatracker.ietf.org/doc/html/rfc8259#section-4

An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name. The names within an object SHOULD be unique.

asmacdo commented 2 weeks ago

Please reopen if i missed something