ralphtheninja / sbot-test-guard

Gathers sbot process data and uses sbot itself to report it
1 stars 1 forks source link

Better message schema #10

Closed pfrazee closed 9 years ago

pfrazee commented 9 years ago

Right now messages look like this:

{
  "type": "sys-stat",
  "text": "{\"os\":{\"type\":\"Linux\",\"arch\":\"x64\",\"platform\":\"linux\",\"loadavg\":[0.2060546875,0.1181640625,0.1337890625]},\"process\":{\"memory\":247365632,\"memoryInfo\":{\"rss\":247365632,\"vsize\":5183404769280},\"cpu\":3.1635031635246156,\"cpuInfo\":{\"pcpu\":3.1635031635246156,\"pcpuUser\":0.06660006660051958,\"pcpuSystem\":3.0969030969241547,\"cpuTime\":0.9499999999999602}}}"
}

Which means there's an embedded JSON object, not ideal. This is an artifact of the way the messages are posted (using a shell call). It can be improve in one of two ways:

ralphtheninja commented 9 years ago

:+1:

ralphtheninja commented 9 years ago

I'll fix that tomorrow!

ralphtheninja commented 9 years ago

@pfraze I'm using this now https://github.com/ralphtheninja/sbot-test-guard/blob/a6d720e050228b37e238a9c4342757a7fa86b077/index.js#L55 and it seems to work. Want to try it out before I publish? (I can switch to ssb-channel later on)

pfrazee commented 9 years ago

That looks good. Ssb-channel gives you a little help managing the connection, but you can probably add what you need w/o it

ralphtheninja commented 9 years ago

@pfraze Aye. I haven't gone through the channel completely yet. Do you have to auth each time before you call e.g. add, or is it enough to auth one time and then keep calling on the same connection?

pfrazee commented 9 years ago

@ralphtheninja you only need to auth once, the connection is a stateful session

ralphtheninja commented 9 years ago
$ npm publish
+ sbot-test-guard@3.2.0