1.0.8 • Published 4 years ago

sr-monitor v1.0.8

Weekly downloads
9
License
ISC
Repository
-
Last release
4 years ago

sr-monitor

上报数据到秒级监控上

Installation

npm install sr-monitor --save

Usage

  /**
   *
   * @param {*} url 上报的url,默认值:https://lingshou.tencent.com/monitor/notify
   * @param {*} srId 上报的鉴权的应用标识,默认值:process.env.SR_ID
   * @param {*} srSecret 上报的鉴权的密钥,默认值:process.env.SR_SECRET
   * @param {*} intfId 秒级监控的intfId
   * @param {*} sysId 秒级监控的sysId
   * @param {*} logging 日志回调函数,传入n个需要打印的参数
   */
const monitor = new Monitor({
  url: 'https://lingshou.tencent.com/monitor/notify',
  srId: process.env.SR_ID,
  srSecret: process.env.SR_SECRET,
  intfId: '3',
  sysId: '9900627',
  logging: (...args) => {
    console.log(...args);
  },
});

// 秒级监控的维度参数和指标维度:recordCount,requestCount, tableName
// 这三个参数需要在秒级监控中查询
monitor.report({
  recordCount: 1,
  requestCount: 3,
  tableName: 'aaa',
}).then((data, err) => {
  // 上报失败
  if (err) {
    console.log(err);
  }
  // 上报成功
  console.log(data);
});
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago