A connector that collects data using 'appmetrics' and sends it to a configured Kafka server using 'kafka-node'.
The Kafka Connector for Node Application Metrics can be installed via npm:
$ npm install appmetrics-kafkaThe connector can be used in your application by requiring it as the first line of your application:
var appkafka = require('appmetrics-kafka').Kafka();Configuration of the connection to the Kafka server is possible by passing parameters to the Kafka() function. These are passed directly though to the Client constructor in the kafka-node module. Information for that module is available here:
https://www.npmjs.com/package/kafka-node
Additional data may also be sent to Kafka using the standard kafka-node module APIs, eg.
var appkafka = require('appmetrics-kafka').Kafka();
var Producer = appkafka.Producer,
KeyedMessage = appkafka.KeyedMessage,
client = new appkafka.Client(),
producer = new Producer(client),
km = new KeyedMessage('key', 'message'),
payloads = [
{ topic: 'topic1', messages: 'hi', partition: 0 },
{ topic: 'topic2', messages: ['hello', 'world', km] }
];
producer.on('ready', function () {
producer.send(payloads, function (err, data) {
console.log(err);
console.log(data);
});
});
producer.on('error', function (err) {})The connector sends the following topics to Kafka from Node Application Metrics:
cpu.processthe CPU usage of the application as a percentage of total machine CPUcpu.systemthe CPU usage of the system as a percentage of total machine CPU
memory.process.privatethe amount of memory used by the Node.js application that cannot be shared with other processes, in bytes.memory.process.physicalthe amount of RAM used by the Node.js application in bytes.memory.process.virtualthe memory address space used by Node.js application in bytes.memory.system.usedthe total amount of RAM in use on the system in bytes.memory.system.totalthe total amount of RAM available on the system in bytes.
eventloop.latency.minthe shortest sampled latency for processing an eventeventloop.latency.maxthe longest sampled latency for processing an eventeventloop.latency.avgthe mean sampled latency for processing an event
gc.sizethe size of the JavaScript heap in bytes.gc.usedthe amount of memory used on the JavaScript heap in bytes.gc.durationthe duration of the GC cycle in milliseconds.
http.methodthe HTTP method used for the requesthttp.urlthe URL on which the request was made.http.durationthe time taken for the HTTP request to be responded to in ms.
socketio.methodwhether the event is a 'broadcast' or 'emit' from the application, or a 'receive' from a client .socketio.eventthe name used for the event.socketio.durationthe time taken for a received named socketio event to be handled.
mysql.querythe query made of the MySQL database.mysql.durationthe time taken for the given MySQL query to be responded to in ms.
mongo.querythe query made of the MongoDB database.mongo.durationthe time taken for the given MongoDB query to be responded to in ms.
mqtt.methodthe name of the call or event (will be one of 'publish' or 'message').mqtt.topicthe topic on which a message is sent/received.mqtt.qosthe QoS level for a 'send' call, undefined if not set.mqtt.durationthe time taken in milliseconds.
levedown.methodthe leveldown method being used.leveldown.keythe key being used for a call to get, put or del (Undefined for other methods).leveldown.valuethe value being added to the LevelDB database using the put method (Undefined for other methods).leveldown.opCountthe number of operations carried out by a batch method (Undefined for other methods).leveldown.durationthe time taken for the LevelDB query to be responded to in ms.
redis.cmdthe Redis command sent to the server or 'batch.exec'/'multi.exec' for groups of command sent using batch/multi calls.redis.durationthe time taken for the given Redis command to be responded to in ms.
memcached.methodthe method used in the memcached client, eg set, get, append, delete, etc.memcached.keythe key associated with the data.memcached.durationthe time taken for the given Memcached method to be responded to in ms.
oracledb.querythe query made of the OracleDB database.oracledb.durationthe time taken for the OracleDB query to be responded to in ms.
oracle.querythe query made of the Oracle database.oracle.durationthe time taken for the Oracle query to be responded to in ms.
strongoracle.querythe query made of the Oracle database.strongoracle.durationthe time taken for the Strong Oracle query to be responded to in ms.
postgres.querythe query made of the PostgreSQL database.postgres.durationthe time taken for the given PostgresSQL query to be responded to in ms.
mqlight.clientidthe id of the client.mqlight.datathe data sent if a 'send' or 'message', undefined for other calls. Truncated if longer than 25 characters.mqlight.methodthe name of the call or event (will be one of 'send' or 'message').mqlight.topicthe topic on which a message is sent/received.mqlight.qosthe QoS level for a 'send' call, undefined if not set.mqlight.durationthe time taken for a MQLight message to handled on a given topic in ms.
The Node Application Metrics to Kafka Connector is licensed using an Apache v2.0 License.
2.0.0
2.0.0 update appmetrics version
1.0.0 Initial release