Comparing version 0.1.0 to 0.1.1
@@ -1,1 +0,1 @@ | ||
(function(){function a(){var e=t.hrtime();return e[0]*1e9+e[1]}function f(){return l.now()*1e6}function h(e,t,n){arguments.length===2&&(n=t,t=o),c+=1,this.id=c,this.name=e,this.metadata=t,this._callback=n||function(){},this.started=(new Date).valueOf(),this._start=u(),this._callback(this)}function m(e,t,r){try{arguments.length===2&&(r=t,t=o);var i=n(t),s=p.parse(e),u={method:"POST",hostname:s.hostname,port:s.port,path:s.path},a=s.protocol.indexOf("https")===0?v:d,f=[],l=a.request(u,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 g(e){function g(){if(u.length<=a)return;v||(v={event:new h,count:0});var e=u.length-a;u=u.slice(e),v.count+=e,t.log("dropped "+e+" events")}function E(e,n,r){var i=n&&n.statusCode;e||i!==200?(t.log("LogChop communication error - "+(e||i)),u=f.concat(u)):v=null,c=!1,d()}var t=this,n;t.connect=function(){if(!e)return t.log("connection url missing");if(n)return;m(e,function(e,i,s){var u=e&&e.code===r,a=i&&i.statusCode;if(u)return o("refused");if(e)return o(e);if(!i)return o("no response");if(a!==200)return o(a+" error");try{eventUri=JSON.parse(s).uri}catch(f){return o("invalid connection response")}if(!eventUri)return o("invalid event uri");t.log("LogChop connected"),n=!0,d()})},t.upload=function(t){u.push(y(t)),b(t),d()},t.log=function(){};var i=0,s,o=function(e){s=s?s*1.7:5e3,i+=1;var n="LogChop connection failed ("+e+") ";return i>10?t.log(n+"exceeded max attempts"):(t.log(n+"reconnecting in "+Math.round(s/1e3)+" seconds"),setTimeout(t.connect,s))},u=[],a=1e4,f,l=100,c,p=1e3,d=w(function(){g();if(!n||c||!u.length)return;c=!0,f=u.slice(0,l),u=u.slice(l);var e=[];v&&(v.event.name="LogChop client dropped "+v.count+" events",v.event.stop(),e.push(y(v.event))),m(eventUri,e.concat(f),E)},p),v}function y(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 b(e){e.name=e.started=e.duration=e.parent=e.metadata=o}function w(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="undefined",o,u=t.hrtime?a:f,l={};typeof window!==s&&window.performance&&(l=window.performance),l.now=l.now||l.mozNow||l.msNow||l.oNow||l.webkitNow||function(){return(new Date).getTime()};var c=0;h.prototype.constructor=h,h.prototype.stop=function(){this.duration=u()-this._start,this._callback(this)},h.prototype.until=function(e,t){var n=this;return function(){n.stop(),e.apply(t,arguments)}};var p=e("url"),d=e("http"),v=e("https");g.prototype.constructor=g;var E=t.env||{},S=new g(E.LOGCHOP_URL);E.NODE_ENV!==i&&(S.log=console.log);var x=module.exports={};x.start=function(){S.connect()},x.event=function(e,t){return new h(e,t,S.upload)}})(); | ||
(function(){function a(){var e=t.hrtime();return e[0]*1e9+e[1]}function f(){return l.now()*1e6}function h(e,t,n){arguments.length===2&&(n=t,t=o),c+=1,this.id=c,this.name=e,this.metadata=t,this._callback=n||function(){},this.started=(new Date).valueOf(),this._start=u(),this._callback(this)}function m(e,t,r){try{arguments.length===2&&(r=t,t=o);var i=n(t),s=p.parse(e),u={method:"POST",hostname:s.hostname,port:s.port,path:s.path},a=s.protocol.indexOf("https")===0?v:d,f=[],l=a.request(u,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 g(e){function n(e){t.log("LogChop - "+e)}function E(){if(a.length<=f)return;g||(g={event:new h,count:0});var e=a.length-f;a=a.slice(e),g.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)):g=null,p=!1,v()}var t=this,i;t.connect=function(){if(!e)return n("connection url missing");if(i)return;m(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(y(t)),b(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,p,d=1e3,v=w(function(){E();if(!i||p||!a.length)return;p=!0,l=a.slice(0,c),a=a.slice(c);var e=[];g&&(g.event.name="client dropped "+g.count+" events",g.event.stop(),e.push(y(g.event))),m(eventUri,e.concat(l),S)},d),g}function y(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 b(e){e.name=e.started=e.duration=e.parent=e.metadata=o}function w(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="undefined",o,u=t.hrtime?a:f,l={};typeof window!==s&&window.performance&&(l=window.performance),l.now=l.now||l.mozNow||l.msNow||l.oNow||l.webkitNow||function(){return(new Date).getTime()};var c=0;h.prototype.constructor=h,h.prototype.stop=function(){this.duration=u()-this._start,this._callback(this)},h.prototype.until=function(e,t){var n=this;return function(){n.stop(),e.apply(t,arguments)}};var p=e("url"),d=e("http"),v=e("https");g.prototype.constructor=g;var E=t.env||{},S=new g(E.LOGCHOP_URL);E.NODE_ENV!==i&&(S.log=console.log);var x=module.exports={};x.start=function(){S.connect()},x.event=function(e,t){return new h(e,t,S.upload)}})(); |
{ | ||
"name": "logchop", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"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
12669