Comparing version 0.1.3 to 0.1.4
@@ -1,1 +0,1 @@ | ||
(function(){function f(){var e=t.hrtime();return e[0]*1e9+e[1]}function l(){return c.now()*1e6}function p(e,t,n){arguments.length===2&&(n=t,t=u),h+=1,this.id=h,this.name=e,this.metadata=t,this._callback=n||function(){},this.started=(new Date).valueOf(),this._start=a(),this._callback(this)}function g(e,t,r){try{arguments.length===2&&(r=t,t=u);var i=n(t),s=d.parse(e),o={method:"POST",hostname:s.hostname,port:s.port,path:s.path},a=s.protocol.indexOf("https")===0?m:v,f=[],l=a.request(o,function(e){e.setEncoding("utf8"),e.on("data",function(e){f.push(e)}),e.on("end",function(){r(null,e,f.join(""))})});l.on("error",function(e){r(e)}),i&&(l.setHeader("Content-Type","application/json"),l.setHeader("Content-Length",i.length),l.write(i)),l.end()}catch(c){r(c)}}function y(e){function n(e){t.log("LogChop - "+e)}function y(){if(a.length<=f)return;m||(m={event:new p,count:0});var e=a.length-f;a=a.slice(e),m.count+=e,n("dropped "+e+" events")}function S(e,t,r){var i=t&&t.statusCode;e||i!==200?(n("communication error - "+(e||i)),a=l.concat(a)):m=null,h=!1,v()}var t=this,i;t.connect=function(){if(!e)return n("connection url missing");if(i)return;g(e,function(e,t,s){var o=e&&e.code===r,a=t&&t.statusCode;if(o)return u("refused");if(e)return u(e);if(!t)return u("no response");if(a!==200)return u(a+" error");try{eventUri=JSON.parse(s).uri}catch(f){return u("invalid connection response")}if(!eventUri)return u("invalid event uri");n("connected"),i=!0,v()})},t.upload=function(t){a.push(b(t)),w(t),v()},t.log=function(){};var s=0,o,u=function(e){o=o?o*1.7:5e3,s+=1;var r="connection failed ("+e+") ";return s>10?n(r+"exceeded max attempts"):(n(r+"reconnecting in "+Math.round(o/1e3)+" seconds"),setTimeout(t.connect,o))},a=[],f=1e4,l,c=100,h,d=250,v=E(function(){y();if(!i||h||!a.length)return;h=!0,l=a.slice(0,c),a=a.slice(c);var e=[];m&&(m.event.name="client dropped "+m.count+" events",m.event.stop(),e.push(b(m.event))),g(eventUri,e.concat(l),S)},d),m}function b(e){var t;try{e.metadata&&(t=n(e.metadata))}catch(r){t=n("Could not stringify metadata")}return{i:e.id,n:e.name,s:e.started,d:e.duration,p:e.parent,m:t}}function w(e){e.name=e.started=e.duration=e.parent=e.metadata=u}function E(e,t){function s(){i=null,e.apply(r,n)}var n,r,i;return function(){n=arguments,r=this,clearTimeout(i),i=setTimeout(s,t)}}var e=require,t=typeof process!="undefined"?process:{},n=JSON.stringify,r="ECONNREFUSED",i="production",s="test",o="undefined",u,a=t.hrtime?f:l,c={};typeof window!==o&&window.performance&&(c=window.performance),c.now=c.now||c.mozNow||c.msNow||c.oNow||c.webkitNow||function(){return(new Date).getTime()};var h=0;p.prototype.constructor=p,p.prototype.stop=function(){this.duration=a()-this._start,this._callback(this)},p.prototype.until=function(e,t){var n=this;return function(){n.stop(),e.apply(t,arguments)}};var d=e("url"),v=e("http"),m=e("https");y.prototype.constructor=y;var S=t.env||{},x=new y(S.LOGCHOP_URL);S.NODE_ENV!==i&&S.NODE_ENV!==s&&(x.log=console.log);var T=module.exports={};T.start=function(){x.connect()},T.event=function(e,t){return new p(e,t,x.upload)}})(); | ||
(function(){function f(){var e=t.hrtime();return e[0]*1e9+e[1]}function l(){return c.now()*1e6}function p(e,t,n){arguments.length===2&&(n=t,t=u),h+=1,this.id=h,this.name=e,this.metadata=t,this._callback=n||function(){},this.started=(new Date).valueOf(),this._start=a(),this._callback(this)}function g(e,t,r){try{arguments.length===2&&(r=t,t=u);var i=n(t),s=d.parse(e),o={method:"POST",hostname:s.hostname,port:s.port,path:s.path},a=s.protocol.indexOf("https")===0?m:v,f=[],l=a.request(o,function(e){e.setEncoding("utf8"),e.on("data",function(e){f.push(e)}),e.on("end",function(){r(null,e,f.join(""))})});l.on("error",function(e){r(e)}),i&&(l.setHeader("Content-Type","application/json"),l.setHeader("Content-Length",i.length),l.write(i)),l.end()}catch(c){r(c)}}function y(e){function n(e){t.log("LogChop - "+e)}function y(){if(a.length<=f)return;m||(m={event:new p,count:0});var e=a.length-f;a=a.slice(e),m.count+=e,i&&n("dropped "+e+" events")}function S(e,t,r){var i=t&&t.statusCode;e||i!==200?(n("communication error - "+(e||i)),a=l.concat(a)):m=null,h=!1,v()}var t=this,i;t.connect=function(){if(!e)return n("connection url missing");if(i)return;g(e,function(e,t,s){var o=e&&e.code===r,a=t&&t.statusCode;if(o)return u("refused");if(e)return u(e);if(!t)return u("no response");if(a!==200)return u(a+" error");try{eventUri=JSON.parse(s).uri}catch(f){return u("invalid connection response")}if(!eventUri)return u("invalid event uri");n("connected"),i=!0,v()})},t.upload=function(t){a.push(b(t)),w(t),v()},t.log=function(){};var s=0,o,u=function(e){o=o?o*1.7:5e3,s+=1;var r="connection failed ("+e+") ";return s>10?n(r+"exceeded max attempts"):(n(r+"reconnecting in "+Math.round(o/1e3)+" seconds"),setTimeout(t.connect,o))},a=[],f=1e4,l,c=100,h,d=250,v=E(function(){y();if(!i||h||!a.length)return;h=!0,l=a.slice(0,c),a=a.slice(c);var e=[];m&&(m.event.name="client dropped "+m.count+" events",m.event.stop(),e.push(b(m.event))),g(eventUri,e.concat(l),S)},d),m}function b(e){var t;try{e.metadata&&(t=n(e.metadata))}catch(r){t=n("Could not stringify metadata")}return{i:e.id,n:e.name,s:e.started,d:e.duration,p:e.parent,m:t}}function w(e){e.name=e.started=e.duration=e.parent=e.metadata=u}function E(e,t){function s(){i=null,e.apply(r,n)}var n,r,i;return function(){n=arguments,r=this,clearTimeout(i),i=setTimeout(s,t)}}var e=require,t=typeof process!="undefined"?process:{},n=JSON.stringify,r="ECONNREFUSED",i="production",s="test",o="undefined",u,a=t.hrtime?f:l,c={};typeof window!==o&&window.performance&&(c=window.performance),c.now=c.now||c.mozNow||c.msNow||c.oNow||c.webkitNow||function(){return(new Date).getTime()};var h=0;p.prototype.constructor=p,p.prototype.stop=function(){this.duration=a()-this._start,this._callback(this)},p.prototype.until=function(e,t){var n=this;return function(){n.stop(),e.apply(t,arguments)}};var d=e("url"),v=e("http"),m=e("https");y.prototype.constructor=y;var S=t.env||{},x=new y(S.LOGCHOP_URL);S.NODE_ENV!==i&&S.NODE_ENV!==s&&(x.log=console.log);var T=module.exports={};T.start=function(){x.connect()},T.event=function(e,t){return new p(e,t,x.upload)}})(); |
{ | ||
"name": "logchop", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "web app performance metrics logchop.com", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12697