Name Last Update
example Loading commit data...
test Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
README.md Loading commit data...
index.js Loading commit data...
package.json Loading commit data...
yarn.lock Loading commit data...

influx-batch-sender

buffer message and send them in a bulk.

useage

const Sender = require('../index');

const sender = new Sender({
    host: 'influxd.yoho.cn',
    db: 'web-apm',
    measurement: 'api-duration',
    duration: 2000,  // 多长时间发送一次,默认值是 2000ms
    records: 200,  // 累积多少条消息发送一次,默认值是100
    immediate: true // 是否立刻发送消息,设置为 true 会忽略 records 设置,默认值是 false
    path: "/url", // 重新设置发送消息的路径,默认值是 /write
});

setInterval(() => {
    sender.addMessage({
        tags: {
            reqid: 'sdasda'+Math.random(),
            route: 'test'
        },
        fields: {
            dasd: "d123asda"
        }
    });
}, Math.random() * 100)