Socket
Socket
Sign inDemoInstall

libhoney

Package Overview
Dependencies
4
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta.10 to 1.0.0

examples/express-dynamic-fields/.gitignore

14

examples/express-dynamic-fields/express-honey.js

@@ -7,10 +7,10 @@ var libhoney = require('libhoney').default;

// Attach dynamic fields to the global event builder in libhoney.
// Dynamic fields calculate their values at the time the event is created
// (the event.sendNow call below)
honey.addDynamicField('rss_after', () => process.memoryUsage().rss);
honey.addDynamicField('heapTotal_after', () => process.memoryUsage().heapTotal);
honey.addDynamicField('heapUsed_after', () => process.memoryUsage().heapUsed);
return function(req, res, next) {
// Attach dynamic fields to the global event builder in libhoney.
// Dynamic fields calculate their values at the time the event is created
// (the event.sendNow call below)
honey.addDynamicField('rss_after', () => process.memoryUsage().rss);
honey.addDynamicField('heapTotal_after', () => process.memoryUsage().heapTotal);
honey.addDynamicField('heapUsed_after', () => process.memoryUsage().heapUsed);
var event = honey.newEvent();

@@ -17,0 +17,0 @@ event.add({

@@ -7,4 +7,2 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright 2016 Hound Technology, Inc. All rights reserved.

@@ -130,10 +128,3 @@ // Use of this source code is governed by the Apache License 2.0

value: function addField(name, val) {
if ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === "object") {
// JS reports typeof == object for a lot of things that we don't need additional processing to handle
if (val === null || val instanceof Boolean || val instanceof Number || val instanceof Date || val instanceof String) {
// these are fine
} else {
val = JSON.stringify(val);
}
} else if (val == undefined) {
if (val == undefined) {
val = null;

@@ -140,0 +131,0 @@ }

@@ -61,3 +61,6 @@ 'use strict';

// if this is set to true, all sending is disabled. useful for disabling libhoney when testing
disabled: false
disabled: false,
// If this is non-empty, append it to the end of the User-Agent header.
userAgentAddition: ""
});

@@ -64,0 +67,0 @@

@@ -32,3 +32,3 @@ 'use strict';

var userAgent = "libhoney-js/1.0.0-beta.10";
var USER_AGENT = "libhoney-js/1.0.0";

@@ -200,2 +200,4 @@ var _global = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : undefined;

this._userAgentAddition = options.userAgentAddition || "";
// Included for testing; to stub out randomness and verify that an event

@@ -296,2 +298,8 @@ // was dropped.

var userAgent = USER_AGENT;
var trimmedAddition = _this._userAgentAddition.trim();
if (trimmedAddition) {
userAgent = USER_AGENT + ' ' + trimmedAddition;
}
var start = Date.now();

@@ -298,0 +306,0 @@ req.set('X-Hny-Team', batch.writeKey).set('User-Agent', userAgent).type("json").send(encoded).end(function (err, res) {

{
"name": "libhoney",
"version": "1.0.0-beta.10",
"version": "1.0.0",
"description": "Javascript library for sending data to Honeycomb",

@@ -5,0 +5,0 @@ "bugs": "https://github.com/honeycombio/libhoney-js/issues",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc