Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

riemann

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

riemann - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name" : "riemann",
"version" : "0.0.1",
"version" : "0.0.2",
"description" : "node.js client for Riemann, supports hybrid UDP/TCP connections.",

@@ -5,0 +5,0 @@ "author": {

@@ -18,4 +18,29 @@ var assert = require('assert');

var MAX_UDP_BUFFER_SIZE = 16384;
function _sendMessage(contents) {
var self = this;
return function() {
// all events are wrapped in the Message type.
var message = Serializer.serializeMessage(contents);
// if we're sending a message that is larger than the max buffer
// size of UDP, we should switch over to TCP.
if (message.length >= MAX_UDP_BUFFER_SIZE) {
self.tcp.send(message);
} else {
this.send(message);
}
};
}
/* some friendly defaults for event,
in case they went missing. */
function _defaultValues(payload) {
if (!payload.host) { payload.host = hostname; }
if (!payload.time) { payload.time = new Date().getTime()/1000; }
if (payload.metric) { payload.metricF = payload.metric; }
return payload;
}
/* sets up a client connection to a Riemann server.

@@ -63,25 +88,17 @@ options supports the following:

/* Primary type of event we submit to the
server, takes a key/value object of valid
/* Submits an Event to the server.
takes a key/value object of valid
Event protocol buffer values. */
Client.prototype.Event = function(event) {
// some friendly defaults for event,
// in case they went missing.
if (!event.host) { event.host = hostname; }
if (!event.time) { event.time = new Date().getTime()/1000; }
if (event.metric) { event.metricF = event.metric; }
event = _defaultValues(event);
return _sendMessage.call(this, { events: [event] });
};
var self = this;
return function() {
// all events are wrapped in the Message type.
var message = Serializer.serializeMessage({ events: [event] });
// if we're sending a message that is larger than the max buffer
// size of UDP, we should switch over to TCP.
if (message.length >= MAX_UDP_BUFFER_SIZE) {
self.tcp.send(message);
} else {
this.send(message);
}
};
/* Submits a State to the server.
takes a key/value object of valid
State protocol buffer values. */
Client.prototype.State = function(state) {
state = _defaultValues(state);
return _sendMessage.call(this, { states: [state] });
};

@@ -88,0 +105,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc