var monitor =require('monitr');
monitor.start();
monitor.stop();
运行方式
会创建独立的线程监控使用此包的node进程的状态,通过本地域socket发送json格式统计信息.
{ status:{ pid: <pid of the node process>,
ts: <current time stamp>,
cluster: <process group id>,
reqstotal: <total requests processed by this node process server>,
utcstart: <when the process was started>,
events: <number of new reports being processed since last stats reporting>,,
cpu: <cpu usage>,
mem: <memory usage>,
cpuperreq: <cpu usage per request>,
oreqs: <current open requests count>,
sys_cpu: <system cpu load>,
oconns: <current open connections count>,
user_cpu: <user cpu load>,
rps: <requests per second>,
kbs_out: <kbs of data transferred since last stats reporting>,
elapsed: <time elapsed since last event>,
kb_trans: <total kbs of data transferred>,
jiffyperreq: <cpu usage in terms of ticks per request>,
gc:{
scavenge:{ count: <number>, elapsed_ms: <number>, max_ms: <number> },
marksweep:{ count: <number>, elapsed_ms: <number>, max_ms: <number> }}}}
import Flippy,{ FrontSide, BackSide }from'react-flippy';// ... component classrender(){// .. return<Flippy
flipOnHover={false}// default false
flipOnClick={true}// default false
flipDirection="horizontal"// horizontal or vertical
ref={(r)=>this.flippy = r}// to use toggle method like this.flippy.toggle()// if you pass isFlipped prop component will be controlled component.// and other props, which will go to div
style={{ width:'200px', height:'200px'}}/// these are optional style, it is not necessary><FrontSide
style={{
backgroundColor:'#41669d',}}>RICK</FrontSide><BackSide
style={{ backgroundColor:'#175852'}}>ROCKS</BackSide></Flippy>}
<!DOCTYPE html><html><head><title>Riot Example: Timer</title><metahttp-equiv="X-UA-Compatible"content="IE=edge"/><linkrel="stylesheet"href="style.css"/></head><body><timer></timer><!-- riot tags --><scriptsrc="timer.riot"type="riot"></script><!-- scripts we need --><scriptsrc="https://cdn.jsdelivr.net/npm/riot@4/riot+compiler.min.js"></script><!-- mount this app --><script>
riot.compile().then(()=>{
riot.mount('timer',{ start:0});});</script></body></html>