(self.webpackChunklite=self.webpackChunklite||[]).push([[5573],{45573:(t,e,n)=>{t.exports=n(59792)},59792:function(t){t.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t:{default:t}}(n(24)),o=n(4),i={Tracer:r.default};o.Platform.initLibrary(i),t.exports=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(t)for(var n in t)hasOwnProperty.call(t,n)&&e(t[n],n)},t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(7),o=function(){function t(){}return t.prototype.context=function(){return this._context()},t.prototype.tracer=function(){return this._tracer()},t.prototype.setOperationName=function(t){return this._setOperationName(t),this},t.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},t.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},t.prototype.setTag=function(t,e){return this._addTags(((n={})[t]=e,n)),this;var n},t.prototype.addTags=function(t){return this._addTags(t),this},t.prototype.log=function(t,e){return this._log(t,e),this},t.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},t.prototype.finish=function(t){this._finish(t)},t.prototype._context=function(){return r.spanContext},t.prototype._tracer=function(){return r.tracer},t.prototype._setOperationName=function(t){},t.prototype._setBaggageItem=function(t,e){},t.prototype._getBaggageItem=function(t){},t.prototype._addTags=function(t){},t.prototype._log=function(t,e){},t.prototype._finish=function(t){},t}();e.Span=o,e.default=o},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.LOG_INFO=0,r=e.LOG_WARN=1,o=e.LOG_ERROR=2,i=e.LOG_FATAL=3;e.LOG_LEVEL_TO_STRING={LOG_INFO:"I",LOG_WARN:"W",LOG_ERROR:"E",LOG_FATAL:"F"},e.LOG_STRING_TO_LEVEL={I:n,W:r,E:o,F:i},e.CLOCK_STATE_REFRESH_INTERVAL_MS=350,e.LIGHTSTEP_APP_URL_PREFIX="https://app.lightstep.com",e.JOIN_ID_PREFIX="join:"},function(t,e,n){"use strict";t.exports={Platform:n(18),Transport:n(20),thrift:n(19),crouton_thrift:n(16)}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toString=function(t){return""+t},e.toNumber=function(t){return Number(t)},e.toBoolean=function(t){return!!t}},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0});var o=n(32);e.BinaryCarrier=o.default;var i=n(33);e.Tags=i;var s=n(7),a=n(12);e.Reference=a.default;var u=n(2);e.Span=u.default;var l=n(13);e.SpanContext=l.default;var c=n(8);e.Tracer=c.default,r(n(34)),r(n(10)),r(n(11)),s.initialize()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(13),i=n(8);e.tracer=null,e.spanContext=null,e.span=null,e.initialize=function(){e.tracer=new i.default,e.span=new r.default,e.spanContext=new o.default}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(11),o=n(7),i=n(2),s=function(){function t(){}return t.prototype.startSpan=function(t,e){if(void 0===e&&(e={}),e.childOf){var n=r.childOf(e.childOf);e.references?e.references.push(n):e.references=[n],delete e.childOf}return this._startSpan(t,e)},t.prototype.inject=function(t,e,n){return t instanceof i.default&&(t=t.context()),this._inject(t,e,n)},t.prototype.extract=function(t,e){return this._extract(t,e)},t.prototype._startSpan=function(t,e){return o.span},t.prototype._inject=function(t,e,n){},t.prototype._extract=function(t,e){return o.spanContext},t}();e.Tracer=s,e.default=s},function(t,e){"use strict";!function(){var e={},n={};void 0===n&&(n={}),n.KeyValue=function(t){if(this.Key=null,this.Value=null,t){if(void 0===t.Key)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Key is unset!");if(this.Key=t.Key,void 0===t.Value)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Value is unset!");this.Value=t.Value}},n.KeyValue.prototype={},n.KeyValue.prototype.read=!1,n.KeyValue.prototype.write=!1,n.NamedCounter=function(t){if(this.Name=null,this.Value=null,t){if(void 0===t.Name)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Name is unset!");if(this.Name=t.Name,void 0===t.Value)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Value is unset!");this.Value=t.Value}},n.NamedCounter.prototype={},n.NamedCounter.prototype.read=!1,n.NamedCounter.prototype.write=!1,n.Runtime=function(t){this.guid=null,this.start_micros=null,this.group_name=null,this.attrs=null,t&&(void 0!==t.guid&&(this.guid=t.guid),void 0!==t.start_micros&&(this.start_micros=t.start_micros),void 0!==t.group_name&&(this.group_name=t.group_name),void 0!==t.attrs&&(this.attrs=t.attrs))},n.Runtime.prototype={},n.Runtime.prototype.read=!1,n.Runtime.prototype.write=!1,n.LogRecord=function(t){this.timestamp_micros=null,this.fields=null,this.runtime_guid=null,this.span_guid=null,this.stable_name=null,this.message=null,this.level=null,this.thread_id=null,this.filename=null,this.line_number=null,this.stack_frames=null,this.payload_json=null,this.error_flag=null,t&&(void 0!==t.timestamp_micros&&(this.timestamp_micros=t.timestamp_micros),void 0!==t.fields&&(this.fields=t.fields),void 0!==t.runtime_guid&&(this.runtime_guid=t.runtime_guid),void 0!==t.span_guid&&(this.span_guid=t.span_guid),void 0!==t.stable_name&&(this.stable_name=t.stable_name),void 0!==t.message&&(this.message=t.message),void 0!==t.level&&(this.level=t.level),void 0!==t.thread_id&&(this.thread_id=t.thread_id),void 0!==t.filename&&(this.filename=t.filename),void 0!==t.line_number&&(this.line_number=t.line_number),void 0!==t.stack_frames&&(this.stack_frames=t.stack_frames),void 0!==t.payload_json&&(this.payload_json=t.payload_json),void 0!==t.error_flag&&(this.error_flag=t.error_flag))},n.LogRecord.prototype={},n.LogRecord.prototype.read=!1,n.LogRecord.prototype.write=!1,n.TraceJoinId=function(t){if(this.TraceKey=null,this.Value=null,t){if(void 0===t.TraceKey)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field TraceKey is unset!");if(this.TraceKey=t.TraceKey,void 0===t.Value)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Value is unset!");this.Value=t.Value}},n.TraceJoinId.prototype={},n.TraceJoinId.prototype.read=!1,n.TraceJoinId.prototype.write=!1,n.SpanRecord=function(t){this.span_guid=null,this.trace_guid=null,this.runtime_guid=null,this.span_name=null,this.join_ids=null,this.oldest_micros=null,this.youngest_micros=null,this.attributes=null,this.error_flag=null,this.log_records=null,t&&(void 0!==t.span_guid&&(this.span_guid=t.span_guid),void 0!==t.trace_guid&&(this.trace_guid=t.trace_guid),void 0!==t.runtime_guid&&(this.runtime_guid=t.runtime_guid),void 0!==t.span_name&&(this.span_name=t.span_name),void 0!==t.join_ids&&(this.join_ids=t.join_ids),void 0!==t.oldest_micros&&(this.oldest_micros=t.oldest_micros),void 0!==t.youngest_micros&&(this.youngest_micros=t.youngest_micros),void 0!==t.attributes&&(this.attributes=t.attributes),void 0!==t.error_flag&&(this.error_flag=t.error_flag),void 0!==t.log_records&&(this.log_records=t.log_records))},n.SpanRecord.prototype={},n.SpanRecord.prototype.read=!1,n.SpanRecord.prototype.write=!1,n.Auth=function(t){this.access_token=null,t&&void 0!==t.access_token&&(this.access_token=t.access_token)},n.Auth.prototype={},n.Auth.prototype.read=!1,n.Auth.prototype.write=!1,n.Timing=function(t){this.receive_micros=null,this.transmit_micros=null,t&&(void 0!==t.receive_micros&&(this.receive_micros=t.receive_micros),void 0!==t.transmit_micros&&(this.transmit_micros=t.transmit_micros))},n.Timing.prototype={},n.Timing.prototype.read=!1,n.Timing.prototype.write=!1,n.SampleCount=function(t){this.oldest_micros=null,this.youngest_micros=null,this.count=null,t&&(void 0!==t.oldest_micros&&(this.oldest_micros=t.oldest_micros),void 0!==t.youngest_micros&&(this.youngest_micros=t.youngest_micros),void 0!==t.count&&(this.count=t.count))},n.SampleCount.prototype={},n.SampleCount.prototype.read=!1,n.SampleCount.prototype.write=!1,n.MetricsSample=function(t){if(this.name=null,this.int64_value=null,this.double_value=null,t){if(void 0===t.name)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field name is unset!");this.name=t.name,void 0!==t.int64_value&&(this.int64_value=t.int64_value),void 0!==t.double_value&&(this.double_value=t.double_value)}},n.MetricsSample.prototype={},n.MetricsSample.prototype.read=!1,n.MetricsSample.prototype.write=!1,n.Metrics=function(t){this.counts=null,this.gauges=null,t&&(void 0!==t.counts&&(this.counts=t.counts),void 0!==t.gauges&&(this.gauges=t.gauges))},n.Metrics.prototype={},n.Metrics.prototype.read=!1,n.Metrics.prototype.write=!1,n.ReportRequest=function(t){this.runtime=null,this.span_records=null,this.log_records=null,this.timestamp_offset_micros=null,this.oldest_micros=null,this.youngest_micros=null,this.counters=null,this.internal_logs=null,this.internal_metrics=null,t&&(void 0!==t.runtime&&(this.runtime=t.runtime),void 0!==t.span_records&&(this.span_records=t.span_records),void 0!==t.log_records&&(this.log_records=t.log_records),void 0!==t.timestamp_offset_micros&&(this.timestamp_offset_micros=t.timestamp_offset_micros),void 0!==t.oldest_micros&&(this.oldest_micros=t.oldest_micros),void 0!==t.youngest_micros&&(this.youngest_micros=t.youngest_micros),void 0!==t.counters&&(this.counters=t.counters),void 0!==t.internal_logs&&(this.internal_logs=t.internal_logs),void 0!==t.internal_metrics&&(this.internal_metrics=t.internal_metrics))},n.ReportRequest.prototype={},n.ReportRequest.prototype.read=!1,n.ReportRequest.prototype.write=!1,n.Command=function(t){this.disable=null,t&&void 0!==t.disable&&(this.disable=t.disable)},n.Command.prototype={},n.Command.prototype.read=!1,n.Command.prototype.write=!1,n.ReportResponse=function(t){this.commands=null,this.timing=null,this.errors=null,t&&(void 0!==t.commands&&(this.commands=t.commands),void 0!==t.timing&&(this.timing=t.timing),void 0!==t.errors&&(this.errors=t.errors))},n.ReportResponse.prototype={},n.ReportResponse.prototype.read=!1,n.ReportResponse.prototype.write=!1,t.exports.crouton_thrift=n,t.exports.Thrift={}}()},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT_BINARY="binary",e.FORMAT_TEXT_MAP="text_map",e.FORMAT_HTTP_HEADERS="http_headers",e.REFERENCE_CHILD_OF="child_of",e.REFERENCE_FOLLOWS_FROM="follows_from"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(2);e.childOf=function(t){return t instanceof i.default&&(t=t.context()),new o.default(r.REFERENCE_CHILD_OF,t)},e.followsFrom=function(t){return t instanceof i.default&&(t=t.context()),new o.default(r.REFERENCE_FOLLOWS_FROM,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=function(){function t(t,e){this._type=t,this._referencedContext=e instanceof r.default?e.context():e}return t.prototype.type=function(){return this._type},t.prototype.referencedContext=function(){return this._referencedContext},t}();e.default=o},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){};e.SpanContext=n,e.default=n},function(t,e,n){"use strict";var r=function(){function t(t,e){for(var n=0;n=i.LOG_ERROR&&this.error(!0),this}},{key:"span",value:function(t){return void 0!==t&&(this._record.span_guid=s.toString(t)),this}},{key:"name",value:function(t){return this._record.stable_name=s.toString(t),this}},{key:"error",value:function(t){return this._record.error_flag=s.toBoolean(t),this}},{key:"payload",value:function(t){return void 0!==t&&(this._record.payload_json=this._encodePayload(t)),this}},{key:"_encodePayload",value:function(t){var e=null;try{e=JSON.stringify(t)}catch(t){return}return e}}]),t}();t.exports=a},function(t,e,n){"use strict";t.exports=n(9).crouton_thrift},function(t,e){"use strict";var n=function(){var t=document.getElementsByTagName("SCRIPT");return t.length>0?t[t.length-1]:null}();t.exports.parseScriptElementOptions=function(t,e){if(n){var r=n.dataset,o=r.access_token;"string"==typeof o&&o.length>0&&(t.access_token=o);var i=r.component_name;"string"==typeof i&&i.length>0&&(t.component_name=i);var s=r.collector_host;"string"==typeof s&&s.length>0&&(t.collector_host=s);var a=r.collector_port;a&&(t.collector_port=parseInt(a,10));var u=r.collector_path;"string"==typeof u&&u.length>0&&(t.collector_path=u);var l=r.collector_encryption;l&&(t.collector_encryption=l);var c=r.enable;"string"==typeof c&&("true"===c?t.enable=!0:"false"===c&&(t.enable=!1));var p=r.verbosity;"string"==typeof p&&(t.verbosity=parseInt(p,10));var _=r.init_global_tracer;"string"==typeof _&&("true"===_?e.init_global_tracer=!0:"false"===_&&(e.init_global_tracer=!1)),"string"==typeof r.xhr_instrumentation&&"true"===r.xhr_instrumentation&&(t.xhr_instrumentation=!0),"string"==typeof r.instrument_page_load&&"true"===r.instrument_page_load&&(t.instrument_page_load=!0)}},t.exports.parseURLQueryOptions=function(t){if(window){var e=function(t){var e={},n=window.location.href.indexOf("?");if(n<0)return e;var r=window.location.href.slice(n+1);r.indexOf("#")>=0&&(r=r.slice(0,r.indexOf("#")));for(var o=r.replace(/\+/,"%20").split("&"),i=0;i1){var s=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString():"")+(r?"; path="+r:"")+(o?"; domain="+o:"")+(i?"; secure":"");return document.cookie=s,s}return decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;nn._tracerImp._options.log_field_key_hard_limit&&(n._tracerImp._counters["logs.keys.over_limit"]++,r=r.substr(0,n._tracerImp._options.log_field_key_hard_limit)+"..."),s.length>n._tracerImp._options.log_field_value_hard_limit&&(n._tracerImp._counters["logs.values.over_limit"]++,s=s.substr(0,n._tracerImp._options.log_field_value_hard_limit)+"..."),o.push(new l.crouton_thrift.KeyValue({Key:r,Value:s}))}}));var s=new l.crouton_thrift.LogRecord({timestamp_micros:r,fields:o});n._log_records=n._log_records||[],n._log_records.push(s),n._tracerImp.emit("log_added",s)}else n._tracerImp._error("Span.log() expects an object as its first argument")}},{key:"_finish",value:function(t){return this.end(t)}}]),o(e,[{key:"getOperationName",value:function(){return this._operationName}},{key:"guid",value:function(){return this._ctx._guid}},{key:"traceGUID",value:function(){return this._ctx._traceGUID}},{key:"parentGUID",value:function(){return this._tags.parent_span_guid}},{key:"setParentGUID",value:function(t){return this._tags.parent_span_guid=i.toString(t),this}},{key:"beginMicros",value:function(){return this._beginMicros}},{key:"setBeginMicros",value:function(t){return this._beginMicros=t,this}},{key:"endMicros",value:function(){return this._endMicros}},{key:"setEndMicros",value:function(t){return this._endMicros=t,this}},{key:"generateTraceURL",value:function(){var t;return t=this._beginMicros>0&&this._endMicros>0?Math.floor((this._beginMicros+this._endMicros)/2):this._tracerImp._platform.nowMicros(),s.LIGHTSTEP_APP_URL_PREFIX+"/"+encodeURIComponent(this._tracerImp.options().access_token)+"/trace?span_guid="+encodeURIComponent(this.guid())+"&at_micros="+t}},{key:"getTags",value:function(){return this._tags}},{key:"end",value:function(t){this._ended||(this._ended=!0,void 0!==t&&(this._endMicros=1e3*t),0===this._endMicros&&(this._endMicros=this._tracerImp._platform.nowMicros()),this._tracerImp._addSpanRecord(this._toThrift()))}},{key:"_toThrift",value:function(){var t=[];return(0,a.default)(this._tags,(function(e,n){t.push(new l.crouton_thrift.KeyValue({Key:i.toString(n),Value:i.toString(e)}))})),new l.crouton_thrift.SpanRecord({span_guid:this.guid(),trace_guid:this.traceGUID(),runtime_guid:this._tracerImp.guid(),span_name:this._operationName,oldest_micros:this._beginMicros,youngest_micros:this._endMicros,attributes:t,error_flag:this._errorFlag,log_records:this._log_records})}}]),e}(u.Span);e.default=c,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n=3&&function(){var t="",r=0;(0,l.default)(n,(function(e,n){t+="\t"+JSON.stringify(n)+": "+JSON.stringify(e.newValue)+"\n",r++})),r>0&&e._debug("Options modified:\n"+t)}(),this.emit("options",n,this._options,this)}},{key:"_setOptionInternal",value:function(t,e,n,r){var o=r.name,i=n[o],s=typeof i;if(void 0!==i){switch(r.type){case"any":break;case"bool":if(!0!==i&&!1!==i)return void this._error("Invalid boolean option '"+o+"' '"+i+"'");break;case"int":if("number"!==s||Math.floor(i)!==i)return void this._error("Invalid int option '"+o+"' '"+i+"'");if(void 0!==r.min&&void 0!==r.max&&!(i>=r.min&&i<=r.max))return void this._error("Option '"+o+"' out of range '"+i+"' is not between "+r.min+" and "+r.max);break;case"string":switch(s){case"string":break;case"number":i=f.toString(i);break;default:return void this._error("Invalid string option "+o+" "+i)}break;case"array":if("[object Array]"!==Object.prototype.toString.call(i))return void this._error("Invalid type for array option "+o+": found '"+s+"'");break;default:return void this._error("Unknown option type '"+r.type+"'")}var a=this._options[o];if(void 0===a)throw new Error("Attempt to set unknown option "+o);if("object"!==s&&a===i)return void(e[o]=!0);t[o]={oldValue:a,newValue:i},this._options[o]=i}}},{key:"_initReportingDataIfNeeded",value:function(t){var e=this;if(null===this._thriftAuth)this._options.access_token.length>0&&this._options.component_name.length>0&&function(){e._runtimeGUID=e._platform.runtimeGUID(e._options.component_name),e._thriftAuth=new c.crouton_thrift.Auth({access_token:e._options.access_token});var t={};(0,l.default)(e._options.tags,(function(n,r){return"string"!=typeof n?void e._error("Tracer tag value is not a string: key="+r):void(t[r]=n)})),t["lightstep.tracer_version"]=v.version;var n=e._platform.tracerTags();(0,l.default)(n,(function(e,n){t[n]=e}));var r=[];(0,l.default)(t,(function(t,e){r.push(new c.crouton_thrift.KeyValue({Key:f.toString(e),Value:f.toString(t)}))})),e._thriftRuntime=new c.crouton_thrift.Runtime({guid:e._runtimeGUID,start_micros:e._startMicros,group_name:e._options.component_name,attrs:r}),e._info("Initializing thrift reporting data",{component_name:e._options.component_name,access_token:e._thriftAuth.access_token}),e.emit("reporting_initialized")}();else{if(!this._thriftRuntime)return this._error("Inconsistent state: thrift auth initialized without runtime.");if(t.access_token)throw new Error("Cannot change access_token after it has been set.");if(t.component_name)throw new Error("Cannot change component_name after it has been set.");if(t.collector_host)throw new Error("Cannot change collector_host after the connection is established");if(t.collector_port)throw new Error("Cannot change collector_port after the connection is established");if(t.collector_path)throw new Error("Cannot change collector_path after the connection is established");if(t.collector_encryption)throw new Error("Cannot change collector_encryption after the connection is established")}}},{key:"addPlatformPlugins",value:function(t){var e=this,n=this._platform.plugins(t);(0,l.default)(n,(function(t){e.addPlugin(t)}))}},{key:"addPlugin",value:function(t){var e=t.name();this._plugins[e]||(this._plugins[e]=t,t.addOptions(this))}},{key:"startPlugins",value:function(){var t=this;(0,l.default)(this._plugins,(function(e,n){t._plugins[n].start(t)}))}},{key:"addActiveRootSpan",value:function(t){this._activeRootSpanSet[t._guid]=t,this._setActiveRootSpanToYoungest()}},{key:"removeActiveRootSpan",value:function(t){delete this._activeRootSpanSet[t._guid],this._setActiveRootSpanToYoungest()}},{key:"_setActiveRootSpanToYoungest",value:function(){var t=this;this._activeRootSpan=null,(0,l.default)(this._activeRootSpanSet,(function(e){(!t._activeRootSpan||e._beginMicros>t._activeRootSpan._beginMicros)&&(t._activeRootSpan=e)}))}},{key:"_objectToUint8Array",value:function(t){var e=void 0;try{e=encodeURIComponent(JSON.stringify(t))}catch(t){return this._error("Could not binary encode carrier data."),null}for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=0&&i<=255))return this._error("Unexpected character code"),null;r[o]=i}return r}},{key:"_uint8ArrayToObject",value:function(t){if(!t)return this._error("Array is null"),null;for(var e="",n=0;n0)return!1;if(this._internalLogs.length>0)return!1;var t=!0;return(0,l.default)(this._counters,(function(e){e>0&&(t=!1)})),t}},{key:"_addSpanRecord",value:function(t){this._internalAddSpanRecord(t),this.emit("span_added",t)}},{key:"_internalAddSpanRecord",value:function(t){if(t)if(this._spanRecords.length>=this._options.max_span_records){var e=Math.floor(this._spanRecords.length*Math.random());this._spanRecords[e]=t,this._counters["spans.dropped"]++}else this._spanRecords.push(t);else this._error("Attempt to add null record to buffer")}},{key:"_restoreRecords",value:function(t,e,n){var r=this;(0,l.default)(t,(function(t){r._internalAddSpanRecord(t)}));var o=this._internalLogs;this._internalLogs=[];var i=e.concat(o);(0,l.default)(i,(function(t){r._pushInternalLog(t)})),(0,l.default)(n,(function(t){r._counters[t.Name]?r._counters[t.Name]+=t.Value:r._error("Bad counter name: "+t.Name)}))}},{key:"_setupReportOnExit",value:function(){var t=this;if(this._options.disable_report_on_exit)this._debug("report-on-exit is disabled.");else{var e=0;this._platform.onBeforeExit((function(){e++>0||(t._info("Final flush before exit."),t._flushReport(!1,!0,(function(e){e&&t._warn("Final report before exit failed",{error:e,unflushed_spans:t._spanRecords.length,buffer_youngest_micros:t._reportYoungestMicros})})))}))}}},{key:"_startReportingLoop",value:function(){var t=this;if(this._options.disabled)this._info("Not starting reporting loop: instrumentation is disabled.");else if(this._options.disable_reporting_loop)this._info("Not starting reporting loop: reporting loop is disabled.");else if(null!==this._thriftAuth){if(this._reportingLoopActive)return void this._info("Reporting loop already started!");this._info("Starting reporting loop:",this._thriftRuntime),this._reportingLoopActive=!0;var e=0;this._platform.onBeforeExit((function(){e++>0||t._stopReportingLoop()}));var n=function(){t._enqueueNextReport((function(e){t._reportingLoopActive&&n()}))},r=Math.floor(Math.random()*this._options.delay_initial_report_millis);g.detachedTimeout((function(){n()}),r)}}},{key:"_stopReportingLoop",value:function(){this._debug("Stopping reporting loop"),this._reportingLoopActive=!1,clearTimeout(this._reportTimer),this._reportTimer=null}},{key:"_enqueueNextReport",value:function(t){var e=this;if(!this._reportTimer){var n=this._options.max_reporting_interval_millis;0===this._reportErrorStreak&&this._useClockState&&!this._clockState.isReady()&&(n=Math.min(d.CLOCK_STATE_REFRESH_INTERVAL_MS,n));var r=(1+Math.min(7,Math.max(0,this._reportErrorStreak)))*n,o=.5*Math.random()-.25+1,i=Math.floor(Math.max(0,o*r));this._debug("Delaying next flush for "+i+"ms"),this._reportTimer=g.detachedTimeout((function(){e._reportTimer=null,e._flushReport(!1,!1,t)}),i)}}},{key:"_flushReport",value:function(t,e,n){var r=this;n=n||function(t){};var o=this._clockState.isReady(),i=this._clockState.offsetMicros();this._debug("time correction state",{offset_micros:i,active_samples:this._clockState.activeSampleCount(),ready:o});var s=this._spanRecords,a=this._counters,u=this._internalLogs;if(!this._useClockState||t||o||e){if(this._buffersAreEmpty())return this._debug("Skipping empty report"),n(null);this._clearBuffers(),this._debug("Flushing report ("+s.length+" spans)")}else this._debug("Flushing empty report to prime clock state"),s=[],a={},u=[];this._transport.ensureConnection(this._options),console.assert(null!==this._runtimeGUID,"No runtime GUID for Tracer"),(0,l.default)(s,(function(t){t.runtime_guid=r._runtimeGUID}));var p=[];(0,l.default)(a,(function(t,e){0!==t&&p.push(new c.crouton_thrift.MetricsSample({name:f.toString(e),double_value:f.toNumber(t)}))}));var _=this._useClockState?i:0,d=this._platform.nowMicros(),h=new c.crouton_thrift.ReportRequest({runtime:this._thriftRuntime,oldest_micros:this._reportYoungestMicros,youngest_micros:d,span_records:s,internal_logs:u,internal_metrics:new c.crouton_thrift.Metrics({counts:p}),timestamp_offset_micros:_});this.emit("prereport",h);var v=this._platform.nowMicros();this._transport.report(e,this._thriftAuth,h,(function(t,o){var i=r._platform.nowMicros(),s=(d-h.oldest_micros)/1e6;if(t){r._reportErrorStreak++;var a;a=t.message?""+t.message:""+t,r._warn("Error in report: "+a,{last_report_seconds_ago:s}),r._restoreRecords(h.span_records,h.internal_logs,h.counters),r._counters["reports.errors.send"]++,r.emit("report_error",t,{error:t,streak:r._reportErrorStreak,detached:e})}else r.verbosity()>=4&&r._debug("Report flushed for last "+s+" seconds",{spans_reported:h.span_records.length}),r._reportErrorStreak=0,r._reportYoungestMicros=d,o?(o.timing&&o.timing.receive_micros&&o.timing.transmit_micros?r._clockState.addSample(v,o.timing.receive_micros,o.timing.transmit_micros,i):r._useClockState=!1,o.errors&&o.errors.length>0&&r._warn("Errors in report",o.errors)):r._useClockState=!1,r.emit("report",h,o);return n(t)}))}},{key:"stats",value:function(){return{counters:this._counters}}},{key:"_debug",value:function(t,e){this.verbosity()<4||this._printToConsole("log","[LightStep:DEBUG] "+t,e)}},{key:"_info",value:function(t,e){this.verbosity()<3||this._printToConsole("log","[LightStep:INFO] "+t,e)}},{key:"_warn",value:function(t,e){this._counters["internal.warnings"]++,this.verbosity()<3||this._printToConsole("warn","[LightStep:WARN] "+t,e)}},{key:"_error",value:function(t,e){this._counters["internal.errors"]++;var n=this.log().level(d.LOG_ERROR).message(t).payload(e).record();this._pushInternalLog(n);var r=this.verbosity();if(0!==r){var o=Date.now();if(1===r){if(o0){var i=this._skippedVisibleErrors+" errors masked since last logged error. Increase 'verbosity' option to see all errors.";this._printToConsole("error","[LightStep:ERROR] "+i,e)}}this._printToConsole("error","[LightStep:ERROR] "+t,e),this._lastVisibleErrorMillis=o,this._skippedVisibleErrors=0}}},{key:"_printToConsole",value:function(t,e,n){this._options.silent||(void 0!==n?console[t](e,n):console[t](e))}},{key:"_pushInternalLog",value:function(t){t&&(this._internalLogs.length>=20?(t.message="MAX_INTERNAL_LOGS limit hit. Last error: "+t.message,this._internalLogs[this._internalLogs.length-1]=t):this._internalLogs.push(t))}}]),e}(s.Tracer);e.default=w,t.exports=e.default},function(t,e,n){"use strict";var r=function(){function t(t,e){for(var n=0;nthis._nowMicros()-36e8&&(this._samples=n.samples.slice(-8)),this.update()}return r(t,[{key:"addSample",value:function(t,e,n,r){var o=Number.MAX_VALUE,i=0;t>0&&e>0&&n>0&&r>0&&(o=r-t-(n-e),i=(e-t+(n-r))/2),8===this._samples.length&&this._samples.shift(),this._samples.push({delayMicros:o,offsetMicros:i}),this._currentOffsetAge++,this._localStoreSet({timestamp_micros:this._nowMicros(),samples:this._samples}),this.update()}},{key:"update",value:function(){var t=Number.MAX_VALUE,e=0;if((0,o.default)(this._samples,(function(n){n.delayMicros7||Math.abs(this._currentOffsetMicros-e)<3*n)&&(this._currentOffsetMicros=e,this._currentOffsetAge=0)}}},{key:"offsetMicros",value:function(){return Math.floor(this._currentOffsetMicros)}},{key:"isReady",value:function(){return this._samples.length>3}},{key:"activeSampleCount",value:function(){return this._samples.length}}]),t}();t.exports=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var n=0;n0?e:null}function o(t){for(var e=t.getAllResponseHeaders().replace(/\s+$/,"").split(/\n/),n=0;n=0.12.0"},scripts:{test:"rm -f test/results/*.json && node node_modules/mocha/bin/mocha -c test/unittest_node.js"},license:"MIT",repository:{type:"git",url:"http://github.com/lightstep/lightstep-tracer-javascript.git"},dependencies:{async:"1.5.0",eventemitter3:"1.1.1","source-map-support":"0.3.3",thrift:"0.9.2"},devDependencies:{"babel-cli":"6.14.0","babel-core":"6.3.26","babel-loader":"6.2.0","babel-plugin-add-module-exports":"0.1.2","babel-plugin-check-es2015-constants":"6.7.2","babel-plugin-transform-es2015-arrow-functions":"6.5.2","babel-plugin-transform-es2015-block-scoped-functions":"6.6.5","babel-plugin-transform-es2015-block-scoping":"6.7.1","babel-plugin-transform-es2015-classes":"6.6.5","babel-plugin-transform-es2015-computed-properties":"6.6.5","babel-plugin-transform-es2015-destructuring":"6.6.5","babel-plugin-transform-es2015-duplicate-keys":"6.6.4","babel-plugin-transform-es2015-literals":"6.5.0","babel-plugin-transform-es2015-modules-commonjs":"6.7.4","babel-plugin-transform-es2015-object-super":"6.6.5","babel-plugin-transform-es2015-parameters":"6.7.0","babel-plugin-transform-es2015-spread":"6.6.5","babel-plugin-transform-es2015-sticky-regex":"6.5.0","babel-plugin-transform-es2015-template-literals":"6.6.5","babel-plugin-transform-es2015-unicode-regex":"6.5.0","babel-polyfill":"6.3.14","babel-preset-es2015":"6.3.13",chai:"3.4.1",clone:"1.0.2",colors:"1.1.2",eslint:"2.4.0","eslint-config-airbnb":"6.2.0","eslint-plugin-react":"4.2.3",express:"^4.16.3",istanbul:"0.4.4","json-loader":"0.5.4",mocha:"2.3.4",opentracing:"0.14.0",shelljs:"0.5.3","sprintf-js":"1.0.3",underscore:"1.8.3","watch-trigger":"0.0.5",webpack:"1.12.9"}}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){this.buffer=t};e.default=n},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SPAN_KIND="span.kind",e.SPAN_KIND_RPC_CLIENT="client",e.SPAN_KIND_RPC_SERVER="server",e.SPAN_KIND_MESSAGING_PRODUCER="producer",e.SPAN_KIND_MESSAGING_CONSUMER="consumer",e.ERROR="error",e.COMPONENT="component",e.SAMPLING_PRIORITY="sampling.priority",e.PEER_SERVICE="peer.service",e.PEER_HOSTNAME="peer.hostname",e.PEER_ADDRESS="peer.address",e.PEER_HOST_IPV4="peer.ipv4",e.PEER_HOST_IPV6="peer.ipv6",e.PEER_PORT="peer.port",e.HTTP_URL="http.url",e.HTTP_METHOD="http.method",e.HTTP_STATUS_CODE="http.status_code",e.MESSAGE_BUS_DESTINATION="message_bus.destination",e.DB_INSTANCE="db.instance",e.DB_STATEMENT="db.statement",e.DB_TYPE="db.type",e.DB_USER="db.user"},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(8),i=new o.default,s=null,a=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.startSpan=function(){return(s||i).startSpan.apply(this,arguments)},e.prototype.inject=function(){return(s||i).inject.apply(this,arguments)},e.prototype.extract=function(){return(s||i).extract.apply(this,arguments)},e}(o.default));e.initGlobalTracer=function(t){s=t},e.globalTracer=function(){return a}}])}}]); //# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/5573.159bf40f.chunk.js.map