@grafana/faro-web-tracing 1.18.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var GrafanaFaroWebTracing=function(t,e){"use strict";var n="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},r="1.9.0",o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var i=function(t){var e=new Set([t]),n=new Set,r=t.match(o);if(!r)return function(){return!1};var i=+r[1],s=+r[2],a=+r[3];if(null!=r[4])return function(e){return e===t};function u(t){return n.add(t),!1}function c(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(n.has(t))return!1;var r=t.match(o);if(!r)return u(t);var l=+r[1],p=+r[2],d=+r[3];return null!=r[4]||i!==l?u(t):0===i?s===p&&a<=d?c(t):u(t):s<=p?c(t):u(t)}}(r),s=r.split(".")[0],a=Symbol.for("opentelemetry.js.api."+s),u=n;function c(t,e,n,o){var i;void 0===o&&(o=!1);var s=u[a]=null!==(i=u[a])&&void 0!==i?i:{version:r};if(!o&&s[t]){var c=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(c.stack||c.message),!1}if(s.version!==r){c=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+t+" does not match previously registered API v"+r);return n.error(c.stack||c.message),!1}return s[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+r+"."),!0}function l(t){var e,n,r=null===(e=u[a])||void 0===e?void 0:e.version;if(r&&i(r))return null===(n=u[a])||void 0===n?void 0:n[t]}function p(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+r+".");var n=u[a];n&&delete n[t]}var d,h=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},f=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},g=function(){function t(t){this._namespace=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("verbose",this._namespace,t)},t}();function m(t,e,n){var r=l("diag");if(r)return n.unshift(e),r[t].apply(r,f([],h(n),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(d||(d={}));var _=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},v=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},y=function(){function t(){function t(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=l("diag");if(r)return r[t].apply(r,v([],_(e),!1))}}var e=this;e.setLogger=function(t,n){var r,o,i;if(void 0===n&&(n={logLevel:d.INFO}),t===e){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof n&&(n={logLevel:n});var a=l("diag"),u=function(t,e){function n(n,r){var o=e[n];return"function"==typeof o&&t>=r?o.bind(e):function(){}}return t<d.NONE?t=d.NONE:t>d.ALL&&(t=d.ALL),e=e||{},{error:n("error",d.ERROR),warn:n("warn",d.WARN),info:n("info",d.INFO),debug:n("debug",d.DEBUG),verbose:n("verbose",d.VERBOSE)}}(null!==(o=n.logLevel)&&void 0!==o?o:d.INFO,t);if(a&&!n.suppressOverrideMessage){var p=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";a.warn("Current logger will be overwritten from "+p),u.warn("Current logger will overwrite one already registered from "+p)}return c("diag",u,e,!0)},e.disable=function(){p("diag",e)},e.createComponentLogger=function(t){return new g(t)},e.verbose=t("verbose"),e.debug=t("debug"),e.info=t("info"),e.warn=t("warn"),e.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),S=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},b=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},E=function(){function t(t){this._entries=t?new Map(t):new Map}return t.prototype.getEntry=function(t){var e=this._entries.get(t);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map((function(t){var e=S(t,2);return[e[0],e[1]]}))},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=new t(this._entries);try{for(var s=b(r),a=s.next();!a.done;a=s.next()){var u=a.value;i._entries.delete(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t}(),T=Symbol("BaggageEntryMetadata"),w=y.instance();function C(t){return void 0===t&&(t={}),new E(new Map(Object.entries(t)))}function A(t){return Symbol.for(t)}var O,R,N=function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(t){return n._currentContext.get(t)},n.setValue=function(e,r){var o=new t(n._currentContext);return o._currentContext.set(e,r),o},n.deleteValue=function(e){var r=new t(n._currentContext);return r._currentContext.delete(e),r}},x=new N,P=(O=function(t,e){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},O(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),L=function(){function t(){}return t.prototype.createGauge=function(t,e){return z},t.prototype.createHistogram=function(t,e){return q},t.prototype.createCounter=function(t,e){return $},t.prototype.createUpDownCounter=function(t,e){return G},t.prototype.createObservableGauge=function(t,e){return W},t.prototype.createObservableCounter=function(t,e){return K},t.prototype.createObservableUpDownCounter=function(t,e){return X},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),D=function(){},I=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.add=function(t,e){},e}(D),M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.add=function(t,e){},e}(D),k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.record=function(t,e){},e}(D),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.record=function(t,e){},e}(D),U=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.removeCallback=function(t){},t}(),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e}(U),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e}(U),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e}(U),V=new L,$=new I,z=new k,q=new j,G=new M,K=new B,W=new F,X=new H,Q={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Y={set:function(t,e,n){null!=t&&(t[e]=n)}},Z=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},J=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},tt=function(){function t(){}return t.prototype.active=function(){return x},t.prototype.with=function(t,e,n){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return e.call.apply(e,J([n],Z(r),!1))},t.prototype.bind=function(t,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},nt=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},rt="context",ot=new tt,it=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return c(rt,t,y.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(t,e,n){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,nt([t,e,n],et(o),!1))},t.prototype.bind=function(t,e){return this._getContextManager().bind(t,e)},t.prototype._getContextManager=function(){return l(rt)||ot},t.prototype.disable=function(){this._getContextManager().disable(),p(rt,y.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(R||(R={}));var st="0000000000000000",at="00000000000000000000000000000000",ut={traceId:at,spanId:st,traceFlags:R.NONE},ct=function(){function t(t){void 0===t&&(t=ut),this._spanContext=t}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(t,e){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,e){return this},t.prototype.addLink=function(t){return this},t.prototype.addLinks=function(t){return this},t.prototype.setStatus=function(t){return this},t.prototype.updateName=function(t){return this},t.prototype.end=function(t){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(t,e){},t}(),lt=A("OpenTelemetry Context Key SPAN");function pt(t){return t.getValue(lt)||void 0}function dt(){return pt(it.getInstance().active())}function ht(t,e){return t.setValue(lt,e)}function ft(t){return t.deleteValue(lt)}function gt(t,e){return ht(t,new ct(e))}function mt(t){var e;return null===(e=pt(t))||void 0===e?void 0:e.spanContext()}var _t=/^([0-9a-f]{32})$/i,vt=/^[0-9a-f]{16}$/i;function yt(t){return _t.test(t)&&t!==at}function St(t){return yt(t.traceId)&&(e=t.spanId,vt.test(e)&&e!==st);var e}function bt(t){return new ct(t)}var Et=it.getInstance(),Tt=function(){function t(){}return t.prototype.startSpan=function(t,e,n){if(void 0===n&&(n=Et.active()),Boolean(null==e?void 0:e.root))return new ct;var r,o=n&&mt(n);return"object"==typeof(r=o)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&St(o)?new ct(o):new ct},t.prototype.startActiveSpan=function(t,e,n,r){var o,i,s;if(!(arguments.length<2)){2===arguments.length?s=e:3===arguments.length?(o=e,s=n):(o=e,i=n,s=r);var a=null!=i?i:Et.active(),u=this.startSpan(t,o,a),c=ht(a,u);return Et.with(c,s,void 0,u)}},t}();var wt,Ct,At,Ot=new Tt,Rt=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.startSpan=function(t,e,n){return this._getTracer().startSpan(t,e,n)},t.prototype.startActiveSpan=function(t,e,n,r){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ot},t}(),Nt=new(function(){function t(){}return t.prototype.getTracer=function(t,e,n){return new Tt},t}()),xt=function(){function t(){}return t.prototype.getTracer=function(t,e,n){var r;return null!==(r=this.getDelegateTracer(t,e,n))&&void 0!==r?r:new Rt(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Nt},t.prototype.setDelegate=function(t){this._delegate=t},t.prototype.getDelegateTracer=function(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(t,e,n)},t}();!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(wt||(wt={})),function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"}(Ct||(Ct={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(At||(At={}));var Pt=it.getInstance(),Lt=y.instance(),Dt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return V},t}()),It="metrics",Mt=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return c(It,t,y.instance())},t.prototype.getMeterProvider=function(){return l(It)||Dt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){p(It,y.instance())},t}().getInstance(),kt=function(){function t(){}return t.prototype.inject=function(t,e){},t.prototype.extract=function(t,e){return t},t.prototype.fields=function(){return[]},t}(),jt=A("OpenTelemetry Baggage Key");function Ut(t){return t.getValue(jt)||void 0}function Bt(){return Ut(it.getInstance().active())}function Ft(t,e){return t.setValue(jt,e)}function Ht(t){return t.deleteValue(jt)}var Vt="propagation",$t=new kt,zt=function(){function t(){this.createBaggage=C,this.getBaggage=Ut,this.getActiveBaggage=Bt,this.setBaggage=Ft,this.deleteBaggage=Ht}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Vt,t,y.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Y),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=Q),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){p(Vt,y.instance())},t.prototype._getGlobalPropagator=function(){return l(Vt)||$t},t}(),qt=zt.getInstance(),Gt="trace",Kt=function(){function t(){this._proxyTracerProvider=new xt,this.wrapSpanContext=bt,this.isSpanContextValid=St,this.deleteSpan=ft,this.getSpan=pt,this.getActiveSpan=dt,this.getSpanContext=mt,this.setSpan=ht,this.setSpanContext=gt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var e=c(Gt,this._proxyTracerProvider,y.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return l(Gt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){p(Gt,y.instance()),this._proxyTracerProvider=new xt},t}().getInstance();const Wt=A("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Xt(t){return t.setValue(Wt,!0)}function Qt(t){return!0===t.getValue(Wt)}const Yt="=",Zt=";",Jt=",",te="baggage";function ee(t){const e=t.split(Zt);if(e.length<=0)return;const n=e.shift();if(!n)return;const r=n.indexOf(Yt);if(r<=0)return;const o=decodeURIComponent(n.substring(0,r).trim()),i=decodeURIComponent(n.substring(r+1).trim());let s;var a;return e.length>0&&("string"!=typeof(a=e.join(Zt))&&(w.error("Cannot create baggage metadata from unknown type: "+typeof a),a=""),s={__TYPE__:T,toString:function(){return a}}),{key:o,value:i,metadata:s}}class ne{inject(t,e,n){const r=qt.getBaggage(t);if(!r||Qt(t))return;const o=function(t){return t.getAllEntries().map((([t,e])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(e.value)}`;return void 0!==e.metadata&&(n+=Zt+e.metadata.toString()),n}))}(r).filter((t=>t.length<=4096)).slice(0,180),i=function(t){return t.reduce(((t,e)=>{const n=`${t}${""!==t?Jt:""}${e}`;return n.length>8192?t:n}),"")}(o);i.length>0&&n.set(e,te,i)}extract(t,e,n){const r=n.get(e,te),o=Array.isArray(r)?r.join(Jt):r;if(!o)return t;const i={};if(0===o.length)return t;return o.split(Jt).forEach((t=>{const e=ee(t);if(e){const t={value:e.value};e.metadata&&(t.metadata=e.metadata),i[e.key]=t}})),0===Object.entries(i).length?t:qt.setBaggage(t,qt.createBaggage(i))}fields(){return[te]}}function re(t){const e={};if("object"!=typeof t||null==t)return e;for(const[n,r]of Object.entries(t))oe(n)?ie(r)?Array.isArray(r)?e[n]=r.slice():e[n]=r:Lt.warn(`Invalid attribute value set for key: ${n}`):Lt.warn(`Invalid attribute key: ${n}`);return e}function oe(t){return"string"==typeof t&&t.length>0}function ie(t){return null==t||(Array.isArray(t)?function(t){let e;for(const n of t)if(null!=n){if(!e){if(se(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}(t):se(t))}function se(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function ae(){return t=>{Lt.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){const e={};let n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach((t=>{if(e[t])return;const r=n[t];r&&(e[t]=String(r))})),n=Object.getPrototypeOf(n);return e}(t))}(t))}}let ue=ae();function ce(t){try{ue(t)}catch{}}function le(t){}const pe="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},de=performance,he="exception.type",fe="exception.message",ge="http.method",me="http.url",_e="http.host",ve="http.scheme",ye="http.status_code",Se="http.user_agent",be="http.request_content_length_uncompressed",Ee="process.runtime.name",Te="telemetry.sdk.name",we="telemetry.sdk.language",Ce="telemetry.sdk.version",Ae="service.name",Oe="telemetry.sdk.language",Re="telemetry.sdk.name",Ne="telemetry.sdk.version",xe={[Te]:"opentelemetry",[Ee]:"browser",[we]:"webjs",[Ce]:"2.0.0"};function Pe(t){}const Le=Math.pow(10,6),De=Math.pow(10,9);function Ie(t){const e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*Le)]}function Me(){let t=de.timeOrigin;if("number"!=typeof t){const e=de;t=e.timing&&e.timing.fetchStart}return t}function ke(t){return Ve(Ie(Me()),Ie("number"==typeof t?t:de.now()))}function je(t){if(Fe(t))return t;if("number"==typeof t)return t<Me()?ke(t):Ie(t);if(t instanceof Date)return Ie(t.getTime());throw TypeError("Invalid input type")}function Ue(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=De),[n,r]}function Be(t){return t[0]*De+t[1]}function Fe(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function He(t){return Fe(t)||"number"==typeof t||t instanceof Date}function Ve(t,e){const n=[t[0]+e[0],t[1]+e[1]];return n[1]>=De&&(n[1]-=De,n[0]+=1),n}var $e;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}($e||($e={}));class ze{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map((t=>"function"==typeof t.fields?t.fields():[])).reduce(((t,e)=>t.concat(e)),[])))}inject(t,e,n){for(const r of this._propagators)try{r.inject(t,e,n)}catch(t){Lt.warn(`Failed to inject with ${r.constructor.name}. Err: ${t.message}`)}}extract(t,e,n){return this._propagators.reduce(((t,r)=>{try{return r.extract(t,e,n)}catch(t){Lt.warn(`Failed to extract with ${r.constructor.name}. Err: ${t.message}`)}return t}),t)}fields(){return this._fields.slice()}}const qe="[_0-9a-z-*/]",Ge=new RegExp(`^(?:${`[a-z]${qe}{0,255}`}|${`[a-z0-9]${qe}{0,240}@[a-z]${qe}{0,13}`})$`),Ke=/^[ -~]{0,255}[!-~]$/,We=/,|=/;class Xe{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return Ge.test(t)})(o)&&function(t){return Ke.test(t)&&!We.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const t=new Xe;return t._internalState=new Map(this._internalState),t}}const Qe="traceparent",Ye="tracestate",Ze=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function Je(t){const e=Ze.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}class tn{inject(t,e,n){const r=Kt.getSpanContext(t);if(!r||Qt(t)||!St(r))return;const o=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||R.NONE).toString(16)}`;n.set(e,Qe,o),r.traceState&&n.set(e,Ye,r.traceState.serialize())}extract(t,e,n){const r=n.get(e,Qe);if(!r)return t;const o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;const i=Je(o);if(!i)return t;i.isRemote=!0;const s=n.get(e,Ye);if(s){const t=Array.isArray(s)?s.join(","):s;i.traceState=new Xe("string"==typeof t?t:void 0)}return Kt.setSpanContext(t,i)}fields(){return[Qe,Ye]}}const en=A("OpenTelemetry SDK Context Key RPC_METADATA");var nn;!function(t){t.HTTP="http"}(nn||(nn={}));const rn="[object Object]",on="[object Null]",sn="[object Undefined]",an=Function.prototype.toString,un=an.call(Object),cn=Object.getPrototypeOf,ln=Object.prototype,pn=ln.hasOwnProperty,dn=Symbol?Symbol.toStringTag:void 0,hn=ln.toString;function fn(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?sn:on;return dn&&dn in Object(t)?function(t){const e=pn.call(t,dn),n=t[dn];let r=!1;try{t[dn]=void 0,r=!0}catch(t){}const o=hn.call(t);r&&(e?t[dn]=n:delete t[dn]);return o}(t):function(t){return hn.call(t)}(t)}(t)!==rn)return!1;const e=cn(t);if(null===e)return!0;const n=pn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&an.call(n)===un}const gn=20;function mn(...t){let e=t.shift();const n=new WeakMap;for(;t.length>0;)e=vn(e,t.shift(),0,n);return e}function _n(t){return Sn(t)?t.slice():t}function vn(t,e,n=0,r){let o;if(!(n>gn)){if(n++,Tn(t)||Tn(e)||bn(e))o=_n(e);else if(Sn(t)){if(o=t.slice(),Sn(e))for(let t=0,n=e.length;t<n;t++)o.push(_n(e[t]));else if(En(e)){const t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){const r=t[n];o[r]=_n(e[r])}}}else if(En(t))if(En(e)){if(!function(t,e){if(!fn(t)||!fn(e))return!1;return!0}(t,e))return e;o=Object.assign({},t);const i=Object.keys(e);for(let s=0,a=i.length;s<a;s++){const a=i[s],u=e[a];if(Tn(u))void 0===u?delete o[a]:o[a]=u;else{const i=o[a],s=u;if(yn(t,a,r)||yn(e,a,r))delete o[a];else{if(En(i)&&En(s)){const n=r.get(i)||[],o=r.get(s)||[];n.push({obj:t,key:a}),o.push({obj:e,key:a}),r.set(i,n),r.set(s,o)}o[a]=vn(o[a],u,n,r)}}}}else o=e;return o}}function yn(t,e,n){const r=n.get(t[e])||[];for(let n=0,o=r.length;n<o;n++){const o=r[n];if(o.key===e&&o.obj===t)return!0}return!1}function Sn(t){return Array.isArray(t)}function bn(t){return"function"==typeof t}function En(t){return!Tn(t)&&!Sn(t)&&!bn(t)&&"object"==typeof t}function Tn(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}class wn extends Error{constructor(t){super(t),Object.setPrototypeOf(this,wn.prototype)}}function Cn(t,e){return"string"==typeof e?t===e:!!t.match(e)}function An(t,e){if(!e)return!1;for(const n of e)if(Cn(t,n))return!0;return!1}class On{_promise;_resolve;_reject;constructor(){this._promise=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}}class Rn{_callback;_that;_isCalled=!1;_deferred=new On;constructor(t,e){this._callback=t,this._that=e}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then((t=>this._deferred.resolve(t)),(t=>this._deferred.reject(t)))}catch(t){this._deferred.reject(t)}}return this._deferred.promise}}const Nn={ALL:d.ALL,VERBOSE:d.VERBOSE,DEBUG:d.DEBUG,INFO:d.INFO,WARN:d.WARN,ERROR:d.ERROR,NONE:d.NONE};const xn={_export:function(t,e){return new Promise((n=>{Pt.with(Xt(Pt.active()),(()=>{t.export(e,(t=>{n(t)}))}))}))}};var Pn=Object.freeze({__proto__:null,AnchoredClock:class{_monotonicClock;_epochMillis;_performanceMillis;constructor(t,e){this._monotonicClock=e,this._epochMillis=t.now(),this._performanceMillis=e.now()}now(){const t=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+t}},BindOnceFuture:Rn,CompositePropagator:ze,get ExportResultCode(){return $e},get RPCType(){return nn},SDK_INFO:xe,TRACE_PARENT_HEADER:Qe,TRACE_STATE_HEADER:Ye,TimeoutError:wn,TraceState:Xe,W3CBaggagePropagator:ne,W3CTraceContextPropagator:tn,_globalThis:pe,addHrTimes:Ve,callWithTimeout:function(t,e){let n;const r=new Promise((function(t,r){n=setTimeout((function(){r(new wn("Operation timed out."))}),e)}));return Promise.race([t,r]).then((t=>(clearTimeout(n),t)),(t=>{throw clearTimeout(n),t}))},deleteRPCMetadata:function(t){return t.deleteValue(en)},diagLogLevelFromString:function(t){if(null==t)return;const e=Nn[t.toUpperCase()];return null==e?(Lt.warn(`Unknown log level "${t}", expected one of ${Object.keys(Nn)}, using default`),d.INFO):e},getBooleanFromEnv:function(t){},getNumberFromEnv:le,getRPCMetadata:function(t){return t.getValue(en)},getStringFromEnv:function(t){},getStringListFromEnv:function(t){},getTimeOrigin:Me,globalErrorHandler:ce,hrTime:ke,hrTimeDuration:Ue,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:Be,hrTimeToTimeStamp:function(t){const e=`${"0".repeat(9)}${t[1]}Z`,n=e.substring(e.length-9-1);return new Date(1e3*t[0]).toISOString().replace("000Z",n)},internal:xn,isAttributeValue:ie,isTimeInput:He,isTimeInputHrTime:Fe,isTracingSuppressed:Qt,isUrlIgnored:An,loggingErrorHandler:ae,merge:mn,millisToHrTime:Ie,otperformance:de,parseKeyPairsIntoRecord:function(t){return"string"!=typeof t||0===t.length?{}:t.split(Jt).map((t=>ee(t))).filter((t=>void 0!==t&&t.value.length>0)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})},parseTraceParent:Je,sanitizeAttributes:re,setGlobalErrorHandler:function(t){ue=t},setRPCMetadata:function(t,e){return t.setValue(en,e)},suppressTracing:Xt,timeInputToHrTime:je,unrefTimer:Pe,unsuppressTracing:function(t){return t.deleteValue(Wt)},urlMatches:Cn});function Ln(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var Dn,In={},Mn={};function kn(){if(Dn)return Mn;function t(t){return Object.keys(t).map((n=>e(n,t[n])))}function e(t,e){return{key:t,value:n(e)}}function n(t){const r=typeof t;return"string"===r?{stringValue:t}:"number"===r?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:"boolean"===r?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(n)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((([t,n])=>e(t,n)))}}:{}}return Dn=1,Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.toAnyValue=Mn.toKeyValue=Mn.toAttributes=Mn.createInstrumentationScope=Mn.createResource=void 0,Mn.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},Mn.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},Mn.toAttributes=t,Mn.toKeyValue=e,Mn.toAnyValue=n,Mn}var jn,Un,Bn,Fn={},Hn=Ln(Pn),Vn={};function $n(){if(jn)return Vn;function t(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}return jn=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.hexToBinary=void 0,Vn.hexToBinary=function(e){const n=new Uint8Array(e.length/2);let r=0;for(let o=0;o<e.length;o+=2){const i=t(e.charCodeAt(o)),s=t(e.charCodeAt(o+1));n[r++]=i<<4|s}return n},Vn}function zn(){if(Un)return Fn;Un=1,Object.defineProperty(Fn,"__esModule",{value:!0}),Fn.getOtlpEncoder=Fn.encodeAsString=Fn.encodeAsLongBits=Fn.toLongBits=Fn.hrTimeToNanos=void 0;const t=Hn,e=$n();function n(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function r(t){return{low:Number(BigInt.asUintN(32,t)),high:Number(BigInt.asUintN(32,t>>BigInt(32)))}}function o(t){return r(n(t))}function i(t){return n(t).toString()}Fn.hrTimeToNanos=n,Fn.toLongBits=r,Fn.encodeAsLongBits=o,Fn.encodeAsString=i;const s="undefined"!=typeof BigInt?i:t.hrTimeToNanoseconds;function a(t){return t}function u(t){if(void 0!==t)return(0,e.hexToBinary)(t)}const c={encodeHrTime:o,encodeSpanContext:e.hexToBinary,encodeOptionalSpanContext:u};return Fn.getOtlpEncoder=function(t){if(void 0===t)return c;const n=t.useLongBits??!0,r=t.useHex??!1;return{encodeHrTime:n?o:s,encodeSpanContext:r?a:e.hexToBinary,encodeOptionalSpanContext:r?a:u}},Fn}function qn(){if(Bn)return In;Bn=1,Object.defineProperty(In,"__esModule",{value:!0}),In.createExportTraceServiceRequest=In.toOtlpSpanEvent=In.toOtlpLink=In.sdkSpanToOtlpSpan=void 0;const t=kn(),e=zn();function n(e,n){const i=e.spanContext(),s=e.status,a=e.parentSpanContext?.spanId?n.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:n.encodeSpanContext(i.traceId),spanId:n.encodeSpanContext(i.spanId),parentSpanId:a,traceState:i.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:n.encodeHrTime(e.startTime),endTimeUnixNano:n.encodeHrTime(e.endTime),attributes:(0,t.toAttributes)(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map((t=>o(t,n))),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map((t=>r(t,n))),droppedLinksCount:e.droppedLinksCount}}function r(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],spanId:n.encodeSpanContext(e.context.spanId),traceId:n.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function o(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],name:e.name,timeUnixNano:n.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function i(e,r){const o=function(t){const e=new Map;for(const n of t){let t=e.get(n.resource);t||(t=new Map,e.set(n.resource,t));const r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return e}(e),i=[],s=o.entries();let a=s.next();for(;!a.done;){const[e,o]=a.value,u=[],c=o.values();let l=c.next();for(;!l.done;){const e=l.value;if(e.length>0){const o=e.map((t=>n(t,r)));u.push({scope:(0,t.createInstrumentationScope)(e[0].instrumentationScope),spans:o,schemaUrl:e[0].instrumentationScope.schemaUrl})}l=c.next()}const p={resource:(0,t.createResource)(e),scopeSpans:u,schemaUrl:void 0};i.push(p),a=s.next()}return i}return In.sdkSpanToOtlpSpan=n,In.toOtlpLink=r,In.toOtlpSpanEvent=o,In.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},In}var Gn,Kn=qn(),Wn={};function Xn(){return Gn||(Gn=1,function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.ESpanKind=void 0,(e=t.ESpanKind||(t.ESpanKind={}))[e.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",e[e.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",e[e.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",e[e.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",e[e.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",e[e.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"}(Wn)),Wn}var Qn=Xn();class Yn{constructor(t){this.config=t}export(t,n){const r=Kn.createExportTraceServiceRequest(t,{useHex:!0,useLongBits:!1});this.config.api.pushTraces(r),function(t=[]){var n,r;for(const o of t){const{scopeSpans:t}=o;for(const o of t){const{scope:t,spans:i=[]}=o;for(const o of i){if(o.kind!==Qn.ESpanKind.SPAN_KIND_CLIENT)continue;const i={traceId:o.traceId.toString(),spanId:o.spanId.toString()},s={};for(const t of o.attributes)s[t.key]=String(Object.values(t.value)[0]);Number.isNaN(o.endTimeUnixNano)||Number.isNaN(o.startTimeUnixNano)||(s.duration_ns=String(Number(o.endTimeUnixNano)-Number(o.startTimeUnixNano)));const a=(null!==(n=null==t?void 0:t.name)&&void 0!==n?n:"").indexOf("-");let u=e.unknownString;(null==t?void 0:t.name)&&(-1===a&&(u=null!==(r=t.name.split("/")[1])&&void 0!==r?r:t.name),a>-1&&(u=null==t?void 0:t.name.substring(a+1))),e.faro.api.pushEvent(`faro.tracing.${u}`,s,void 0,{spanContext:i,timestampOverwriteMs:Number(o.endTimeUnixNano)/1e6,customPayloadTransformer:t=>{var e,n;return null!=s["faro.action.user.name"]&&null!=s["faro.action.user.parentId"]&&(t.action={name:s["faro.action.user.name"],parentId:s["faro.action.user.parentId"]},null===(e=t.attributes)||void 0===e||delete e["faro.action.user.name"],null===(n=t.attributes)||void 0===n||delete n["faro.action.user.parentId"]),t}})}}}}(r.resourceSpans),n({code:$e.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}const Zn="session.id";"function"==typeof SuppressedError&&SuppressedError;class Jn{emit(t){}}const tr=new Jn;const er=new class{getLogger(t,e,n){return new Jn}};class nr{constructor(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;const t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):tr}}class rr{getLogger(t,e,n){var r;return null!==(r=this.getDelegateLogger(t,e,n))&&void 0!==r?r:new nr(this,t,e,n)}getDelegate(){var t;return null!==(t=this._delegate)&&void 0!==t?t:er}setDelegate(t){this._delegate=t}getDelegateLogger(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getLogger(t,e,n)}}const or="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},ir=Symbol.for("io.opentelemetry.js.api.logs"),sr=or;class ar{constructor(){this._proxyLoggerProvider=new rr}static getInstance(){return this._instance||(this._instance=new ar),this._instance}setGlobalLoggerProvider(t){return sr[ir]?this.getLoggerProvider():(sr[ir]=(e=1,n=t,r=er,t=>t===e?n:r),this._proxyLoggerProvider.setDelegate(t),t);var e,n,r}getLoggerProvider(){var t,e;return null!==(e=null===(t=sr[ir])||void 0===t?void 0:t.call(sr,1))&&void 0!==e?e:this._proxyLoggerProvider}getLogger(t,e,n){return this.getLoggerProvider().getLogger(t,e,n)}disable(){delete sr[ir],this._proxyLoggerProvider=new rr}}const ur=ar.getInstance();var cr,lr;var pr=function(){if(lr)return cr;function t(t){return"function"==typeof t}lr=1;var e=console.error.bind(console);function n(t,e,n){var r=!!t[e]&&t.propertyIsEnumerable(e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}function r(n){n&&n.logger&&(t(n.logger)?e=n.logger:e("new logger isn't a function, not replacing"))}function o(r,o,i){if(r&&r[o]){if(!i)return e("no wrapper function"),void e((new Error).stack);if(t(r[o])&&t(i)){var s=r[o],a=i(s,o);return n(a,"__original",s),n(a,"__unwrap",(function(){r[o]===a&&n(r,o,s)})),n(a,"__wrapped",!0),n(r,o,a),a}e("original object and wrapper must be functions")}else e("no original function "+o+" to wrap")}function i(t,n){return t&&t[n]?t[n].__unwrap?t[n].__unwrap():void e("no original to unwrap to -- has "+n+" already been unwrapped?"):(e("no function to unwrap."),void e((new Error).stack))}return r.wrap=o,r.massWrap=function(t,n,r){if(!t)return e("must provide one or more modules to patch"),void e((new Error).stack);Array.isArray(t)||(t=[t]),n&&Array.isArray(n)?t.forEach((function(t){n.forEach((function(e){o(t,e,r)}))})):e("must provide one or more functions to wrap on modules")},r.unwrap=i,r.massUnwrap=function(t,n){if(!t)return e("must provide one or more modules to patch"),void e((new Error).stack);Array.isArray(t)||(t=[t]),n&&Array.isArray(n)?t.forEach((function(t){n.forEach((function(e){i(t,e)}))})):e("must provide one or more functions to unwrap on modules")},cr=r}();class dr{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(t,e,n){this.instrumentationName=t,this.instrumentationVersion=e,this.setConfig(n),this._diag=Lt.createComponentLogger({namespace:t}),this._tracer=Kt.getTracer(t,e),this._meter=Mt.getMeter(t,e),this._logger=ur.getLogger(t,e),this._updateMetricInstruments()}_wrap=pr.wrap;_unwrap=pr.unwrap;_massWrap=pr.massWrap;_massUnwrap=pr.massUnwrap;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,e,n,r){if(t)try{t(n,r)}catch(t){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:e},t)}}}class hr extends dr{constructor(t,e,n){super(t,e,n),this._config.enabled&&this.enable()}}function fr(t,e,n){let r,o;try{o=t()}catch(t){r=t}finally{return e(r,o),o}}function gr(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}const mr=t=>null!==t&&"object"==typeof t&&"function"==typeof t.then;class _r{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(t){const e=new _r({});return e._rawAttributes=t,e._asyncAttributesPending=t.filter((([t,e])=>mr(e))).length>0,e}constructor(t){const e=t.attributes??{};this._rawAttributes=Object.entries(e).map((([t,e])=>(mr(e)&&(this._asyncAttributesPending=!0),[t,e])))}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[e,n]=this._rawAttributes[t];try{this._rawAttributes[t]=[e,mr(n)?await n:n]}catch(n){Lt.debug("a resource's async attributes promise rejected: %s",n),this._rawAttributes[t]=[e,void 0]}}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Lt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[e,n]of this._rawAttributes)mr(n)?Lt.debug(`Unsettled resource attribute ${e} skipped`):null!=n&&(t[e]??=n);return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}merge(t){return null==t?this:_r.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()])}}function vr(t){return _r.FromAttributeList(Object.entries(t))}function yr(){return vr({[Ae]:"unknown_service",[Oe]:xe[Oe],[Re]:xe[Re],[Ne]:xe[Ne]})}class Sr{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:At.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){const e=Date.now();this._spanContext=t.spanContext,this._performanceStartTime=de.now(),this._performanceOffset=e-(this._performanceStartTime+Me()),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,this.links=t.links||[],this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,e){if(null==e||this._isSpanEnded())return this;if(0===t.length)return Lt.warn(`Invalid attribute key: ${t}`),this;if(!ie(e))return Lt.warn(`Invalid attribute value set for key: ${t}`),this;const{attributeCountLimit:n}=this._spanLimits;return void 0!==n&&Object.keys(this.attributes).length>=n&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(e),this)}setAttributes(t){for(const[e,n]of Object.entries(t))this.setAttribute(e,n);return this}addEvent(t,e,n){if(this._isSpanEnded())return this;const{eventCountLimit:r}=this._spanLimits;if(0===r)return Lt.warn("No events allowed."),this._droppedEventsCount++,this;void 0!==r&&this.events.length>=r&&(0===this._droppedEventsCount&&Lt.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),He(e)&&(He(n)||(n=e),e=void 0);const o=re(e);return this.events.push({name:t,attributes:o,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()||(this.status={...t},null!=this.status.message&&"string"!=typeof t.message&&(Lt.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`),delete this.status.message)),this}updateName(t){return this._isSpanEnded()||(this.name=t),this}end(t){this._isSpanEnded()?Lt.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this._ended=!0,this.endTime=this._getTime(t),this._duration=Ue(this.startTime,this.endTime),this._duration[0]<0&&(Lt.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Lt.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this))}_getTime(t){if("number"==typeof t&&t<=de.now())return ke(t+this._performanceOffset);if("number"==typeof t)return Ie(t);if(t instanceof Date)return Ie(t.getTime());if(Fe(t))return t;if(this._startTimeProvided)return Ie(Date.now());const e=de.now()-this._performanceStartTime;return Ve(this.startTime,Ie(e))}isRecording(){return!1===this._ended}recordException(t,e){const n={};"string"==typeof t?n[fe]=t:t&&(t.code?n[he]=t.code.toString():t.name&&(n[he]=t.name),t.message&&(n[fe]=t.message),t.stack&&(n["exception.stacktrace"]=t.stack)),n[he]||n[fe]?this.addEvent("exception",n,e):Lt.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Lt.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,e){return t.length<=e?t:t.substring(0,e)}_truncateToSize(t){const e=this._attributeValueLengthLimit;return e<=0?(Lt.warn(`Attribute value limit must be positive, got ${e}`),t):"string"==typeof t?this._truncateToLimitUtil(t,e):Array.isArray(t)?t.map((t=>"string"==typeof t?this._truncateToLimitUtil(t,e):t)):t}}var br;!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(br||(br={}));class Er{shouldSample(){return{decision:br.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Tr{shouldSample(){return{decision:br.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class wr{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(ce(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Tr),this._remoteParentSampled=t.remoteParentSampled??new Tr,this._remoteParentNotSampled=t.remoteParentNotSampled??new Er,this._localParentSampled=t.localParentSampled??new Tr,this._localParentNotSampled=t.localParentNotSampled??new Er}shouldSample(t,e,n,r,o,i){const s=Kt.getSpanContext(t);return s&&St(s)?s.isRemote?s.traceFlags&R.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):s.traceFlags&R.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,o,i):this._localParentNotSampled.shouldSample(t,e,n,r,o,i):this._root.shouldSample(t,e,n,r,o,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class Cr{_ratio;_upperBound;constructor(t=0){this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(t,e){return{decision:yt(e)&&this._accumulate(e)<this._upperBound?br.RECORD_AND_SAMPLED:br.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return"number"!=typeof t||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let e=0;for(let n=0;n<t.length/8;n++){const r=8*n;e=(e^parseInt(t.slice(r,r+8),16))>>>0}return e}}const Ar=1;function Or(){return{sampler:Rr(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Rr(){const t="parentbased_always_on";switch(t){case"always_on":return new Tr;case"always_off":return new Er;case"parentbased_always_on":return new wr({root:new Tr});case"parentbased_always_off":return new wr({root:new Er});case"traceidratio":return new Cr(Nr());case"parentbased_traceidratio":return new wr({root:new Cr(Nr())});default:return Lt.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "parentbased_always_on".`),new wr({root:new Tr})}}function Nr(){return Lt.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Ar}.`),Ar}const xr=1/0;class Pr{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,e){this._exporter=t,this._maxExportBatchSize="number"==typeof e?.maxExportBatchSize?e.maxExportBatchSize:512,this._maxQueueSize="number"==typeof e?.maxQueueSize?e.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof e?.scheduledDelayMillis?e.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof e?.exportTimeoutMillis?e.exportTimeoutMillis:3e4,this._shutdownOnce=new Rn(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Lt.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,e){}onEnd(t){this._shutdownOnce.isCalled||t.spanContext().traceFlags&R.SAMPLED&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then((()=>this.onShutdown())).then((()=>this._flushAll())).then((()=>this._exporter.shutdown()))}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize)return 0===this._droppedSpansCount&&Lt.debug("maxQueueSize reached, dropping spans"),void this._droppedSpansCount++;this._droppedSpansCount>0&&(Lt.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise(((t,e)=>{const n=[];for(let t=0,e=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);t<e;t++)n.push(this._flushOneBatch());Promise.all(n).then((()=>{t()})).catch(e)}))}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise(((t,e)=>{const n=setTimeout((()=>{e(new Error("Timeout"))}),this._exportTimeoutMillis);Pt.with(Xt(Pt.active()),(()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(r,(r=>{clearTimeout(n),r.code===$e.SUCCESS?t():e(r.error??new Error("BatchSpanProcessor: span export failed"))}));let i=null;for(let t=0,e=r.length;t<e;t++){const e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(i??=[],i.push(e.resource.waitForAsyncAttributes()))}null===i?o():Promise.all(i).then(o,(t=>{ce(t),e(t)}))}))}))}_maybeStartTimer(){if(this._isExporting)return;const t=()=>{this._isExporting=!0,this._flushOneBatch().finally((()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())})).catch((t=>{this._isExporting=!1,ce(t)}))};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();void 0===this._timer&&(this._timer=setTimeout((()=>t()),this._scheduledDelayMillis),this._timer)}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class Lr extends Pr{_visibilityChangeListener;_pageHideListener;constructor(t,e){super(t,e),this.onInit(e)}onInit(t){!0!==t?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch((t=>{ce(t)}))},this._pageHideListener=()=>{this.forceFlush().catch((t=>{ce(t)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}class Dr{generateTraceId=Mr(16);generateSpanId=Mr(8)}const Ir=Array(32);function Mr(t){return function(){for(let e=0;e<2*t;e++)Ir[e]=Math.floor(16*Math.random())+48,Ir[e]>=58&&(Ir[e]+=39);return String.fromCharCode.apply(null,Ir.slice(0,2*t))}}class kr{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(t,e,n,r){const o=function(t){const e={sampler:Rr()},n=Or(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}(e);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=e.idGenerator||new Dr,this._resource=n,this._spanProcessor=r,this.instrumentationScope=t}startSpan(t,e={},n=Pt.active()){e.root&&(n=Kt.deleteSpan(n));const r=Kt.getSpan(n);if(Qt(n)){Lt.debug("Instrumentation suppressed, returning Noop Span");return Kt.wrapSpanContext(ut)}const o=r?.spanContext(),i=this._idGenerator.generateSpanId();let s,a,u;o&&Kt.isSpanContextValid(o)?(a=o.traceId,u=o.traceState,s=o):a=this._idGenerator.generateTraceId();const c=e.kind??Ct.INTERNAL,l=(e.links??[]).map((t=>({context:t.context,attributes:re(t.attributes)}))),p=re(e.attributes),d=this._sampler.shouldSample(n,a,t,c,p,l);u=d.traceState??u;const h={traceId:a,spanId:i,traceFlags:d.decision===wt.RECORD_AND_SAMPLED?R.SAMPLED:R.NONE,traceState:u};if(d.decision===wt.NOT_RECORD){Lt.debug("Recording is off, propagating context in a non-recording span");return Kt.wrapSpanContext(h)}const f=re(Object.assign(p,d.attributes));return new Sr({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:t,kind:c,links:l,parentSpanContext:s,attributes:f,startTime:e.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(t,e,n,r){let o,i,s;if(arguments.length<2)return;2===arguments.length?s=e:3===arguments.length?(o=e,s=n):(o=e,i=n,s=r);const a=i??Pt.active(),u=this.startSpan(t,o,a),c=Kt.setSpan(a,u);return Pt.with(c,s,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class jr{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){const t=[];for(const e of this._spanProcessors)t.push(e.forceFlush());return new Promise((e=>{Promise.all(t).then((()=>{e()})).catch((t=>{ce(t||new Error("MultiSpanProcessor: forceFlush failed")),e()}))}))}onStart(t,e){for(const n of this._spanProcessors)n.onStart(t,e)}onEnd(t){for(const e of this._spanProcessors)e.onEnd(t)}shutdown(){const t=[];for(const e of this._spanProcessors)t.push(e.shutdown());return new Promise(((e,n)=>{Promise.all(t).then((()=>{e()}),n)}))}}var Ur,Br;!function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"}(Ur||(Ur={}));class Fr{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){const e=mn({},Or(),function(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??128,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??xr,Object.assign({},t,{spanLimits:e})}(t));this._resource=e.resource??yr(),this._config=Object.assign({},e,{resource:this._resource});const n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new jr(n)}getTracer(t,e,n){const r=`${t}@${e||""}:${n?.schemaUrl||""}`;return this._tracers.has(r)||this._tracers.set(r,new kr({name:t,version:e,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){const t=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map((e=>new Promise((n=>{let r;const o=setTimeout((()=>{n(new Error(`Span processor did not completed within timeout period of ${t} ms`)),r=Ur.timeout}),t);e.forceFlush().then((()=>{clearTimeout(o),r!==Ur.timeout&&(r=Ur.resolved,n(r))})).catch((t=>{clearTimeout(o),r=Ur.error,n(t)}))}))));return new Promise(((t,n)=>{Promise.all(e).then((e=>{const r=e.filter((t=>t!==Ur.resolved));r.length>0?n(r):t()})).catch((t=>n([t])))}))}shutdown(){return this._activeSpanProcessor.shutdown()}}class Hr{_enabled=!1;_currentContext=x;_bindFunction(t=x,e){const n=this,r=function(...r){return n.with(t,(()=>e.apply(this,r)))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),r}active(){return this._currentContext}bind(t,e){return void 0===t&&(t=this.active()),"function"==typeof e?this._bindFunction(t,e):e}disable(){return this._currentContext=x,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=x),this}with(t,e,n,...r){const o=this._currentContext;this._currentContext=t||x;try{return e.call(n,...r)}finally{this._currentContext=o}}}class Vr extends Fr{constructor(t={}){super(t)}register(t={}){var e;Kt.setGlobalTracerProvider(this),null!==(e=t.propagator)&&(void 0!==e?qt.setGlobalPropagator(e):qt.setGlobalPropagator(new ze({propagators:[new tn,new ne]}))),function(t){if(null!==t){if(void 0===t){const t=new Hr;return t.enable(),void Pt.setGlobalContextManager(t)}t.enable(),Pt.setGlobalContextManager(t)}}(t.contextManager)}}let $r;function zr(t,e,n,r=!0){if(!(o=n,i=e,!(i in o)||"number"!=typeof n[e]||r&&0===n[e]))return t.addEvent(e,n[e]);var o,i}function qr(t,e,n=!1,r){void 0===r&&(r=0!==e[Br.START_TIME]),n||(zr(t,Br.FETCH_START,e,r),zr(t,Br.DOMAIN_LOOKUP_START,e,r),zr(t,Br.DOMAIN_LOOKUP_END,e,r),zr(t,Br.CONNECT_START,e,r),zr(t,Br.SECURE_CONNECTION_START,e,r),zr(t,Br.CONNECT_END,e,r),zr(t,Br.REQUEST_START,e,r),zr(t,Br.RESPONSE_START,e,r),zr(t,Br.RESPONSE_END,e,r));const o=e[Br.ENCODED_BODY_SIZE];void 0!==o&&t.setAttribute("http.response_content_length",o);const i=e[Br.DECODED_BODY_SIZE];void 0!==i&&o!==i&&t.setAttribute("http.response_content_length_uncompressed",i)}function Gr(){return"undefined"!=typeof location?location.origin:void 0}function Kr(t,e,n,r,o=new WeakSet,i){const s=Wr(t),a=function(t,e,n,r,o,i){const s=Be(e),a=Be(n);let u=r.filter((e=>{const n=Be(je(e[Br.FETCH_START])),r=Be(je(e[Br.RESPONSE_END]));return e.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&e.name===t&&n>=s&&r<=a}));u.length>0&&(u=u.filter((t=>!o.has(t))));return u}(t=s.toString(),e,n,r,o,i);if(0===a.length)return{mainRequest:void 0};if(1===a.length)return{mainRequest:a[0]};const u=function(t){return t.slice().sort(((t,e)=>{const n=t[Br.FETCH_START],r=e[Br.FETCH_START];return n>r?1:n<r?-1:0}))}(a);if(s.origin!==Gr()&&u.length>1){let t=u[0],e=function(t,e,n){const r=Be(n),o=Be(je(e));let i,s=t[1];const a=t.length;for(let e=1;e<a;e++){const n=t[e],a=Be(je(n[Br.FETCH_START])),u=r-Be(je(n[Br.RESPONSE_END]));a>=o&&(!i||u<i)&&(i=u,s=n)}return s}(u,t[Br.RESPONSE_END],n);const r=t[Br.RESPONSE_END];return e[Br.FETCH_START]<r&&(e=t,t=void 0),{corsPreFlightRequest:t,mainRequest:e}}return{mainRequest:a[0]}}function Wr(t){if("function"==typeof URL)return new URL(t,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);const e=($r||($r=document.createElement("a")),$r);return e.href=t,e}function Xr(t,e){let n=e||[];("string"==typeof n||n instanceof RegExp)&&(n=[n]);return Wr(t).origin===Gr()||n.some((e=>Cn(t,e)))}var Qr;!function(t){t.CONNECT_END="connectEnd",t.CONNECT_START="connectStart",t.DECODED_BODY_SIZE="decodedBodySize",t.DOM_COMPLETE="domComplete",t.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",t.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",t.DOM_INTERACTIVE="domInteractive",t.DOMAIN_LOOKUP_END="domainLookupEnd",t.DOMAIN_LOOKUP_START="domainLookupStart",t.ENCODED_BODY_SIZE="encodedBodySize",t.FETCH_START="fetchStart",t.LOAD_EVENT_END="loadEventEnd",t.LOAD_EVENT_START="loadEventStart",t.NAVIGATION_START="navigationStart",t.REDIRECT_END="redirectEnd",t.REDIRECT_START="redirectStart",t.REQUEST_START="requestStart",t.RESPONSE_END="responseEnd",t.RESPONSE_START="responseStart",t.SECURE_CONNECTION_START="secureConnectionStart",t.START_TIME="startTime",t.UNLOAD_EVENT_END="unloadEventEnd",t.UNLOAD_EVENT_START="unloadEventStart"}(Br||(Br={})),function(t){t.COMPONENT="component",t.HTTP_ERROR_NAME="http.error_name",t.HTTP_STATUS_TEXT="http.status_text"}(Qr||(Qr={}));const Yr=Lt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Zr(...t){if(t[0]instanceof URL||"string"==typeof t[0]){const e=t[1];if(!e?.body)return Promise.resolve();if(e.body instanceof ReadableStream){const{body:t,length:n}=function(t){if(!t.pipeThrough)return Yr.warn("Platform has ReadableStream but not pipeThrough!"),{body:t,length:Promise.resolve(void 0)};let e,n=0;const r=new Promise((t=>{e=t})),o=new TransformStream({start(){},async transform(t,e){const r=await t;n+=r.byteLength,e.enqueue(t)},flush(){e(n)}});return{body:t.pipeThrough(o),length:r}}(e.body);return e.body=t,n}return Promise.resolve(function(t){if(e=t,"undefined"!=typeof Document&&e instanceof Document)return(new XMLSerializer).serializeToString(document).length;var e;if("string"==typeof t)return to(t);if(t instanceof Blob)return t.size;if(t instanceof FormData)return function(t){let e=0;for(const[n,r]of t.entries())e+=n.length,r instanceof Blob?e+=r.size:e+=r.length;return e}(t);if(t instanceof URLSearchParams)return to(t.toString());if(void 0!==t.byteLength)return t.byteLength;return void Yr.warn("unknown body type")}(e.body))}{const e=t[0];return e?.body?e.clone().text().then((t=>to(t))):Promise.resolve()}}const Jr=new TextEncoder;function to(t){return Jr.encode(t).byteLength}const eo="0.200.0",no="object"==typeof process&&"node"===process.release?.name;class ro extends hr{component="fetch";version=eo;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;constructor(t={}){super("@opentelemetry/instrumentation-fetch",eo,t)}init(){}_addChildSpan(t,e){const n=this.tracer.startSpan("CORS Preflight",{startTime:e[Br.FETCH_START]},Kt.setSpan(Pt.active(),t));qr(n,e,this.getConfig().ignoreNetworkEvents),n.end(e[Br.RESPONSE_END])}_addFinalSpanAttributes(t,e){const n=Wr(e.url);t.setAttribute(ye,e.status),null!=e.statusText&&t.setAttribute(Qr.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(_e,n.host),t.setAttribute(ve,n.protocol.replace(":","")),"undefined"!=typeof navigator&&t.setAttribute(Se,navigator.userAgent)}_addHeaders(t,e){if(!Xr(e,this.getConfig().propagateTraceHeaderCorsUrls)){const t={};return qt.inject(Pt.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(t instanceof Request)qt.inject(Pt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Headers)qt.inject(Pt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Map)qt.inject(Pt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else{const e={};qt.inject(Pt.active(),e),t.headers=Object.assign({},e,t.headers||{})}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,e={}){if(An(t,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const n=(e.method||"GET").toUpperCase(),r=`HTTP ${n}`;return this.tracer.startSpan(r,{kind:Ct.CLIENT,attributes:{[Qr.COMPONENT]:this.moduleName,[ge]:n,[me]:t}})}_findResourceAndAddNetworkEvents(t,e,n){let r=e.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}const o=Kr(e.spanUrl,e.startTime,n,r,this._usedResources,"fetch");if(o.mainRequest){const e=o.mainRequest;this._markResourceAsUsed(e);const n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n)),qr(t,e,this.getConfig().ignoreNetworkEvents)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,e,n){const r=Ie(Date.now()),o=ke();this._addFinalSpanAttributes(t,n),setTimeout((()=>{e.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,e,o),this._tasksCount--,this._clearResources(),t.end(r)}),300)}_patchConstructor(){return t=>{const e=this;return function(...n){const r=this,o=Wr(n[0]instanceof Request?n[0].url:String(n[0])).href,i=n[0]instanceof Request?n[0]:n[1]||{},s=e._createSpan(o,i);if(!s)return t.apply(this,n);const a=e._prepareSpanData(o);function u(t,n){e._applyAttributesAfterFetch(t,i,n),e._endSpan(t,a,{status:n.status||0,statusText:n.message,url:o})}function c(t,n){e._applyAttributesAfterFetch(t,i,n),n.status>=200&&n.status<400?e._endSpan(t,a,n):e._endSpan(t,a,{status:n.status,statusText:n.statusText,url:o})}function l(t,e,n){try{const e=n.clone().body;if(e){const r=e.getReader(),o=()=>{r.read().then((({done:e})=>{e?c(t,n):o()}),(e=>{u(t,e)}))};o()}else c(t,n)}finally{e(n)}}function p(t,e,n){try{u(t,n)}finally{e(n)}}return e.getConfig().measureRequestSize&&Zr(...n).then((t=>{t&&s.setAttribute(be,t)})).catch((t=>{e._diag.warn("getFetchBodyLength",t)})),new Promise(((n,a)=>Pt.with(Kt.setSpan(Pt.active(),s),(()=>(e._addHeaders(i,o),e._callRequestHook(s,i),e._tasksCount++,t.apply(r,i instanceof Request?[i]:[o,i]).then(l.bind(r,s,n),p.bind(r,s,a)))))))}}}_applyAttributesAfterFetch(t,e,n){const r=this.getConfig().applyCustomAttributesOnSpan;r&&fr((()=>r(t,e,n)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}))}_callRequestHook(t,e){const n=this.getConfig().requestHook;n&&fr((()=>n(t,e)),(t=>{t&&this._diag.error("requestHook",t)}))}_prepareSpanData(t){const e=ke(),n=[];if("function"!=typeof PerformanceObserver)return{entries:n,startTime:e,spanUrl:t};const r=new PerformanceObserver((e=>{e.getEntries().forEach((e=>{"fetch"===e.initiatorType&&e.name===t&&n.push(e)}))}));return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:e,spanUrl:t}}enable(){no?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(gr(fetch)&&(this._unwrap(pe,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(pe,"fetch",this._patchConstructor()))}disable(){no||(this._unwrap(pe,"fetch"),this._usedResources=new WeakSet)}}var oo;!function(t){t.METHOD_OPEN="open",t.METHOD_SEND="send",t.EVENT_ABORT="abort",t.EVENT_ERROR="error",t.EVENT_LOAD="loaded",t.EVENT_TIMEOUT="timeout"}(oo||(oo={}));const io=Lt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function so(t){return e=t,"undefined"!=typeof Document&&e instanceof Document?(new XMLSerializer).serializeToString(document).length:"string"==typeof t?uo(t):t instanceof Blob?t.size:t instanceof FormData?function(t){let e=0;for(const[n,r]of t.entries())e+=n.length,r instanceof Blob?e+=r.size:e+=r.length;return e}(t):t instanceof URLSearchParams?uo(t.toString()):void 0!==t.byteLength?t.byteLength:void io.warn("unknown body type");var e}const ao=new TextEncoder;function uo(t){return ao.encode(t).byteLength}const co="0.200.0";var lo;!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(lo||(lo={}));class po extends hr{component="xml-http-request";version=co;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",co,t)}init(){}_addHeaders(t,e){if(!Xr(Wr(e).href,this.getConfig().propagateTraceHeaderCorsUrls)){const t={};return qt.inject(Pt.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const n={};qt.inject(Pt.active(),n),Object.keys(n).forEach((e=>{t.setRequestHeader(e,String(n[e]))}))}_addChildSpan(t,e){Pt.with(Kt.setSpan(Pt.active(),t),(()=>{const t=this.tracer.startSpan("CORS Preflight",{startTime:e[Br.FETCH_START]});qr(t,e,this.getConfig().ignoreNetworkEvents),t.end(e[Br.RESPONSE_END])}))}_addFinalSpanAttributes(t,e,n){if("string"==typeof n){const r=Wr(n);void 0!==e.status&&t.setAttribute(ye,e.status),void 0!==e.statusText&&t.setAttribute(lo.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(_e,r.host),t.setAttribute(ve,r.protocol.replace(":","")),t.setAttribute(Se,navigator.userAgent)}}_applyAttributesAfterXHR(t,e){const n=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof n&&fr((()=>n(t,e)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}))}_addResourceObserver(t,e){const n=this._xhrMem.get(t);n&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver((t=>{const r=t.getEntries(),o=Wr(e);r.forEach((t=>{"xmlhttprequest"===t.initiatorType&&t.name===o.href&&n.createdResources&&n.createdResources.entries.push(t)}))})),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(de.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,e,n,r,o){if(!(n&&r&&o&&t.createdResources))return;let i=t.createdResources.entries;i&&i.length||(i=de.getEntriesByType("resource"));const s=Kr(Wr(n).href,r,o,i,this._usedResources);if(s.mainRequest){const t=s.mainRequest;this._markResourceAsUsed(t);const n=s.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n)),qr(e,t,this.getConfig().ignoreNetworkEvents)}}_cleanPreviousSpanInformation(t){const e=this._xhrMem.get(t);if(e){const n=e.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,e,n){if(An(e,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const r=n.toUpperCase(),o=this.tracer.startSpan(r,{kind:Ct.CLIENT,attributes:{[ge]:n,[me]:Wr(e).toString()}});return o.addEvent(oo.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:o,spanUrl:e}),o}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{const e=this;return function(...n){const r=n[0],o=n[1];return e._createSpan(this,o,r),t.apply(this,n)}}}_patchSend(){const t=this;function e(e,n){const r=t._xhrMem.get(n);if(!r)return;r.status=n.status,r.statusText=n.statusText,t._xhrMem.delete(n),r.span&&t._applyAttributesAfterXHR(r.span,n);const o=ke(),i=Date.now();setTimeout((()=>{!function(e,n,r,o){const i=n.callbackToRemoveEvents;"function"==typeof i&&i();const{span:s,spanUrl:a,sendStartTime:u}=n;s&&(t._findResourceAndAddNetworkEvents(n,s,a,u,r),s.addEvent(e,o),t._addFinalSpanAttributes(s,n,a),s.end(o),t._tasksCount--),t._clearResources()}(e,r,o,i)}),300)}function n(){e(oo.EVENT_ERROR,this)}function r(){e(oo.EVENT_ABORT,this)}function o(){e(oo.EVENT_TIMEOUT,this)}function i(){this.status<299?e(oo.EVENT_LOAD,this):e(oo.EVENT_ERROR,this)}return e=>function(...s){const a=t._xhrMem.get(this);if(!a)return e.apply(this,s);const u=a.span,c=a.spanUrl;if(u&&c){if(t.getConfig().measureRequestSize&&s?.[0]){const t=so(s[0]);void 0!==t&&u.setAttribute(be,t)}Pt.with(Kt.setSpan(Pt.active(),u),(()=>{t._tasksCount++,a.sendStartTime=ke(),u.addEvent(oo.METHOD_SEND),this.addEventListener("abort",r),this.addEventListener("error",n),this.addEventListener("load",i),this.addEventListener("timeout",o),a.callbackToRemoveEvents=()=>{!function(e){e.removeEventListener("abort",r),e.removeEventListener("error",n),e.removeEventListener("load",i),e.removeEventListener("timeout",o);const s=t._xhrMem.get(e);s&&(s.callbackToRemoveEvents=void 0)}(this),a.createdResources&&a.createdResources.observer.disconnect()},t._addHeaders(this,c),t._addResourceObserver(this,c)}))}return e.apply(this,s)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),gr(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),gr(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}}class ho extends po{constructor(t={}){super(t);this.parentCreateSpan=this._createSpan.bind(this)}_patchOpen(){return t=>{const n=this;return function(...r){try{const t=r[0];let o=e.getUrlFromResource(r[1]);n.parentCreateSpan(this,o,t)}catch(t){e.faro.internalLogger.error(t)}return t.apply(this,r)}}}}function fo(t,e,n){go(t,n instanceof Error?0:n.status)}function go(t,e){if(null==e)return;(0===e||e>=400&&e<600)&&t.setStatus({code:At.ERROR})}function mo(t){return(e,n,r)=>{fo(e,0,r),null==t||t(e,n,r)}}function _o(t){return(e,n)=>{!function(t,e){go(t,e.status)}(e,n),null==t||t(e,n)}}function vo(t={}){const{fetchInstrumentationOptions:e,xhrInstrumentationOptions:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["fetchInstrumentationOptions","xhrInstrumentationOptions"]),o=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:mo(null==t?void 0:t.applyCustomAttributesOnSpan)})}(e,r),i=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:_o(null==t?void 0:t.applyCustomAttributesOnSpan)})}(n,r);return[new ro(o),new ho(i)]}class yo{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n;const r=this.metas.value.session;(null==r?void 0:r.id)&&(t.attributes[Zn]=r.id,t.attributes.session_id=r.id);const o=null!==(n=this.metas.value.user)&&void 0!==n?n:{};o.email&&(t.attributes["user.email"]=o.email),o.id&&(t.attributes["user.id"]=o.id),o.username&&(t.attributes["user.name"]=o.username),o.fullName&&(t.attributes["user.full_name"]=o.fullName),o.roles&&(t.attributes["user.roles"]=o.roles.split(",").map((t=>t.trim()))),o.hash&&(t.attributes["user.hash"]=o.hash),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}class So{constructor(t){this.processor=t,e.apiMessageBus.subscribe((t=>{t.type!==e.USER_ACTION_START?[e.USER_ACTION_END,e.USER_ACTION_CANCEL].includes(t.type)&&(this.message=void 0):this.message=t}))}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n,r;t.kind===Ct.CLIENT&&this.message&&(t.attributes["faro.action.user.name"]=null===(n=this.message)||void 0===n?void 0:n.name,t.attributes["faro.action.user.parentId"]=null===(r=this.message)||void 0===r?void 0:r.parentId),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}function bo(t={}){var e;return"true"===(null===(e=t.attributes)||void 0===e?void 0:e.isSampled)?br.RECORD_AND_SAMPLED:br.NOT_RECORD}class Eo extends e.BaseInstrumentation{constructor(t={}){super(),this.options=t,this.name="@grafana/faro-web-tracing",this.version=e.VERSION}initialize(){var t,e,n,r;const o=this.options,i={};this.config.app.name&&(i[Ae]=this.config.app.name),this.config.app.namespace&&(i["service.namespace"]=this.config.app.namespace),this.config.app.version&&(i["service.version"]=this.config.app.version),this.config.app.environment&&(i["deployment.environment.name"]=this.config.app.environment,i["deployment.environment"]=this.config.app.environment),Object.assign(i,o.resourceAttributes);const s=yr().merge(vr(i));new Vr({resource:s,sampler:{shouldSample:()=>({decision:bo(this.api.getSession())})},spanProcessors:[null!==(t=o.spanProcessor)&&void 0!==t?t:new So(new yo(new Lr(new Yn({api:this.api}),{scheduledDelayMillis:Eo.SCHEDULED_BATCH_DELAY_MS,maxExportBatchSize:30}),this.metas))]}).register({propagator:null!==(e=o.propagator)&&void 0!==e?e:new tn,contextManager:o.contextManager});const{propagateTraceHeaderCorsUrls:a,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c}=null!==(n=this.options.instrumentationOptions)&&void 0!==n?n:{};!function(t){const e=t.tracerProvider||Kt.getTracerProvider(),n=t.meterProvider||Mt.getMeterProvider(),r=t.loggerProvider||ur.getLoggerProvider(),o=t.instrumentations?.flat()??[];(function(t,e,n,r){for(let o=0,i=t.length;o<i;o++){const i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}})(o,e,n,r)}({instrumentations:null!==(r=o.instrumentations)&&void 0!==r?r:vo({ignoreUrls:this.getIgnoreUrls(),propagateTraceHeaderCorsUrls:a,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c})}),this.api.initOTEL(Kt,Pt)}getIgnoreUrls(){return this.transports.transports.flatMap((t=>t.getIgnoreUrls()))}}return Eo.SCHEDULED_BATCH_DELAY_MS=1e3,t.FaroSessionSpanProcessor=class{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){const n=this.metas.value.session;(null==n?void 0:n.id)&&(t.attributes[Zn]=n.id,t.attributes.session_id=n.id),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}},t.FaroTraceExporter=Yn,t.TracingInstrumentation=Eo,t.fetchCustomAttributeFunctionWithDefaults=mo,t.getDefaultOTELInstrumentations=vo,t.getSamplingDecision=bo,t.setSpanStatusOnFetchError=fo,t}({},GrafanaFaroWebSdk);
1
+ var GrafanaFaroWebTracing=function(t,e){"use strict";var n="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},r="1.9.0",o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var i=function(t){var e=new Set([t]),n=new Set,r=t.match(o);if(!r)return function(){return!1};var i=+r[1],s=+r[2],a=+r[3];if(null!=r[4])return function(e){return e===t};function u(t){return n.add(t),!1}function c(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(n.has(t))return!1;var r=t.match(o);if(!r)return u(t);var l=+r[1],p=+r[2],d=+r[3];return null!=r[4]||i!==l?u(t):0===i?s===p&&a<=d?c(t):u(t):s<=p?c(t):u(t)}}(r),s=r.split(".")[0],a=Symbol.for("opentelemetry.js.api."+s),u=n;function c(t,e,n,o){var i;void 0===o&&(o=!1);var s=u[a]=null!==(i=u[a])&&void 0!==i?i:{version:r};if(!o&&s[t]){var c=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(c.stack||c.message),!1}if(s.version!==r){c=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+t+" does not match previously registered API v"+r);return n.error(c.stack||c.message),!1}return s[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+r+"."),!0}function l(t){var e,n,r=null===(e=u[a])||void 0===e?void 0:e.version;if(r&&i(r))return null===(n=u[a])||void 0===n?void 0:n[t]}function p(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+r+".");var n=u[a];n&&delete n[t]}var d,h=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},f=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},_=function(){function t(t){this._namespace=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("verbose",this._namespace,t)},t}();function g(t,e,n){var r=l("diag");if(r)return n.unshift(e),r[t].apply(r,f([],h(n),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(d||(d={}));var m=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},S=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},v=function(){function t(){function t(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=l("diag");if(r)return r[t].apply(r,S([],m(e),!1))}}var e=this;e.setLogger=function(t,n){var r,o,i;if(void 0===n&&(n={logLevel:d.INFO}),t===e){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof n&&(n={logLevel:n});var a=l("diag"),u=function(t,e){function n(n,r){var o=e[n];return"function"==typeof o&&t>=r?o.bind(e):function(){}}return t<d.NONE?t=d.NONE:t>d.ALL&&(t=d.ALL),e=e||{},{error:n("error",d.ERROR),warn:n("warn",d.WARN),info:n("info",d.INFO),debug:n("debug",d.DEBUG),verbose:n("verbose",d.VERBOSE)}}(null!==(o=n.logLevel)&&void 0!==o?o:d.INFO,t);if(a&&!n.suppressOverrideMessage){var p=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";a.warn("Current logger will be overwritten from "+p),u.warn("Current logger will overwrite one already registered from "+p)}return c("diag",u,e,!0)},e.disable=function(){p("diag",e)},e.createComponentLogger=function(t){return new _(t)},e.verbose=t("verbose"),e.debug=t("debug"),e.info=t("info"),e.warn=t("warn"),e.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),T=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},y=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},b=function(){function t(t){this._entries=t?new Map(t):new Map}return t.prototype.getEntry=function(t){var e=this._entries.get(t);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map((function(t){var e=T(t,2);return[e[0],e[1]]}))},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=new t(this._entries);try{for(var s=y(r),a=s.next();!a.done;a=s.next()){var u=a.value;i._entries.delete(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t}(),E=Symbol("BaggageEntryMetadata"),A=v.instance();function O(t){return void 0===t&&(t={}),new b(new Map(Object.entries(t)))}function C(t){return Symbol.for(t)}var w,R,N=function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(t){return n._currentContext.get(t)},n.setValue=function(e,r){var o=new t(n._currentContext);return o._currentContext.set(e,r),o},n.deleteValue=function(e){var r=new t(n._currentContext);return r._currentContext.delete(e),r}},P=new N,L=(w=function(t,e){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},w(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),x=function(){function t(){}return t.prototype.createGauge=function(t,e){return z},t.prototype.createHistogram=function(t,e){return q},t.prototype.createCounter=function(t,e){return $},t.prototype.createUpDownCounter=function(t,e){return G},t.prototype.createObservableGauge=function(t,e){return W},t.prototype.createObservableCounter=function(t,e){return K},t.prototype.createObservableUpDownCounter=function(t,e){return Q},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),D=function(){},I=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.add=function(t,e){},e}(D),M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.add=function(t,e){},e}(D),k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.record=function(t,e){},e}(D),U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.record=function(t,e){},e}(D),j=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.removeCallback=function(t){},t}(),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e}(j),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e}(j),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e}(j),V=new x,$=new I,z=new k,q=new U,G=new M,K=new H,W=new B,Q=new F,X={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Y={set:function(t,e,n){null!=t&&(t[e]=n)}},Z=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},J=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},tt=function(){function t(){}return t.prototype.active=function(){return P},t.prototype.with=function(t,e,n){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return e.call.apply(e,J([n],Z(r),!1))},t.prototype.bind=function(t,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},nt=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},rt="context",ot=new tt,it=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return c(rt,t,v.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(t,e,n){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,nt([t,e,n],et(o),!1))},t.prototype.bind=function(t,e){return this._getContextManager().bind(t,e)},t.prototype._getContextManager=function(){return l(rt)||ot},t.prototype.disable=function(){this._getContextManager().disable(),p(rt,v.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(R||(R={}));var st="0000000000000000",at="00000000000000000000000000000000",ut={traceId:at,spanId:st,traceFlags:R.NONE},ct=function(){function t(t){void 0===t&&(t=ut),this._spanContext=t}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(t,e){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,e){return this},t.prototype.addLink=function(t){return this},t.prototype.addLinks=function(t){return this},t.prototype.setStatus=function(t){return this},t.prototype.updateName=function(t){return this},t.prototype.end=function(t){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(t,e){},t}(),lt=C("OpenTelemetry Context Key SPAN");function pt(t){return t.getValue(lt)||void 0}function dt(){return pt(it.getInstance().active())}function ht(t,e){return t.setValue(lt,e)}function ft(t){return t.deleteValue(lt)}function _t(t,e){return ht(t,new ct(e))}function gt(t){var e;return null===(e=pt(t))||void 0===e?void 0:e.spanContext()}var mt=/^([0-9a-f]{32})$/i,St=/^[0-9a-f]{16}$/i;function vt(t){return mt.test(t)&&t!==at}function Tt(t){return vt(t.traceId)&&(e=t.spanId,St.test(e)&&e!==st);var e}function yt(t){return new ct(t)}var bt=it.getInstance(),Et=function(){function t(){}return t.prototype.startSpan=function(t,e,n){if(void 0===n&&(n=bt.active()),Boolean(null==e?void 0:e.root))return new ct;var r,o=n&&gt(n);return"object"==typeof(r=o)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&Tt(o)?new ct(o):new ct},t.prototype.startActiveSpan=function(t,e,n,r){var o,i,s;if(!(arguments.length<2)){2===arguments.length?s=e:3===arguments.length?(o=e,s=n):(o=e,i=n,s=r);var a=null!=i?i:bt.active(),u=this.startSpan(t,o,a),c=ht(a,u);return bt.with(c,s,void 0,u)}},t}();var At,Ot,Ct,wt=new Et,Rt=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.startSpan=function(t,e,n){return this._getTracer().startSpan(t,e,n)},t.prototype.startActiveSpan=function(t,e,n,r){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):wt},t}(),Nt=new(function(){function t(){}return t.prototype.getTracer=function(t,e,n){return new Et},t}()),Pt=function(){function t(){}return t.prototype.getTracer=function(t,e,n){var r;return null!==(r=this.getDelegateTracer(t,e,n))&&void 0!==r?r:new Rt(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Nt},t.prototype.setDelegate=function(t){this._delegate=t},t.prototype.getDelegateTracer=function(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(t,e,n)},t}();!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(At||(At={})),function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"}(Ot||(Ot={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(Ct||(Ct={}));var Lt=it.getInstance(),xt=v.instance(),Dt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return V},t}()),It="metrics",Mt=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return c(It,t,v.instance())},t.prototype.getMeterProvider=function(){return l(It)||Dt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){p(It,v.instance())},t}().getInstance(),kt=function(){function t(){}return t.prototype.inject=function(t,e){},t.prototype.extract=function(t,e){return t},t.prototype.fields=function(){return[]},t}(),Ut=C("OpenTelemetry Baggage Key");function jt(t){return t.getValue(Ut)||void 0}function Ht(){return jt(it.getInstance().active())}function Bt(t,e){return t.setValue(Ut,e)}function Ft(t){return t.deleteValue(Ut)}var Vt="propagation",$t=new kt,zt=function(){function t(){this.createBaggage=O,this.getBaggage=jt,this.getActiveBaggage=Ht,this.setBaggage=Bt,this.deleteBaggage=Ft}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Vt,t,v.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Y),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=X),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){p(Vt,v.instance())},t.prototype._getGlobalPropagator=function(){return l(Vt)||$t},t}(),qt=zt.getInstance(),Gt="trace",Kt=function(){function t(){this._proxyTracerProvider=new Pt,this.wrapSpanContext=yt,this.isSpanContextValid=Tt,this.deleteSpan=ft,this.getSpan=pt,this.getActiveSpan=dt,this.getSpanContext=gt,this.setSpan=ht,this.setSpanContext=_t}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var e=c(Gt,this._proxyTracerProvider,v.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return l(Gt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){p(Gt,v.instance()),this._proxyTracerProvider=new Pt},t}().getInstance();const Wt=C("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Qt(t){return t.setValue(Wt,!0)}function Xt(t){return!0===t.getValue(Wt)}const Yt="=",Zt=";",Jt=",",te="baggage";function ee(t){const e=t.split(Zt);if(e.length<=0)return;const n=e.shift();if(!n)return;const r=n.indexOf(Yt);if(r<=0)return;const o=decodeURIComponent(n.substring(0,r).trim()),i=decodeURIComponent(n.substring(r+1).trim());let s;var a;return e.length>0&&("string"!=typeof(a=e.join(Zt))&&(A.error("Cannot create baggage metadata from unknown type: "+typeof a),a=""),s={__TYPE__:E,toString:function(){return a}}),{key:o,value:i,metadata:s}}class ne{inject(t,e,n){const r=qt.getBaggage(t);if(!r||Xt(t))return;const o=function(t){return t.getAllEntries().map((([t,e])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(e.value)}`;return void 0!==e.metadata&&(n+=Zt+e.metadata.toString()),n}))}(r).filter((t=>t.length<=4096)).slice(0,180),i=function(t){return t.reduce(((t,e)=>{const n=`${t}${""!==t?Jt:""}${e}`;return n.length>8192?t:n}),"")}(o);i.length>0&&n.set(e,te,i)}extract(t,e,n){const r=n.get(e,te),o=Array.isArray(r)?r.join(Jt):r;if(!o)return t;const i={};if(0===o.length)return t;return o.split(Jt).forEach((t=>{const e=ee(t);if(e){const t={value:e.value};e.metadata&&(t.metadata=e.metadata),i[e.key]=t}})),0===Object.entries(i).length?t:qt.setBaggage(t,qt.createBaggage(i))}fields(){return[te]}}function re(t){const e={};if("object"!=typeof t||null==t)return e;for(const[n,r]of Object.entries(t))oe(n)?ie(r)?Array.isArray(r)?e[n]=r.slice():e[n]=r:xt.warn(`Invalid attribute value set for key: ${n}`):xt.warn(`Invalid attribute key: ${n}`);return e}function oe(t){return"string"==typeof t&&t.length>0}function ie(t){return null==t||(Array.isArray(t)?function(t){let e;for(const n of t)if(null!=n){if(!e){if(se(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}(t):se(t))}function se(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function ae(){return t=>{xt.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){const e={};let n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach((t=>{if(e[t])return;const r=n[t];r&&(e[t]=String(r))})),n=Object.getPrototypeOf(n);return e}(t))}(t))}}let ue=ae();function ce(t){try{ue(t)}catch{}}function le(t){}const pe="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},de=performance,he="error.type",fe="exception.message",_e="exception.type",ge="http.request.method",me="http.request.method_original",Se="http.response.status_code",ve="server.address",Te="server.port",ye="service.name",be="telemetry.sdk.language",Ee="telemetry.sdk.name",Ae="telemetry.sdk.version",Oe="url.full",Ce="process.runtime.name",we={[Ee]:"opentelemetry",[Ce]:"browser",[be]:"webjs",[Ae]:"2.0.1"};function Re(t){}const Ne=Math.pow(10,6),Pe=Math.pow(10,9);function Le(t){const e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*Ne)]}function xe(){let t=de.timeOrigin;if("number"!=typeof t){const e=de;t=e.timing&&e.timing.fetchStart}return t}function De(t){return He(Le(xe()),Le("number"==typeof t?t:de.now()))}function Ie(t){if(Ue(t))return t;if("number"==typeof t)return t<xe()?De(t):Le(t);if(t instanceof Date)return Le(t.getTime());throw TypeError("Invalid input type")}function Me(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=Pe),[n,r]}function ke(t){return t[0]*Pe+t[1]}function Ue(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function je(t){return Ue(t)||"number"==typeof t||t instanceof Date}function He(t,e){const n=[t[0]+e[0],t[1]+e[1]];return n[1]>=Pe&&(n[1]-=Pe,n[0]+=1),n}var Be;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(Be||(Be={}));class Fe{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map((t=>"function"==typeof t.fields?t.fields():[])).reduce(((t,e)=>t.concat(e)),[])))}inject(t,e,n){for(const r of this._propagators)try{r.inject(t,e,n)}catch(t){xt.warn(`Failed to inject with ${r.constructor.name}. Err: ${t.message}`)}}extract(t,e,n){return this._propagators.reduce(((t,r)=>{try{return r.extract(t,e,n)}catch(t){xt.warn(`Failed to extract with ${r.constructor.name}. Err: ${t.message}`)}return t}),t)}fields(){return this._fields.slice()}}const Ve="[_0-9a-z-*/]",$e=new RegExp(`^(?:${`[a-z]${Ve}{0,255}`}|${`[a-z0-9]${Ve}{0,240}@[a-z]${Ve}{0,13}`})$`),ze=/^[ -~]{0,255}[!-~]$/,qe=/,|=/;class Ge{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return $e.test(t)})(o)&&function(t){return ze.test(t)&&!qe.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const t=new Ge;return t._internalState=new Map(this._internalState),t}}const Ke="traceparent",We="tracestate",Qe=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function Xe(t){const e=Qe.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}class Ye{inject(t,e,n){const r=Kt.getSpanContext(t);if(!r||Xt(t)||!Tt(r))return;const o=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||R.NONE).toString(16)}`;n.set(e,Ke,o),r.traceState&&n.set(e,We,r.traceState.serialize())}extract(t,e,n){const r=n.get(e,Ke);if(!r)return t;const o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;const i=Xe(o);if(!i)return t;i.isRemote=!0;const s=n.get(e,We);if(s){const t=Array.isArray(s)?s.join(","):s;i.traceState=new Ge("string"==typeof t?t:void 0)}return Kt.setSpanContext(t,i)}fields(){return[Ke,We]}}const Ze=C("OpenTelemetry SDK Context Key RPC_METADATA");var Je;!function(t){t.HTTP="http"}(Je||(Je={}));const tn="[object Object]",en="[object Null]",nn="[object Undefined]",rn=Function.prototype.toString,on=rn.call(Object),sn=Object.getPrototypeOf,an=Object.prototype,un=an.hasOwnProperty,cn=Symbol?Symbol.toStringTag:void 0,ln=an.toString;function pn(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?nn:en;return cn&&cn in Object(t)?function(t){const e=un.call(t,cn),n=t[cn];let r=!1;try{t[cn]=void 0,r=!0}catch(t){}const o=ln.call(t);r&&(e?t[cn]=n:delete t[cn]);return o}(t):function(t){return ln.call(t)}(t)}(t)!==tn)return!1;const e=sn(t);if(null===e)return!0;const n=un.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&rn.call(n)===on}const dn=20;function hn(...t){let e=t.shift();const n=new WeakMap;for(;t.length>0;)e=_n(e,t.shift(),0,n);return e}function fn(t){return mn(t)?t.slice():t}function _n(t,e,n=0,r){let o;if(!(n>dn)){if(n++,Tn(t)||Tn(e)||Sn(e))o=fn(e);else if(mn(t)){if(o=t.slice(),mn(e))for(let t=0,n=e.length;t<n;t++)o.push(fn(e[t]));else if(vn(e)){const t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){const r=t[n];o[r]=fn(e[r])}}}else if(vn(t))if(vn(e)){if(!function(t,e){if(!pn(t)||!pn(e))return!1;return!0}(t,e))return e;o=Object.assign({},t);const i=Object.keys(e);for(let s=0,a=i.length;s<a;s++){const a=i[s],u=e[a];if(Tn(u))void 0===u?delete o[a]:o[a]=u;else{const i=o[a],s=u;if(gn(t,a,r)||gn(e,a,r))delete o[a];else{if(vn(i)&&vn(s)){const n=r.get(i)||[],o=r.get(s)||[];n.push({obj:t,key:a}),o.push({obj:e,key:a}),r.set(i,n),r.set(s,o)}o[a]=_n(o[a],u,n,r)}}}}else o=e;return o}}function gn(t,e,n){const r=n.get(t[e])||[];for(let n=0,o=r.length;n<o;n++){const o=r[n];if(o.key===e&&o.obj===t)return!0}return!1}function mn(t){return Array.isArray(t)}function Sn(t){return"function"==typeof t}function vn(t){return!Tn(t)&&!mn(t)&&!Sn(t)&&"object"==typeof t}function Tn(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}class yn extends Error{constructor(t){super(t),Object.setPrototypeOf(this,yn.prototype)}}function bn(t,e){return"string"==typeof e?t===e:!!t.match(e)}function En(t,e){if(!e)return!1;for(const n of e)if(bn(t,n))return!0;return!1}class An{_promise;_resolve;_reject;constructor(){this._promise=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}}class On{_callback;_that;_isCalled=!1;_deferred=new An;constructor(t,e){this._callback=t,this._that=e}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then((t=>this._deferred.resolve(t)),(t=>this._deferred.reject(t)))}catch(t){this._deferred.reject(t)}}return this._deferred.promise}}const Cn={ALL:d.ALL,VERBOSE:d.VERBOSE,DEBUG:d.DEBUG,INFO:d.INFO,WARN:d.WARN,ERROR:d.ERROR,NONE:d.NONE};const wn={_export:function(t,e){return new Promise((n=>{Lt.with(Qt(Lt.active()),(()=>{t.export(e,(t=>{n(t)}))}))}))}};var Rn=Object.freeze({__proto__:null,AnchoredClock:class{_monotonicClock;_epochMillis;_performanceMillis;constructor(t,e){this._monotonicClock=e,this._epochMillis=t.now(),this._performanceMillis=e.now()}now(){const t=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+t}},BindOnceFuture:On,CompositePropagator:Fe,get ExportResultCode(){return Be},get RPCType(){return Je},SDK_INFO:we,TRACE_PARENT_HEADER:Ke,TRACE_STATE_HEADER:We,TimeoutError:yn,TraceState:Ge,W3CBaggagePropagator:ne,W3CTraceContextPropagator:Ye,_globalThis:pe,addHrTimes:He,callWithTimeout:function(t,e){let n;const r=new Promise((function(t,r){n=setTimeout((function(){r(new yn("Operation timed out."))}),e)}));return Promise.race([t,r]).then((t=>(clearTimeout(n),t)),(t=>{throw clearTimeout(n),t}))},deleteRPCMetadata:function(t){return t.deleteValue(Ze)},diagLogLevelFromString:function(t){if(null==t)return;const e=Cn[t.toUpperCase()];return null==e?(xt.warn(`Unknown log level "${t}", expected one of ${Object.keys(Cn)}, using default`),d.INFO):e},getBooleanFromEnv:function(t){},getNumberFromEnv:le,getRPCMetadata:function(t){return t.getValue(Ze)},getStringFromEnv:function(t){},getStringListFromEnv:function(t){},getTimeOrigin:xe,globalErrorHandler:ce,hrTime:De,hrTimeDuration:Me,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:ke,hrTimeToTimeStamp:function(t){const e=`${"0".repeat(9)}${t[1]}Z`,n=e.substring(e.length-9-1);return new Date(1e3*t[0]).toISOString().replace("000Z",n)},internal:wn,isAttributeValue:ie,isTimeInput:je,isTimeInputHrTime:Ue,isTracingSuppressed:Xt,isUrlIgnored:En,loggingErrorHandler:ae,merge:hn,millisToHrTime:Le,otperformance:de,parseKeyPairsIntoRecord:function(t){const e={};return"string"==typeof t&&t.length>0&&t.split(Jt).forEach((t=>{const n=ee(t);void 0!==n&&n.value.length>0&&(e[n.key]=n.value)})),e},parseTraceParent:Xe,sanitizeAttributes:re,setGlobalErrorHandler:function(t){ue=t},setRPCMetadata:function(t,e){return t.setValue(Ze,e)},suppressTracing:Qt,timeInputToHrTime:Ie,unrefTimer:Re,unsuppressTracing:function(t){return t.deleteValue(Wt)},urlMatches:bn});function Nn(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var n=function t(){var n=!1;try{n=this instanceof t}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var Pn,Ln={},xn={};function Dn(){if(Pn)return xn;function t(t){return Object.keys(t).map((n=>e(n,t[n])))}function e(t,e){return{key:t,value:n(e)}}function n(t){const r=typeof t;return"string"===r?{stringValue:t}:"number"===r?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:"boolean"===r?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(n)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((([t,n])=>e(t,n)))}}:{}}return Pn=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.toAnyValue=xn.toKeyValue=xn.toAttributes=xn.createInstrumentationScope=xn.createResource=void 0,xn.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},xn.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},xn.toAttributes=t,xn.toKeyValue=e,xn.toAnyValue=n,xn}var In,Mn,kn,Un={},jn=Nn(Rn),Hn={};function Bn(){if(In)return Hn;function t(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}return In=1,Object.defineProperty(Hn,"__esModule",{value:!0}),Hn.hexToBinary=void 0,Hn.hexToBinary=function(e){const n=new Uint8Array(e.length/2);let r=0;for(let o=0;o<e.length;o+=2){const i=t(e.charCodeAt(o)),s=t(e.charCodeAt(o+1));n[r++]=i<<4|s}return n},Hn}function Fn(){if(Mn)return Un;Mn=1,Object.defineProperty(Un,"__esModule",{value:!0}),Un.getOtlpEncoder=Un.encodeAsString=Un.encodeAsLongBits=Un.toLongBits=Un.hrTimeToNanos=void 0;const t=jn,e=Bn();function n(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function r(t){return{low:Number(BigInt.asUintN(32,t)),high:Number(BigInt.asUintN(32,t>>BigInt(32)))}}function o(t){return r(n(t))}function i(t){return n(t).toString()}Un.hrTimeToNanos=n,Un.toLongBits=r,Un.encodeAsLongBits=o,Un.encodeAsString=i;const s="undefined"!=typeof BigInt?i:t.hrTimeToNanoseconds;function a(t){return t}function u(t){if(void 0!==t)return(0,e.hexToBinary)(t)}const c={encodeHrTime:o,encodeSpanContext:e.hexToBinary,encodeOptionalSpanContext:u};return Un.getOtlpEncoder=function(t){if(void 0===t)return c;const n=t.useLongBits??!0,r=t.useHex??!1;return{encodeHrTime:n?o:s,encodeSpanContext:r?a:e.hexToBinary,encodeOptionalSpanContext:r?a:u}},Un}function Vn(){if(kn)return Ln;kn=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.createExportTraceServiceRequest=Ln.toOtlpSpanEvent=Ln.toOtlpLink=Ln.sdkSpanToOtlpSpan=void 0;const t=Dn(),e=Fn();function n(e,n){const i=e.spanContext(),s=e.status,a=e.parentSpanContext?.spanId?n.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:n.encodeSpanContext(i.traceId),spanId:n.encodeSpanContext(i.spanId),parentSpanId:a,traceState:i.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:n.encodeHrTime(e.startTime),endTimeUnixNano:n.encodeHrTime(e.endTime),attributes:(0,t.toAttributes)(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map((t=>o(t,n))),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map((t=>r(t,n))),droppedLinksCount:e.droppedLinksCount}}function r(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],spanId:n.encodeSpanContext(e.context.spanId),traceId:n.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function o(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],name:e.name,timeUnixNano:n.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function i(e,r){const o=function(t){const e=new Map;for(const n of t){let t=e.get(n.resource);t||(t=new Map,e.set(n.resource,t));const r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return e}(e),i=[],s=o.entries();let a=s.next();for(;!a.done;){const[e,o]=a.value,u=[],c=o.values();let l=c.next();for(;!l.done;){const e=l.value;if(e.length>0){const o=e.map((t=>n(t,r)));u.push({scope:(0,t.createInstrumentationScope)(e[0].instrumentationScope),spans:o,schemaUrl:e[0].instrumentationScope.schemaUrl})}l=c.next()}const p={resource:(0,t.createResource)(e),scopeSpans:u,schemaUrl:void 0};i.push(p),a=s.next()}return i}return Ln.sdkSpanToOtlpSpan=n,Ln.toOtlpLink=r,Ln.toOtlpSpanEvent=o,Ln.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},Ln}var $n,zn=Vn(),qn={};function Gn(){return $n||($n=1,function(t){var e,n;Object.defineProperty(t,"__esModule",{value:!0}),t.EStatusCode=t.ESpanKind=void 0,(e=t.ESpanKind||(t.ESpanKind={}))[e.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",e[e.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",e[e.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",e[e.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",e[e.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",e[e.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER",(n=t.EStatusCode||(t.EStatusCode={}))[n.STATUS_CODE_UNSET=0]="STATUS_CODE_UNSET",n[n.STATUS_CODE_OK=1]="STATUS_CODE_OK",n[n.STATUS_CODE_ERROR=2]="STATUS_CODE_ERROR"}(qn)),qn}var Kn=Gn();class Wn{constructor(t){this.config=t}export(t,n){const r=zn.createExportTraceServiceRequest(t,{useHex:!0,useLongBits:!1});this.config.api.pushTraces(r),function(t=[]){var n,r;for(const o of t){const{scopeSpans:t}=o;for(const o of t){const{scope:t,spans:i=[]}=o;for(const o of i){if(o.kind!==Kn.ESpanKind.SPAN_KIND_CLIENT)continue;const i={traceId:o.traceId.toString(),spanId:o.spanId.toString()},s={};for(const t of o.attributes)s[t.key]=String(Object.values(t.value)[0]);Number.isNaN(o.endTimeUnixNano)||Number.isNaN(o.startTimeUnixNano)||(s.duration_ns=String(Number(o.endTimeUnixNano)-Number(o.startTimeUnixNano)));const a=(null!==(n=null==t?void 0:t.name)&&void 0!==n?n:"").indexOf("-");let u=e.unknownString;(null==t?void 0:t.name)&&(-1===a&&(u=null!==(r=t.name.split("/")[1])&&void 0!==r?r:t.name),a>-1&&(u=null==t?void 0:t.name.substring(a+1))),e.faro.api.pushEvent(`faro.tracing.${u}`,s,void 0,{spanContext:i,timestampOverwriteMs:Number(o.endTimeUnixNano)/1e6,customPayloadTransformer:t=>{var e,n;return null!=s["faro.action.user.name"]&&null!=s["faro.action.user.parentId"]&&(t.action={name:s["faro.action.user.name"],parentId:s["faro.action.user.parentId"]},null===(e=t.attributes)||void 0===e||delete e["faro.action.user.name"],null===(n=t.attributes)||void 0===n||delete n["faro.action.user.parentId"]),t}})}}}}(r.resourceSpans),n({code:Be.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}const Qn="session.id";"function"==typeof SuppressedError&&SuppressedError;class Xn{emit(t){}}const Yn=new Xn;const Zn=new class{getLogger(t,e,n){return new Xn}};class Jn{constructor(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;const t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Yn}}class tr{getLogger(t,e,n){var r;return null!==(r=this.getDelegateLogger(t,e,n))&&void 0!==r?r:new Jn(this,t,e,n)}getDelegate(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Zn}setDelegate(t){this._delegate=t}getDelegateLogger(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getLogger(t,e,n)}}const er="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},nr=Symbol.for("io.opentelemetry.js.api.logs"),rr=er;class or{constructor(){this._proxyLoggerProvider=new tr}static getInstance(){return this._instance||(this._instance=new or),this._instance}setGlobalLoggerProvider(t){return rr[nr]?this.getLoggerProvider():(rr[nr]=(e=1,n=t,r=Zn,t=>t===e?n:r),this._proxyLoggerProvider.setDelegate(t),t);var e,n,r}getLoggerProvider(){var t,e;return null!==(e=null===(t=rr[nr])||void 0===t?void 0:t.call(rr,1))&&void 0!==e?e:this._proxyLoggerProvider}getLogger(t,e,n){return this.getLoggerProvider().getLogger(t,e,n)}disable(){delete rr[nr],this._proxyLoggerProvider=new tr}}const ir=or.getInstance();let sr=console.error.bind(console);function ar(t,e,n){const r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}const ur=(t,e,n)=>{if(!t||!t[e])return void sr("no original function "+String(e)+" to wrap");if(!n)return sr("no wrapper function"),void sr((new Error).stack);const r=t[e];if("function"!=typeof r||"function"!=typeof n)return void sr("original object and wrapper must be functions");const o=n(r,e);return ar(o,"__original",r),ar(o,"__unwrap",(()=>{t[e]===o&&ar(t,e,r)})),ar(o,"__wrapped",!0),ar(t,e,o),o},cr=(t,e,n)=>{if(!t)return sr("must provide one or more modules to patch"),void sr((new Error).stack);Array.isArray(t)||(t=[t]),e&&Array.isArray(e)?t.forEach((t=>{e.forEach((e=>{ur(t,e,n)}))})):sr("must provide one or more functions to wrap on modules")},lr=(t,e)=>{if(!t||!t[e])return sr("no function to unwrap."),void sr((new Error).stack);const n=t[e];n.__unwrap?n.__unwrap():sr("no original to unwrap to -- has "+String(e)+" already been unwrapped?")},pr=(t,e)=>{if(!t)return sr("must provide one or more modules to patch"),void sr((new Error).stack);Array.isArray(t)||(t=[t]),e&&Array.isArray(e)?t.forEach((t=>{e.forEach((e=>{lr(t,e)}))})):sr("must provide one or more functions to unwrap on modules")};class dr{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(t,e,n){this.instrumentationName=t,this.instrumentationVersion=e,this.setConfig(n),this._diag=xt.createComponentLogger({namespace:t}),this._tracer=Kt.getTracer(t,e),this._meter=Mt.getMeter(t,e),this._logger=ir.getLogger(t,e),this._updateMetricInstruments()}_wrap=ur;_unwrap=lr;_massWrap=cr;_massUnwrap=pr;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,e,n,r){if(t)try{t(n,r)}catch(t){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:e},t)}}}class hr extends dr{constructor(t,e,n){super(t,e,n),this._config.enabled&&this.enable()}}function fr(t,e,n){let r,o;try{o=t()}catch(t){r=t}finally{return e(r,o),o}}function _r(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}var gr;function mr(t,e){let n=gr.OLD;const r=e?.split(",").map((t=>t.trim())).filter((t=>""!==t));for(const e of r??[]){if(e.toLowerCase()===t+"/dup"){n=gr.DUPLICATE;break}e.toLowerCase()===t&&(n=gr.STABLE)}return n}!function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"}(gr||(gr={}));const Sr=t=>null!==t&&"object"==typeof t&&"function"==typeof t.then;class vr{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(t){const e=new vr({});return e._rawAttributes=br(t),e._asyncAttributesPending=t.filter((([t,e])=>Sr(e))).length>0,e}constructor(t){const e=t.attributes??{};this._rawAttributes=Object.entries(e).map((([t,e])=>(Sr(e)&&(this._asyncAttributesPending=!0),[t,e]))),this._rawAttributes=br(this._rawAttributes)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[e,n]=this._rawAttributes[t];this._rawAttributes[t]=[e,Sr(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&xt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[e,n]of this._rawAttributes)Sr(n)?xt.debug(`Unsettled resource attribute ${e} skipped`):null!=n&&(t[e]??=n);return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}merge(t){return null==t?this:vr.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()])}}function Tr(t){return vr.FromAttributeList(Object.entries(t))}function yr(){return Tr({[ye]:"unknown_service",[be]:we[be],[Ee]:we[Ee],[Ae]:we[Ae]})}function br(t){return t.map((([t,e])=>Sr(e)?[t,e.catch((e=>{xt.debug("promise rejection for resource attribute: %s - %s",t,e)}))]:[t,e]))}class Er{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:Ct.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){const e=Date.now();this._spanContext=t.spanContext,this._performanceStartTime=de.now(),this._performanceOffset=e-(this._performanceStartTime+xe()),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,this.links=t.links||[],this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,e){if(null==e||this._isSpanEnded())return this;if(0===t.length)return xt.warn(`Invalid attribute key: ${t}`),this;if(!ie(e))return xt.warn(`Invalid attribute value set for key: ${t}`),this;const{attributeCountLimit:n}=this._spanLimits;return void 0!==n&&Object.keys(this.attributes).length>=n&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(e),this)}setAttributes(t){for(const[e,n]of Object.entries(t))this.setAttribute(e,n);return this}addEvent(t,e,n){if(this._isSpanEnded())return this;const{eventCountLimit:r}=this._spanLimits;if(0===r)return xt.warn("No events allowed."),this._droppedEventsCount++,this;void 0!==r&&this.events.length>=r&&(0===this._droppedEventsCount&&xt.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),je(e)&&(je(n)||(n=e),e=void 0);const o=re(e);return this.events.push({name:t,attributes:o,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()||(this.status={...t},null!=this.status.message&&"string"!=typeof t.message&&(xt.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`),delete this.status.message)),this}updateName(t){return this._isSpanEnded()||(this.name=t),this}end(t){this._isSpanEnded()?xt.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this._ended=!0,this.endTime=this._getTime(t),this._duration=Me(this.startTime,this.endTime),this._duration[0]<0&&(xt.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&xt.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this))}_getTime(t){if("number"==typeof t&&t<=de.now())return De(t+this._performanceOffset);if("number"==typeof t)return Le(t);if(t instanceof Date)return Le(t.getTime());if(Ue(t))return t;if(this._startTimeProvided)return Le(Date.now());const e=de.now()-this._performanceStartTime;return He(this.startTime,Le(e))}isRecording(){return!1===this._ended}recordException(t,e){const n={};"string"==typeof t?n[fe]=t:t&&(t.code?n[_e]=t.code.toString():t.name&&(n[_e]=t.name),t.message&&(n[fe]=t.message),t.stack&&(n["exception.stacktrace"]=t.stack)),n[_e]||n[fe]?this.addEvent("exception",n,e):xt.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);xt.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,e){return t.length<=e?t:t.substring(0,e)}_truncateToSize(t){const e=this._attributeValueLengthLimit;return e<=0?(xt.warn(`Attribute value limit must be positive, got ${e}`),t):"string"==typeof t?this._truncateToLimitUtil(t,e):Array.isArray(t)?t.map((t=>"string"==typeof t?this._truncateToLimitUtil(t,e):t)):t}}var Ar;!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(Ar||(Ar={}));class Or{shouldSample(){return{decision:Ar.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Cr{shouldSample(){return{decision:Ar.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class wr{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(ce(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Cr),this._remoteParentSampled=t.remoteParentSampled??new Cr,this._remoteParentNotSampled=t.remoteParentNotSampled??new Or,this._localParentSampled=t.localParentSampled??new Cr,this._localParentNotSampled=t.localParentNotSampled??new Or}shouldSample(t,e,n,r,o,i){const s=Kt.getSpanContext(t);return s&&Tt(s)?s.isRemote?s.traceFlags&R.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):s.traceFlags&R.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,o,i):this._localParentNotSampled.shouldSample(t,e,n,r,o,i):this._root.shouldSample(t,e,n,r,o,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class Rr{_ratio;_upperBound;constructor(t=0){this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(t,e){return{decision:vt(e)&&this._accumulate(e)<this._upperBound?Ar.RECORD_AND_SAMPLED:Ar.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return"number"!=typeof t||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let e=0;for(let n=0;n<t.length/8;n++){const r=8*n;e=(e^parseInt(t.slice(r,r+8),16))>>>0}return e}}const Nr=1;function Pr(){return{sampler:Lr(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Lr(){const t="parentbased_always_on";switch(t){case"always_on":return new Cr;case"always_off":return new Or;case"parentbased_always_on":return new wr({root:new Cr});case"parentbased_always_off":return new wr({root:new Or});case"traceidratio":return new Rr(xr());case"parentbased_traceidratio":return new wr({root:new Rr(xr())});default:return xt.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "parentbased_always_on".`),new wr({root:new Cr})}}function xr(){return xt.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Nr}.`),Nr}const Dr=1/0;class Ir{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,e){this._exporter=t,this._maxExportBatchSize="number"==typeof e?.maxExportBatchSize?e.maxExportBatchSize:512,this._maxQueueSize="number"==typeof e?.maxQueueSize?e.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof e?.scheduledDelayMillis?e.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof e?.exportTimeoutMillis?e.exportTimeoutMillis:3e4,this._shutdownOnce=new On(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(xt.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,e){}onEnd(t){this._shutdownOnce.isCalled||t.spanContext().traceFlags&R.SAMPLED&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then((()=>this.onShutdown())).then((()=>this._flushAll())).then((()=>this._exporter.shutdown()))}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize)return 0===this._droppedSpansCount&&xt.debug("maxQueueSize reached, dropping spans"),void this._droppedSpansCount++;this._droppedSpansCount>0&&(xt.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise(((t,e)=>{const n=[];for(let t=0,e=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);t<e;t++)n.push(this._flushOneBatch());Promise.all(n).then((()=>{t()})).catch(e)}))}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise(((t,e)=>{const n=setTimeout((()=>{e(new Error("Timeout"))}),this._exportTimeoutMillis);Lt.with(Qt(Lt.active()),(()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(r,(r=>{clearTimeout(n),r.code===Be.SUCCESS?t():e(r.error??new Error("BatchSpanProcessor: span export failed"))}));let i=null;for(let t=0,e=r.length;t<e;t++){const e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(i??=[],i.push(e.resource.waitForAsyncAttributes()))}null===i?o():Promise.all(i).then(o,(t=>{ce(t),e(t)}))}))}))}_maybeStartTimer(){if(this._isExporting)return;const t=()=>{this._isExporting=!0,this._flushOneBatch().finally((()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())})).catch((t=>{this._isExporting=!1,ce(t)}))};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();void 0===this._timer&&(this._timer=setTimeout((()=>t()),this._scheduledDelayMillis),this._timer)}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class Mr extends Ir{_visibilityChangeListener;_pageHideListener;constructor(t,e){super(t,e),this.onInit(e)}onInit(t){!0!==t?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch((t=>{ce(t)}))},this._pageHideListener=()=>{this.forceFlush().catch((t=>{ce(t)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}class kr{generateTraceId=jr(16);generateSpanId=jr(8)}const Ur=Array(32);function jr(t){return function(){for(let e=0;e<2*t;e++)Ur[e]=Math.floor(16*Math.random())+48,Ur[e]>=58&&(Ur[e]+=39);return String.fromCharCode.apply(null,Ur.slice(0,2*t))}}class Hr{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(t,e,n,r){const o=function(t){const e={sampler:Lr()},n=Pr(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}(e);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=e.idGenerator||new kr,this._resource=n,this._spanProcessor=r,this.instrumentationScope=t}startSpan(t,e={},n=Lt.active()){e.root&&(n=Kt.deleteSpan(n));const r=Kt.getSpan(n);if(Xt(n)){xt.debug("Instrumentation suppressed, returning Noop Span");return Kt.wrapSpanContext(ut)}const o=r?.spanContext(),i=this._idGenerator.generateSpanId();let s,a,u;o&&Kt.isSpanContextValid(o)?(a=o.traceId,u=o.traceState,s=o):a=this._idGenerator.generateTraceId();const c=e.kind??Ot.INTERNAL,l=(e.links??[]).map((t=>({context:t.context,attributes:re(t.attributes)}))),p=re(e.attributes),d=this._sampler.shouldSample(n,a,t,c,p,l);u=d.traceState??u;const h={traceId:a,spanId:i,traceFlags:d.decision===At.RECORD_AND_SAMPLED?R.SAMPLED:R.NONE,traceState:u};if(d.decision===At.NOT_RECORD){xt.debug("Recording is off, propagating context in a non-recording span");return Kt.wrapSpanContext(h)}const f=re(Object.assign(p,d.attributes));return new Er({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:t,kind:c,links:l,parentSpanContext:s,attributes:f,startTime:e.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(t,e,n,r){let o,i,s;if(arguments.length<2)return;2===arguments.length?s=e:3===arguments.length?(o=e,s=n):(o=e,i=n,s=r);const a=i??Lt.active(),u=this.startSpan(t,o,a),c=Kt.setSpan(a,u);return Lt.with(c,s,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Br{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){const t=[];for(const e of this._spanProcessors)t.push(e.forceFlush());return new Promise((e=>{Promise.all(t).then((()=>{e()})).catch((t=>{ce(t||new Error("MultiSpanProcessor: forceFlush failed")),e()}))}))}onStart(t,e){for(const n of this._spanProcessors)n.onStart(t,e)}onEnd(t){for(const e of this._spanProcessors)e.onEnd(t)}shutdown(){const t=[];for(const e of this._spanProcessors)t.push(e.shutdown());return new Promise(((e,n)=>{Promise.all(t).then((()=>{e()}),n)}))}}var Fr,Vr;!function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"}(Fr||(Fr={}));class $r{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){const e=hn({},Pr(),function(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??128,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??Dr,Object.assign({},t,{spanLimits:e})}(t));this._resource=e.resource??yr(),this._config=Object.assign({},e,{resource:this._resource});const n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new Br(n)}getTracer(t,e,n){const r=`${t}@${e||""}:${n?.schemaUrl||""}`;return this._tracers.has(r)||this._tracers.set(r,new Hr({name:t,version:e,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){const t=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map((e=>new Promise((n=>{let r;const o=setTimeout((()=>{n(new Error(`Span processor did not completed within timeout period of ${t} ms`)),r=Fr.timeout}),t);e.forceFlush().then((()=>{clearTimeout(o),r!==Fr.timeout&&(r=Fr.resolved,n(r))})).catch((t=>{clearTimeout(o),r=Fr.error,n(t)}))}))));return new Promise(((t,n)=>{Promise.all(e).then((e=>{const r=e.filter((t=>t!==Fr.resolved));r.length>0?n(r):t()})).catch((t=>n([t])))}))}shutdown(){return this._activeSpanProcessor.shutdown()}}class zr{_enabled=!1;_currentContext=P;_bindFunction(t=P,e){const n=this,r=function(...r){return n.with(t,(()=>e.apply(this,r)))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),r}active(){return this._currentContext}bind(t,e){return void 0===t&&(t=this.active()),"function"==typeof e?this._bindFunction(t,e):e}disable(){return this._currentContext=P,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=P),this}with(t,e,n,...r){const o=this._currentContext;this._currentContext=t||P;try{return e.call(n,...r)}finally{this._currentContext=o}}}class qr extends $r{constructor(t={}){super(t)}register(t={}){var e;Kt.setGlobalTracerProvider(this),null!==(e=t.propagator)&&(void 0!==e?qt.setGlobalPropagator(e):qt.setGlobalPropagator(new Fe({propagators:[new Ye,new ne]}))),function(t){if(null!==t){if(void 0===t){const t=new zr;return t.enable(),void Lt.setGlobalContextManager(t)}t.enable(),Lt.setGlobalContextManager(t)}}(t.contextManager)}}!function(t){t.CONNECT_END="connectEnd",t.CONNECT_START="connectStart",t.DECODED_BODY_SIZE="decodedBodySize",t.DOM_COMPLETE="domComplete",t.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",t.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",t.DOM_INTERACTIVE="domInteractive",t.DOMAIN_LOOKUP_END="domainLookupEnd",t.DOMAIN_LOOKUP_START="domainLookupStart",t.ENCODED_BODY_SIZE="encodedBodySize",t.FETCH_START="fetchStart",t.LOAD_EVENT_END="loadEventEnd",t.LOAD_EVENT_START="loadEventStart",t.NAVIGATION_START="navigationStart",t.REDIRECT_END="redirectEnd",t.REDIRECT_START="redirectStart",t.REQUEST_START="requestStart",t.RESPONSE_END="responseEnd",t.RESPONSE_START="responseStart",t.SECURE_CONNECTION_START="secureConnectionStart",t.START_TIME="startTime",t.UNLOAD_EVENT_END="unloadEventEnd",t.UNLOAD_EVENT_START="unloadEventStart"}(Vr||(Vr={}));let Gr;function Kr(t,e,n,r=!0){if(!(o=n,i=e,!(i in o)||"number"!=typeof n[e]||r&&0===n[e]))return t.addEvent(e,n[e]);var o,i}function Wr(t,e,n=!1,r,o){if(void 0===r&&(r=0!==e[Vr.START_TIME]),n||(Kr(t,Vr.FETCH_START,e,r),Kr(t,Vr.DOMAIN_LOOKUP_START,e,r),Kr(t,Vr.DOMAIN_LOOKUP_END,e,r),Kr(t,Vr.CONNECT_START,e,r),Kr(t,Vr.SECURE_CONNECTION_START,e,r),Kr(t,Vr.CONNECT_END,e,r),Kr(t,Vr.REQUEST_START,e,r),Kr(t,Vr.RESPONSE_START,e,r),Kr(t,Vr.RESPONSE_END,e,r)),!o){const n=e[Vr.ENCODED_BODY_SIZE];void 0!==n&&t.setAttribute("http.response_content_length",n);const r=e[Vr.DECODED_BODY_SIZE];void 0!==r&&n!==r&&t.setAttribute("http.response_content_length_uncompressed",r)}}function Qr(){return"undefined"!=typeof location?location.origin:void 0}function Xr(t,e,n,r,o=new WeakSet,i){const s=Yr(t),a=function(t,e,n,r,o,i){const s=ke(e),a=ke(n);let u=r.filter((e=>{const n=ke(Ie(e[Vr.FETCH_START])),r=ke(Ie(e[Vr.RESPONSE_END]));return e.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&e.name===t&&n>=s&&r<=a}));u.length>0&&(u=u.filter((t=>!o.has(t))));return u}(t=s.toString(),e,n,r,o,i);if(0===a.length)return{mainRequest:void 0};if(1===a.length)return{mainRequest:a[0]};const u=function(t){return t.slice().sort(((t,e)=>{const n=t[Vr.FETCH_START],r=e[Vr.FETCH_START];return n>r?1:n<r?-1:0}))}(a);if(s.origin!==Qr()&&u.length>1){let t=u[0],e=function(t,e,n){const r=ke(n),o=ke(Ie(e));let i,s=t[1];const a=t.length;for(let e=1;e<a;e++){const n=t[e],a=ke(Ie(n[Vr.FETCH_START])),u=r-ke(Ie(n[Vr.RESPONSE_END]));a>=o&&(!i||u<i)&&(i=u,s=n)}return s}(u,t[Vr.RESPONSE_END],n);const r=t[Vr.RESPONSE_END];return e[Vr.FETCH_START]<r&&(e=t,t=void 0),{corsPreFlightRequest:t,mainRequest:e}}return{mainRequest:a[0]}}function Yr(t){if("function"==typeof URL)return new URL(t,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);const e=(Gr||(Gr=document.createElement("a")),Gr);return e.href=t,e}function Zr(t,e){let n=e||[];("string"==typeof n||n instanceof RegExp)&&(n=[n]);return Yr(t).origin===Qr()||n.some((e=>bn(t,e)))}var Jr;!function(t){t.COMPONENT="component",t.HTTP_STATUS_TEXT="http.status_text"}(Jr||(Jr={}));var to,eo={};function no(){return to||(to=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.ATTR_HTTP_USER_AGENT=eo.ATTR_HTTP_URL=eo.ATTR_HTTP_STATUS_CODE=eo.ATTR_HTTP_SCHEME=eo.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=eo.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=eo.ATTR_HTTP_REQUEST_BODY_SIZE=eo.ATTR_HTTP_METHOD=eo.ATTR_HTTP_HOST=void 0,eo.ATTR_HTTP_HOST="http.host",eo.ATTR_HTTP_METHOD="http.method",eo.ATTR_HTTP_REQUEST_BODY_SIZE="http.request.body.size",eo.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed",eo.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length",eo.ATTR_HTTP_SCHEME="http.scheme",eo.ATTR_HTTP_STATUS_CODE="http.status_code",eo.ATTR_HTTP_URL="http.url",eo.ATTR_HTTP_USER_AGENT="http.user_agent"),eo}var ro=no();const oo=xt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function io(...t){if(t[0]instanceof URL||"string"==typeof t[0]){const e=t[1];if(!e?.body)return Promise.resolve();if(e.body instanceof ReadableStream){const{body:t,length:n}=function(t){if(!t.pipeThrough)return oo.warn("Platform has ReadableStream but not pipeThrough!"),{body:t,length:Promise.resolve(void 0)};let e,n=0;const r=new Promise((t=>{e=t})),o=new TransformStream({start(){},async transform(t,e){const r=await t;n+=r.byteLength,e.enqueue(t)},flush(){e(n)}});return{body:t.pipeThrough(o),length:r}}(e.body);return e.body=t,n}return Promise.resolve(function(t){if(e=t,"undefined"!=typeof Document&&e instanceof Document)return(new XMLSerializer).serializeToString(document).length;var e;if("string"==typeof t)return ao(t);if(t instanceof Blob)return t.size;if(t instanceof FormData)return function(t){let e=0;for(const[n,r]of t.entries())e+=n.length,r instanceof Blob?e+=r.size:e+=r.length;return e}(t);if(t instanceof URLSearchParams)return ao(t.toString());if(void 0!==t.byteLength)return t.byteLength;return void oo.warn("unknown body type")}(e.body))}{const e=t[0];return e?.body?e.clone().text().then((t=>ao(t))):Promise.resolve()}}const so=new TextEncoder;function ao(t){return so.encode(t).byteLength}function uo(t){const e=function(){void 0===lo&&(lo=co);return lo}(),n=t.toUpperCase();return n in e?n:"_OTHER"}const co={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0};let lo;const po={"https:":"443","http:":"80"};const ho="0.202.0",fo="object"==typeof process&&"node"===process.release?.name;class _o extends hr{component="fetch";version=ho;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",ho,t),this._semconvStability=mr("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,e){const n=this.tracer.startSpan("CORS Preflight",{startTime:e[Vr.FETCH_START]},Kt.setSpan(Lt.active(),t)),r=!(this._semconvStability&gr.OLD);Wr(n,e,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(e[Vr.RESPONSE_END])}_addFinalSpanAttributes(t,e){const n=Yr(e.url);if(this._semconvStability&gr.OLD&&(t.setAttribute(ro.ATTR_HTTP_STATUS_CODE,e.status),null!=e.statusText&&t.setAttribute(Jr.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(ro.ATTR_HTTP_HOST,n.host),t.setAttribute(ro.ATTR_HTTP_SCHEME,n.protocol.replace(":","")),"undefined"!=typeof navigator&&t.setAttribute(ro.ATTR_HTTP_USER_AGENT,navigator.userAgent)),this._semconvStability&gr.STABLE){t.setAttribute(Se,e.status),t.setAttribute(ve,n.hostname);const r=function(t){const e=Number(t.port||po[t.protocol]);return e&&!isNaN(e)?e:void 0}(n);r&&t.setAttribute(Te,r)}}_addHeaders(t,e){if(!Zr(e,this.getConfig().propagateTraceHeaderCorsUrls)){const t={};return qt.inject(Lt.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(t instanceof Request)qt.inject(Lt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Headers)qt.inject(Lt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Map)qt.inject(Lt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else{const e={};qt.inject(Lt.active(),e),t.headers=Object.assign({},e,t.headers||{})}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,e={}){if(En(t,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let n="";const r={};if(this._semconvStability&gr.OLD){const o=(e.method||"GET").toUpperCase();n=`HTTP ${o}`,r[Jr.COMPONENT]=this.moduleName,r[ro.ATTR_HTTP_METHOD]=o,r[ro.ATTR_HTTP_URL]=t}if(this._semconvStability&gr.STABLE){const o=e.method,i=uo(e.method||"GET");n||(n=i),r[ge]=i,i!==o&&(r[me]=o),r[Oe]=t}return this.tracer.startSpan(n,{kind:Ot.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(t,e,n){let r=e.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}const o=Xr(e.spanUrl,e.startTime,n,r,this._usedResources,"fetch");if(o.mainRequest){const e=o.mainRequest;this._markResourceAsUsed(e);const n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));const r=!(this._semconvStability&gr.OLD);Wr(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,e,n){const r=Le(Date.now()),o=De();this._addFinalSpanAttributes(t,n),this._semconvStability&gr.STABLE&&n.status>=400&&(t.setStatus({code:Ct.ERROR}),t.setAttribute(he,String(n.status))),setTimeout((()=>{e.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,e,o),this._tasksCount--,this._clearResources(),t.end(r)}),300)}_patchConstructor(){return t=>{const e=this;return function(...n){const r=this,o=Yr(n[0]instanceof Request?n[0].url:String(n[0])).href,i=n[0]instanceof Request?n[0]:n[1]||{},s=e._createSpan(o,i);if(!s)return t.apply(this,n);const a=e._prepareSpanData(o);function u(t,n){e._applyAttributesAfterFetch(t,i,n),e._endSpan(t,a,{status:n.status||0,statusText:n.message,url:o})}function c(t,n){e._applyAttributesAfterFetch(t,i,n),n.status>=200&&n.status<400?e._endSpan(t,a,n):e._endSpan(t,a,{status:n.status,statusText:n.statusText,url:o})}function l(t,e,n){try{const e=n.clone().body;if(e){const r=e.getReader(),o=()=>{r.read().then((({done:e})=>{e?c(t,n):o()}),(e=>{u(t,e)}))};o()}else c(t,n)}finally{e(n)}}function p(t,e,n){try{u(t,n)}finally{e(n)}}return e.getConfig().measureRequestSize&&io(...n).then((t=>{t&&(e._semconvStability&gr.OLD&&s.setAttribute(ro.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED,t),e._semconvStability&gr.STABLE&&s.setAttribute(ro.ATTR_HTTP_REQUEST_BODY_SIZE,t))})).catch((t=>{e._diag.warn("getFetchBodyLength",t)})),new Promise(((n,a)=>Lt.with(Kt.setSpan(Lt.active(),s),(()=>(e._addHeaders(i,o),e._callRequestHook(s,i),e._tasksCount++,t.apply(r,i instanceof Request?[i]:[o,i]).then(l.bind(r,s,n),p.bind(r,s,a)))))))}}}_applyAttributesAfterFetch(t,e,n){const r=this.getConfig().applyCustomAttributesOnSpan;r&&fr((()=>r(t,e,n)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}))}_callRequestHook(t,e){const n=this.getConfig().requestHook;n&&fr((()=>n(t,e)),(t=>{t&&this._diag.error("requestHook",t)}))}_prepareSpanData(t){const e=De(),n=[];if("function"!=typeof PerformanceObserver)return{entries:n,startTime:e,spanUrl:t};const r=new PerformanceObserver((e=>{e.getEntries().forEach((e=>{"fetch"===e.initiatorType&&e.name===t&&n.push(e)}))}));return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:e,spanUrl:t}}enable(){fo?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(_r(fetch)&&(this._unwrap(pe,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(pe,"fetch",this._patchConstructor()))}disable(){fo||(this._unwrap(pe,"fetch"),this._usedResources=new WeakSet)}}var go;!function(t){t.METHOD_OPEN="open",t.METHOD_SEND="send",t.EVENT_ABORT="abort",t.EVENT_ERROR="error",t.EVENT_LOAD="loaded",t.EVENT_TIMEOUT="timeout"}(go||(go={}));const mo=xt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function So(t){return e=t,"undefined"!=typeof Document&&e instanceof Document?(new XMLSerializer).serializeToString(document).length:"string"==typeof t?To(t):t instanceof Blob?t.size:t instanceof FormData?function(t){let e=0;for(const[n,r]of t.entries())e+=n.length,r instanceof Blob?e+=r.size:e+=r.length;return e}(t):t instanceof URLSearchParams?To(t.toString()):void 0!==t.byteLength?t.byteLength:void mo.warn("unknown body type");var e}const vo=new TextEncoder;function To(t){return vo.encode(t).byteLength}const yo={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0};let bo;function Eo(){return void 0===bo&&(bo=yo),bo}const Ao={"https:":"443","http:":"80"};const Oo="0.202.0";var Co;!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(Co||(Co={}));class wo extends hr{component="xml-http-request";version=Oo;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",Oo,t),this._semconvStability=mr("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,e){if(!Zr(Yr(e).href,this.getConfig().propagateTraceHeaderCorsUrls)){const t={};return qt.inject(Lt.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const n={};qt.inject(Lt.active(),n),Object.keys(n).forEach((e=>{t.setRequestHeader(e,String(n[e]))}))}_addChildSpan(t,e){Lt.with(Kt.setSpan(Lt.active(),t),(()=>{const t=this.tracer.startSpan("CORS Preflight",{startTime:e[Vr.FETCH_START]}),n=!(this._semconvStability&gr.OLD);Wr(t,e,this.getConfig().ignoreNetworkEvents,void 0,n),t.end(e[Vr.RESPONSE_END])}))}_addFinalSpanAttributes(t,e,n){if(this._semconvStability&gr.OLD){if(void 0!==e.status&&t.setAttribute("http.status_code",e.status),void 0!==e.statusText&&t.setAttribute(Co.HTTP_STATUS_TEXT,e.statusText),"string"==typeof n){const e=Yr(n);t.setAttribute("http.host",e.host),t.setAttribute("http.scheme",e.protocol.replace(":",""))}t.setAttribute("http.user_agent",navigator.userAgent)}this._semconvStability&gr.STABLE&&e.status&&t.setAttribute(Se,e.status)}_applyAttributesAfterXHR(t,e){const n=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof n&&fr((()=>n(t,e)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}))}_addResourceObserver(t,e){const n=this._xhrMem.get(t);n&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver((t=>{const r=t.getEntries(),o=Yr(e);r.forEach((t=>{"xmlhttprequest"===t.initiatorType&&t.name===o.href&&n.createdResources&&n.createdResources.entries.push(t)}))})),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(de.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,e,n,r,o){if(!(n&&r&&o&&t.createdResources))return;let i=t.createdResources.entries;i&&i.length||(i=de.getEntriesByType("resource"));const s=Xr(Yr(n).href,r,o,i,this._usedResources);if(s.mainRequest){const t=s.mainRequest;this._markResourceAsUsed(t);const n=s.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));const r=!(this._semconvStability&gr.OLD);Wr(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(t){const e=this._xhrMem.get(t);if(e){const n=e.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,e,n){if(En(e,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let r="";const o=Yr(e),i={};if(this._semconvStability&gr.OLD&&(r=n.toUpperCase(),i["http.method"]=n,i["http.url"]=o.toString()),this._semconvStability&gr.STABLE){const t=n,e=function(t){const e=Eo(),n=t.toUpperCase();return n in e?n:"_OTHER"}(n);r||(r=e),i[ge]=e,e!==t&&(i[me]=t),i[Oe]=o.toString(),i[ve]=o.hostname;const s=function(t){const e=Number(t.port||Ao[t.protocol]);return e&&!isNaN(e)?e:void 0}(o);s&&(i[Te]=s)}const s=this.tracer.startSpan(r,{kind:Ot.CLIENT,attributes:i});return s.addEvent(go.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:s,spanUrl:e}),s}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{const e=this;return function(...n){const r=n[0],o=n[1];return e._createSpan(this,o,r),t.apply(this,n)}}}_patchSend(){const t=this;function e(e,n,r,o){const i=t._xhrMem.get(n);if(!i)return;if(i.status=n.status,i.statusText=n.statusText,t._xhrMem.delete(n),i.span){const e=i.span;t._applyAttributesAfterXHR(e,n),t._semconvStability&gr.STABLE&&(r?o&&(e.setStatus({code:Ct.ERROR,message:o}),e.setAttribute(he,o)):i.status&&i.status>=400&&(e.setStatus({code:Ct.ERROR}),e.setAttribute(he,String(i.status))))}const s=De(),a=Date.now();setTimeout((()=>{!function(e,n,r,o){const i=n.callbackToRemoveEvents;"function"==typeof i&&i();const{span:s,spanUrl:a,sendStartTime:u}=n;s&&(t._findResourceAndAddNetworkEvents(n,s,a,u,r),s.addEvent(e,o),t._addFinalSpanAttributes(s,n,a),s.end(o),t._tasksCount--),t._clearResources()}(e,i,s,a)}),300)}function n(){e(go.EVENT_ERROR,this,!0,"error")}function r(){e(go.EVENT_ABORT,this,!1)}function o(){e(go.EVENT_TIMEOUT,this,!0,"timeout")}function i(){this.status<299?e(go.EVENT_LOAD,this,!1):e(go.EVENT_ERROR,this,!1)}return e=>function(...s){const a=t._xhrMem.get(this);if(!a)return e.apply(this,s);const u=a.span,c=a.spanUrl;if(u&&c){if(t.getConfig().measureRequestSize&&s?.[0]){const e=So(s[0]);void 0!==e&&(t._semconvStability&gr.OLD&&u.setAttribute("http.request_content_length_uncompressed",e),t._semconvStability&gr.STABLE&&u.setAttribute("http.request.body.size",e))}Lt.with(Kt.setSpan(Lt.active(),u),(()=>{t._tasksCount++,a.sendStartTime=De(),u.addEvent(go.METHOD_SEND),this.addEventListener("abort",r),this.addEventListener("error",n),this.addEventListener("load",i),this.addEventListener("timeout",o),a.callbackToRemoveEvents=()=>{!function(e){e.removeEventListener("abort",r),e.removeEventListener("error",n),e.removeEventListener("load",i),e.removeEventListener("timeout",o);const s=t._xhrMem.get(e);s&&(s.callbackToRemoveEvents=void 0)}(this),a.createdResources&&a.createdResources.observer.disconnect()},t._addHeaders(this,c),t._addResourceObserver(this,c)}))}return e.apply(this,s)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),_r(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),_r(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}}class Ro extends wo{constructor(t={}){super(t);this.parentCreateSpan=this._createSpan.bind(this)}_patchOpen(){return t=>{const n=this;return function(...r){try{const t=r[0];let o=e.getUrlFromResource(r[1]);n.parentCreateSpan(this,o,t)}catch(t){e.faro.internalLogger.error(t)}return t.apply(this,r)}}}}function No(t,e,n){Po(t,n instanceof Error?0:n.status)}function Po(t,e){if(null==e)return;(0===e||e>=400&&e<600)&&t.setStatus({code:Ct.ERROR})}function Lo(t){return(e,n,r)=>{No(e,0,r),null==t||t(e,n,r)}}function xo(t){return(e,n)=>{!function(t,e){Po(t,e.status)}(e,n),null==t||t(e,n)}}function Do(t={}){const{fetchInstrumentationOptions:e,xhrInstrumentationOptions:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["fetchInstrumentationOptions","xhrInstrumentationOptions"]),o=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:Lo(null==t?void 0:t.applyCustomAttributesOnSpan)})}(e,r),i=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:xo(null==t?void 0:t.applyCustomAttributesOnSpan)})}(n,r);return[new _o(o),new Ro(i)]}class Io{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n;const r=this.metas.value.session;(null==r?void 0:r.id)&&(t.attributes[Qn]=r.id,t.attributes.session_id=r.id);const o=null!==(n=this.metas.value.user)&&void 0!==n?n:{};o.email&&(t.attributes["user.email"]=o.email),o.id&&(t.attributes["user.id"]=o.id),o.username&&(t.attributes["user.name"]=o.username),o.fullName&&(t.attributes["user.full_name"]=o.fullName),o.roles&&(t.attributes["user.roles"]=o.roles.split(",").map((t=>t.trim()))),o.hash&&(t.attributes["user.hash"]=o.hash),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}class Mo{constructor(t){this.processor=t,e.apiMessageBus.subscribe((t=>{t.type!==e.USER_ACTION_START?[e.USER_ACTION_END,e.USER_ACTION_HALT,e.USER_ACTION_CANCEL].includes(t.type)&&(this.message=void 0):this.message=t}))}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n,r;t.kind===Ot.CLIENT&&this.message&&(t.attributes["faro.action.user.name"]=null===(n=this.message)||void 0===n?void 0:n.name,t.attributes["faro.action.user.parentId"]=null===(r=this.message)||void 0===r?void 0:r.parentId),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}function ko(t={}){var e;return"true"===(null===(e=t.attributes)||void 0===e?void 0:e.isSampled)?Ar.RECORD_AND_SAMPLED:Ar.NOT_RECORD}class Uo extends e.BaseInstrumentation{constructor(t={}){super(),this.options=t,this.name="@grafana/faro-web-tracing",this.version=e.VERSION}initialize(){var t,n,r,o,i;const s=this.options,a={};this.config.app.name&&(a[ye]=this.config.app.name),this.config.app.namespace&&(a["service.namespace"]=this.config.app.namespace),this.config.app.version&&(a["service.version"]=this.config.app.version),this.config.app.environment&&(a["deployment.environment.name"]=this.config.app.environment,a["deployment.environment"]=this.config.app.environment);const u=this.metas.value.browser;e.isArray(null==u?void 0:u.brands)&&(a["browser.brands"]=u.brands.map((t=>t.brand))),(null==u?void 0:u.language)&&(a["browser.language"]=u.language),"boolean"==typeof(null==u?void 0:u.mobile)&&(a["browser.mobile"]=Boolean(u.mobile)),(null==u?void 0:u.os)&&(a["browser.platform"]=u.os),(null==u?void 0:u.userAgent)&&(a["user_agent.original"]=u.userAgent),a["process.runtime.name"]="browser",a["process.runtime.version"]=null===(t=this.metas.value.browser)||void 0===t?void 0:t.userAgent,a["telemetry.distro.name"]="faro-web-sdk",a["telemetry.distro.version"]=e.VERSION,Object.assign(a,s.resourceAttributes);const c=yr().merge(Tr(a));new qr({resource:c,sampler:{shouldSample:()=>({decision:ko(this.api.getSession())})},spanProcessors:[null!==(n=s.spanProcessor)&&void 0!==n?n:new Mo(new Io(new Mr(new Wn({api:this.api}),{scheduledDelayMillis:Uo.SCHEDULED_BATCH_DELAY_MS,maxExportBatchSize:30}),this.metas))]}).register({propagator:null!==(r=s.propagator)&&void 0!==r?r:new Ye,contextManager:s.contextManager});const{propagateTraceHeaderCorsUrls:l,fetchInstrumentationOptions:p,xhrInstrumentationOptions:d}=null!==(o=this.options.instrumentationOptions)&&void 0!==o?o:{};!function(t){const e=t.tracerProvider||Kt.getTracerProvider(),n=t.meterProvider||Mt.getMeterProvider(),r=t.loggerProvider||ir.getLoggerProvider(),o=t.instrumentations?.flat()??[];(function(t,e,n,r){for(let o=0,i=t.length;o<i;o++){const i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}})(o,e,n,r)}({instrumentations:null!==(i=s.instrumentations)&&void 0!==i?i:Do({ignoreUrls:this.getIgnoreUrls(),propagateTraceHeaderCorsUrls:l,fetchInstrumentationOptions:p,xhrInstrumentationOptions:d})}),this.api.initOTEL(Kt,Lt)}getIgnoreUrls(){return this.transports.transports.flatMap((t=>t.getIgnoreUrls()))}}return Uo.SCHEDULED_BATCH_DELAY_MS=1e3,t.FaroSessionSpanProcessor=class{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){const n=this.metas.value.session;(null==n?void 0:n.id)&&(t.attributes[Qn]=n.id,t.attributes.session_id=n.id),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}},t.FaroTraceExporter=Wn,t.TracingInstrumentation=Uo,t.fetchCustomAttributeFunctionWithDefaults=Lo,t.getDefaultOTELInstrumentations=Do,t.getSamplingDecision=ko,t.setSpanStatusOnFetchError=No,t}({},GrafanaFaroWebSdk);
@@ -9,3 +9,11 @@
9
9
  export declare const ATTR_SESSION_ID = "session.id";
10
10
  export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
11
11
  export declare const ATTR_SERVICE_NAMESPACE = "service.namespace";
12
+ export declare const ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name";
13
+ export declare const ATTR_PROCESS_RUNTIME_VERSION = "process.runtime.version";
14
+ export declare const ATTR_TELEMETRY_DISTRO_NAME = "telemetry.distro.name";
15
+ export declare const ATTR_TELEMETRY_DISTRO_VERSION = "telemetry.distro.version";
16
+ export declare const ATTR_BROWSER_BRANDS = "browser.brands";
17
+ export declare const ATTR_BROWSER_LANGUAGE = "browser.language";
18
+ export declare const ATTR_BROWSER_MOBILE = "browser.mobile";
19
+ export declare const ATTR_BROWSER_PLATFORM = "browser.platform";
@@ -12,7 +12,7 @@ var FaroUserActionSpanProcessor = /** @class */ (function () {
12
12
  _this.message = msg;
13
13
  return;
14
14
  }
15
- if ([faro_web_sdk_1.USER_ACTION_END, faro_web_sdk_1.USER_ACTION_CANCEL].includes(msg.type)) {
15
+ if ([faro_web_sdk_1.USER_ACTION_END, faro_web_sdk_1.USER_ACTION_HALT, faro_web_sdk_1.USER_ACTION_CANCEL].includes(msg.type)) {
16
16
  _this.message = undefined;
17
17
  }
18
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"faroUserActionSpanProcessor.js","sourceRoot":"","sources":["../../src/faroUserActionSpanProcessor.ts"],"names":[],"mappings":";;;AAAA,0CAA4D;AAG5D,sDAA8G;AAG9G;IAGE,qCAAoB,SAAwB;QAA5C,iBAWC;QAXmB,cAAS,GAAT,SAAS,CAAe;QAC1C,4BAAa,CAAC,SAAS,CAAC,UAAC,GAAG;YAC1B,IAAI,GAAG,CAAC,IAAI,KAAK,gCAAiB,EAAE,CAAC;gBACnC,KAAI,CAAC,OAAO,GAAG,GAAG,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,8BAAe,EAAE,iCAAkB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7D,KAAI,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gDAAU,GAAV;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,6CAAO,GAAP,UAAQ,IAAU,EAAE,aAAsB;;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,cAAQ,CAAC,MAAM,EAAE,CAAC;YAClC,8JAA8J;YAC9J,oFAAoF;YACpF,yJAAyJ;YACzJ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC;gBAC9D,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,QAAQ,CAAC;YACxE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,2CAAK,GAAL,UAAM,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,8CAAQ,GAAR;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IACH,kCAAC;AAAD,CAAC,AAzCD,IAyCC;AAzCY,kEAA2B","sourcesContent":["import { type Context, SpanKind } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';\n\nimport { apiMessageBus, USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START } from '@grafana/faro-web-sdk';\nimport type { UserActionStartMessage } from '@grafana/faro-web-sdk';\n\nexport class FaroUserActionSpanProcessor implements SpanProcessor {\n message: UserActionStartMessage | undefined;\n\n constructor(private processor: SpanProcessor) {\n apiMessageBus.subscribe((msg) => {\n if (msg.type === USER_ACTION_START) {\n this.message = msg;\n return;\n }\n\n if ([USER_ACTION_END, USER_ACTION_CANCEL].includes(msg.type)) {\n this.message = undefined;\n }\n });\n }\n\n forceFlush(): Promise<void> {\n return this.processor.forceFlush();\n }\n\n onStart(span: Span, parentContext: Context): void {\n if (span.kind === SpanKind.CLIENT) {\n // If the span is created when the message object is available it is created before the user action timeout has been reached so it belongs to the user-action.\n // In this case we can add the user action name and parentId to the span attributes.\n // If the span is created after the user action timeout span, the message object will be undefined which means the action has been cancelled or is ended.\n if (this.message) {\n span.attributes['faro.action.user.name'] = this.message?.name;\n span.attributes['faro.action.user.parentId'] = this.message?.parentId;\n }\n }\n\n this.processor.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n this.processor.onEnd(span);\n }\n\n shutdown(): Promise<void> {\n return this.processor.shutdown();\n }\n}\n"]}
1
+ {"version":3,"file":"faroUserActionSpanProcessor.js","sourceRoot":"","sources":["../../src/faroUserActionSpanProcessor.ts"],"names":[],"mappings":";;;AAAA,0CAA4D;AAG5D,sDAM+B;AAG/B;IAGE,qCAAoB,SAAwB;QAA5C,iBAWC;QAXmB,cAAS,GAAT,SAAS,CAAe;QAC1C,4BAAa,CAAC,SAAS,CAAC,UAAC,GAAG;YAC1B,IAAI,GAAG,CAAC,IAAI,KAAK,gCAAiB,EAAE,CAAC;gBACnC,KAAI,CAAC,OAAO,GAAG,GAAG,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,8BAAe,EAAE,+BAAgB,EAAE,iCAAkB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/E,KAAI,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gDAAU,GAAV;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,6CAAO,GAAP,UAAQ,IAAU,EAAE,aAAsB;;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,cAAQ,CAAC,MAAM,EAAE,CAAC;YAClC,8JAA8J;YAC9J,oFAAoF;YACpF,yJAAyJ;YACzJ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC;gBAC9D,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,QAAQ,CAAC;YACxE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,2CAAK,GAAL,UAAM,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,8CAAQ,GAAR;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IACH,kCAAC;AAAD,CAAC,AAzCD,IAyCC;AAzCY,kEAA2B","sourcesContent":["import { type Context, SpanKind } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';\n\nimport {\n apiMessageBus,\n USER_ACTION_CANCEL,\n USER_ACTION_END,\n USER_ACTION_HALT,\n USER_ACTION_START,\n} from '@grafana/faro-web-sdk';\nimport type { UserActionStartMessage } from '@grafana/faro-web-sdk';\n\nexport class FaroUserActionSpanProcessor implements SpanProcessor {\n message: UserActionStartMessage | undefined;\n\n constructor(private processor: SpanProcessor) {\n apiMessageBus.subscribe((msg) => {\n if (msg.type === USER_ACTION_START) {\n this.message = msg;\n return;\n }\n\n if ([USER_ACTION_END, USER_ACTION_HALT, USER_ACTION_CANCEL].includes(msg.type)) {\n this.message = undefined;\n }\n });\n }\n\n forceFlush(): Promise<void> {\n return this.processor.forceFlush();\n }\n\n onStart(span: Span, parentContext: Context): void {\n if (span.kind === SpanKind.CLIENT) {\n // If the span is created when the message object is available it is created before the user action timeout has been reached so it belongs to the user-action.\n // In this case we can add the user action name and parentId to the span attributes.\n // If the span is created after the user action timeout span, the message object will be undefined which means the action has been cancelled or is ended.\n if (this.message) {\n span.attributes['faro.action.user.name'] = this.message?.name;\n span.attributes['faro.action.user.parentId'] = this.message?.parentId;\n }\n }\n\n this.processor.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n this.processor.onEnd(span);\n }\n\n shutdown(): Promise<void> {\n return this.processor.shutdown();\n }\n}\n"]}
@@ -44,7 +44,7 @@ var TracingInstrumentation = /** @class */ (function (_super) {
44
44
  }
45
45
  TracingInstrumentation.prototype.initialize = function () {
46
46
  var _this = this;
47
- var _a, _b, _c, _d;
47
+ var _a, _b, _c, _d, _e;
48
48
  var options = this.options;
49
49
  var attributes = {};
50
50
  if (this.config.app.name) {
@@ -63,6 +63,26 @@ var TracingInstrumentation = /** @class */ (function (_super) {
63
63
  */
64
64
  attributes[semantic_conventions_1.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;
65
65
  }
66
+ var browserMeta = this.metas.value.browser;
67
+ if ((0, faro_web_sdk_1.isArray)(browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.brands)) {
68
+ attributes[semconv_1.ATTR_BROWSER_BRANDS] = browserMeta.brands.map(function (entry) { return entry.brand; });
69
+ }
70
+ if (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.language) {
71
+ attributes[semconv_1.ATTR_BROWSER_LANGUAGE] = browserMeta.language;
72
+ }
73
+ if (typeof (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.mobile) === 'boolean') {
74
+ attributes[semconv_1.ATTR_BROWSER_MOBILE] = Boolean(browserMeta.mobile);
75
+ }
76
+ if (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.os) {
77
+ attributes[semconv_1.ATTR_BROWSER_PLATFORM] = browserMeta.os;
78
+ }
79
+ if (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.userAgent) {
80
+ attributes[semantic_conventions_1.ATTR_USER_AGENT_ORIGINAL] = browserMeta.userAgent;
81
+ }
82
+ attributes[semconv_1.ATTR_PROCESS_RUNTIME_NAME] = 'browser';
83
+ attributes[semconv_1.ATTR_PROCESS_RUNTIME_VERSION] = (_a = this.metas.value.browser) === null || _a === void 0 ? void 0 : _a.userAgent;
84
+ attributes[semconv_1.ATTR_TELEMETRY_DISTRO_NAME] = 'faro-web-sdk';
85
+ attributes[semconv_1.ATTR_TELEMETRY_DISTRO_VERSION] = faro_web_sdk_1.VERSION;
66
86
  Object.assign(attributes, options.resourceAttributes);
67
87
  var resource = (0, resources_1.defaultResource)().merge((0, resources_1.resourceFromAttributes)(attributes));
68
88
  var provider = new sdk_trace_web_1.WebTracerProvider({
@@ -75,19 +95,19 @@ var TracingInstrumentation = /** @class */ (function (_super) {
75
95
  },
76
96
  },
77
97
  spanProcessors: [
78
- (_a = options.spanProcessor) !== null && _a !== void 0 ? _a : new faroUserActionSpanProcessor_1.FaroUserActionSpanProcessor(new faroMetaAttributesSpanProcessor_1.FaroMetaAttributesSpanProcessor(new sdk_trace_web_1.BatchSpanProcessor(new faroTraceExporter_1.FaroTraceExporter({ api: this.api }), {
98
+ (_b = options.spanProcessor) !== null && _b !== void 0 ? _b : new faroUserActionSpanProcessor_1.FaroUserActionSpanProcessor(new faroMetaAttributesSpanProcessor_1.FaroMetaAttributesSpanProcessor(new sdk_trace_web_1.BatchSpanProcessor(new faroTraceExporter_1.FaroTraceExporter({ api: this.api }), {
79
99
  scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,
80
100
  maxExportBatchSize: 30,
81
101
  }), this.metas)),
82
102
  ],
83
103
  });
84
104
  provider.register({
85
- propagator: (_b = options.propagator) !== null && _b !== void 0 ? _b : new core_1.W3CTraceContextPropagator(),
105
+ propagator: (_c = options.propagator) !== null && _c !== void 0 ? _c : new core_1.W3CTraceContextPropagator(),
86
106
  contextManager: options.contextManager,
87
107
  });
88
- var _e = (_c = this.options.instrumentationOptions) !== null && _c !== void 0 ? _c : {}, propagateTraceHeaderCorsUrls = _e.propagateTraceHeaderCorsUrls, fetchInstrumentationOptions = _e.fetchInstrumentationOptions, xhrInstrumentationOptions = _e.xhrInstrumentationOptions;
108
+ var _f = (_d = this.options.instrumentationOptions) !== null && _d !== void 0 ? _d : {}, propagateTraceHeaderCorsUrls = _f.propagateTraceHeaderCorsUrls, fetchInstrumentationOptions = _f.fetchInstrumentationOptions, xhrInstrumentationOptions = _f.xhrInstrumentationOptions;
89
109
  (0, instrumentation_1.registerInstrumentations)({
90
- instrumentations: (_d = options.instrumentations) !== null && _d !== void 0 ? _d : (0, getDefaultOTELInstrumentations_1.getDefaultOTELInstrumentations)({
110
+ instrumentations: (_e = options.instrumentations) !== null && _e !== void 0 ? _e : (0, getDefaultOTELInstrumentations_1.getDefaultOTELInstrumentations)({
91
111
  ignoreUrls: this.getIgnoreUrls(),
92
112
  propagateTraceHeaderCorsUrls: propagateTraceHeaderCorsUrls,
93
113
  fetchInstrumentationOptions: fetchInstrumentationOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"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","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport type { Attributes } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { defaultResource, resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\n\nimport { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';\nimport type { Transport } from '@grafana/faro-web-sdk';\n\nimport { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { FaroUserActionSpanProcessor } from './faroUserActionSpanProcessor';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport { ATTR_DEPLOYMENT_ENVIRONMENT_NAME, ATTR_SERVICE_NAMESPACE } from './semconv';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: Attributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = defaultResource().merge(resourceFromAttributes(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n spanProcessors: [\n options.spanProcessor ??\n new FaroUserActionSpanProcessor(\n new FaroMetaAttributesSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n )\n ),\n ],\n });\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager,\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"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","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport type { Attributes } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { defaultResource, resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n ATTR_USER_AGENT_ORIGINAL,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\n\nimport { BaseInstrumentation, isArray, VERSION } from '@grafana/faro-web-sdk';\nimport type { Transport } from '@grafana/faro-web-sdk';\n\nimport { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { FaroUserActionSpanProcessor } from './faroUserActionSpanProcessor';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport {\n ATTR_BROWSER_BRANDS,\n ATTR_BROWSER_LANGUAGE,\n ATTR_BROWSER_MOBILE,\n ATTR_BROWSER_PLATFORM,\n ATTR_DEPLOYMENT_ENVIRONMENT_NAME,\n ATTR_PROCESS_RUNTIME_NAME,\n ATTR_PROCESS_RUNTIME_VERSION,\n ATTR_SERVICE_NAMESPACE,\n ATTR_TELEMETRY_DISTRO_NAME,\n ATTR_TELEMETRY_DISTRO_VERSION,\n} from './semconv';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: Attributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n const browserMeta = this.metas.value.browser;\n\n if (isArray(browserMeta?.brands)) {\n attributes[ATTR_BROWSER_BRANDS] = browserMeta.brands.map((entry) => entry.brand);\n }\n\n if (browserMeta?.language) {\n attributes[ATTR_BROWSER_LANGUAGE] = browserMeta.language;\n }\n\n if (typeof browserMeta?.mobile === 'boolean') {\n attributes[ATTR_BROWSER_MOBILE] = Boolean(browserMeta.mobile);\n }\n\n if (browserMeta?.os) {\n attributes[ATTR_BROWSER_PLATFORM] = browserMeta.os;\n }\n\n if (browserMeta?.userAgent) {\n attributes[ATTR_USER_AGENT_ORIGINAL] = browserMeta.userAgent;\n }\n\n attributes[ATTR_PROCESS_RUNTIME_NAME] = 'browser';\n attributes[ATTR_PROCESS_RUNTIME_VERSION] = this.metas.value.browser?.userAgent;\n\n attributes[ATTR_TELEMETRY_DISTRO_NAME] = 'faro-web-sdk';\n attributes[ATTR_TELEMETRY_DISTRO_VERSION] = VERSION;\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = defaultResource().merge(resourceFromAttributes(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n spanProcessors: [\n options.spanProcessor ??\n new FaroUserActionSpanProcessor(\n new FaroMetaAttributesSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n )\n ),\n ],\n });\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager,\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
@@ -8,8 +8,19 @@
8
8
  See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = exports.ATTR_SESSION_ID = void 0;
11
+ exports.ATTR_BROWSER_PLATFORM = exports.ATTR_BROWSER_MOBILE = exports.ATTR_BROWSER_LANGUAGE = exports.ATTR_BROWSER_BRANDS = exports.ATTR_TELEMETRY_DISTRO_VERSION = exports.ATTR_TELEMETRY_DISTRO_NAME = exports.ATTR_PROCESS_RUNTIME_VERSION = exports.ATTR_PROCESS_RUNTIME_NAME = exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = exports.ATTR_SESSION_ID = void 0;
12
12
  exports.ATTR_SESSION_ID = 'session.id';
13
13
  exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';
14
14
  exports.ATTR_SERVICE_NAMESPACE = 'service.namespace';
15
+ // https://opentelemetry.io/docs/specs/semconv/resource/process/#javascript-runtimes
16
+ exports.ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';
17
+ exports.ATTR_PROCESS_RUNTIME_VERSION = 'process.runtime.version';
18
+ // https://opentelemetry.io/docs/specs/semconv/attributes-registry/telemetry/#telemetry-attributes
19
+ exports.ATTR_TELEMETRY_DISTRO_NAME = 'telemetry.distro.name';
20
+ exports.ATTR_TELEMETRY_DISTRO_VERSION = 'telemetry.distro.version';
21
+ // https://opentelemetry.io/docs/specs/semconv/resource/browser/
22
+ exports.ATTR_BROWSER_BRANDS = 'browser.brands';
23
+ exports.ATTR_BROWSER_LANGUAGE = 'browser.language';
24
+ exports.ATTR_BROWSER_MOBILE = 'browser.mobile';
25
+ exports.ATTR_BROWSER_PLATFORM = 'browser.platform';
15
26
  //# sourceMappingURL=semconv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEU,QAAA,eAAe,GAAG,YAAY,CAAC;AAC/B,QAAA,gCAAgC,GAAG,6BAA6B,CAAC;AACjE,QAAA,sBAAsB,GAAG,mBAAmB,CAAC","sourcesContent":["/**\n Unstable SemConv\n Because the \"incubating\" entry-point may include breaking changes in minor versions,\n it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,\n but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)\n \n See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating\n */\n\nexport const ATTR_SESSION_ID = 'session.id';\nexport const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';\nexport const ATTR_SERVICE_NAMESPACE = 'service.namespace';\n"]}
1
+ {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEU,QAAA,eAAe,GAAG,YAAY,CAAC;AAC/B,QAAA,gCAAgC,GAAG,6BAA6B,CAAC;AACjE,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,oFAAoF;AACvE,QAAA,yBAAyB,GAAG,sBAAsB,CAAC;AACnD,QAAA,4BAA4B,GAAG,yBAAyB,CAAC;AAEtE,kGAAkG;AACrF,QAAA,0BAA0B,GAAG,uBAAuB,CAAC;AACrD,QAAA,6BAA6B,GAAG,0BAA0B,CAAC;AAExE,gEAAgE;AACnD,QAAA,mBAAmB,GAAG,gBAAgB,CAAC;AACvC,QAAA,qBAAqB,GAAG,kBAAkB,CAAC;AAC3C,QAAA,mBAAmB,GAAG,gBAAgB,CAAC;AACvC,QAAA,qBAAqB,GAAG,kBAAkB,CAAC","sourcesContent":["/**\n Unstable SemConv\n Because the \"incubating\" entry-point may include breaking changes in minor versions,\n it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,\n but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)\n \n See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating\n */\n\nexport const ATTR_SESSION_ID = 'session.id';\nexport const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';\nexport const ATTR_SERVICE_NAMESPACE = 'service.namespace';\n\n// https://opentelemetry.io/docs/specs/semconv/resource/process/#javascript-runtimes\nexport const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';\nexport const ATTR_PROCESS_RUNTIME_VERSION = 'process.runtime.version';\n\n// https://opentelemetry.io/docs/specs/semconv/attributes-registry/telemetry/#telemetry-attributes\nexport const ATTR_TELEMETRY_DISTRO_NAME = 'telemetry.distro.name';\nexport const ATTR_TELEMETRY_DISTRO_VERSION = 'telemetry.distro.version';\n\n// https://opentelemetry.io/docs/specs/semconv/resource/browser/\nexport const ATTR_BROWSER_BRANDS = 'browser.brands';\nexport const ATTR_BROWSER_LANGUAGE = 'browser.language';\nexport const ATTR_BROWSER_MOBILE = 'browser.mobile';\nexport const ATTR_BROWSER_PLATFORM = 'browser.platform';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { SpanKind } from '@opentelemetry/api';
2
- import { apiMessageBus, USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START } from '@grafana/faro-web-sdk';
2
+ import { apiMessageBus, USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_HALT, USER_ACTION_START, } from '@grafana/faro-web-sdk';
3
3
  export class FaroUserActionSpanProcessor {
4
4
  constructor(processor) {
5
5
  this.processor = processor;
@@ -8,7 +8,7 @@ export class FaroUserActionSpanProcessor {
8
8
  this.message = msg;
9
9
  return;
10
10
  }
11
- if ([USER_ACTION_END, USER_ACTION_CANCEL].includes(msg.type)) {
11
+ if ([USER_ACTION_END, USER_ACTION_HALT, USER_ACTION_CANCEL].includes(msg.type)) {
12
12
  this.message = undefined;
13
13
  }
14
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"faroUserActionSpanProcessor.js","sourceRoot":"","sources":["../../src/faroUserActionSpanProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG9G,MAAM,OAAO,2BAA2B;IAGtC,YAAoB,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;QAC1C,aAAa,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;YAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBACnC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7D,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,IAAU,EAAE,aAAsB;;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClC,8JAA8J;YAC9J,oFAAoF;YACpF,yJAAyJ;YACzJ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC;gBAC9D,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,QAAQ,CAAC;YACxE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["import { type Context, SpanKind } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';\n\nimport { apiMessageBus, USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START } from '@grafana/faro-web-sdk';\nimport type { UserActionStartMessage } from '@grafana/faro-web-sdk';\n\nexport class FaroUserActionSpanProcessor implements SpanProcessor {\n message: UserActionStartMessage | undefined;\n\n constructor(private processor: SpanProcessor) {\n apiMessageBus.subscribe((msg) => {\n if (msg.type === USER_ACTION_START) {\n this.message = msg;\n return;\n }\n\n if ([USER_ACTION_END, USER_ACTION_CANCEL].includes(msg.type)) {\n this.message = undefined;\n }\n });\n }\n\n forceFlush(): Promise<void> {\n return this.processor.forceFlush();\n }\n\n onStart(span: Span, parentContext: Context): void {\n if (span.kind === SpanKind.CLIENT) {\n // If the span is created when the message object is available it is created before the user action timeout has been reached so it belongs to the user-action.\n // In this case we can add the user action name and parentId to the span attributes.\n // If the span is created after the user action timeout span, the message object will be undefined which means the action has been cancelled or is ended.\n if (this.message) {\n span.attributes['faro.action.user.name'] = this.message?.name;\n span.attributes['faro.action.user.parentId'] = this.message?.parentId;\n }\n }\n\n this.processor.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n this.processor.onEnd(span);\n }\n\n shutdown(): Promise<void> {\n return this.processor.shutdown();\n }\n}\n"]}
1
+ {"version":3,"file":"faroUserActionSpanProcessor.js","sourceRoot":"","sources":["../../src/faroUserActionSpanProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,OAAO,2BAA2B;IAGtC,YAAoB,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;QAC1C,aAAa,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;YAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBACnC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/E,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,IAAU,EAAE,aAAsB;;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClC,8JAA8J;YAC9J,oFAAoF;YACpF,yJAAyJ;YACzJ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC;gBAC9D,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,QAAQ,CAAC;YACxE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["import { type Context, SpanKind } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';\n\nimport {\n apiMessageBus,\n USER_ACTION_CANCEL,\n USER_ACTION_END,\n USER_ACTION_HALT,\n USER_ACTION_START,\n} from '@grafana/faro-web-sdk';\nimport type { UserActionStartMessage } from '@grafana/faro-web-sdk';\n\nexport class FaroUserActionSpanProcessor implements SpanProcessor {\n message: UserActionStartMessage | undefined;\n\n constructor(private processor: SpanProcessor) {\n apiMessageBus.subscribe((msg) => {\n if (msg.type === USER_ACTION_START) {\n this.message = msg;\n return;\n }\n\n if ([USER_ACTION_END, USER_ACTION_HALT, USER_ACTION_CANCEL].includes(msg.type)) {\n this.message = undefined;\n }\n });\n }\n\n forceFlush(): Promise<void> {\n return this.processor.forceFlush();\n }\n\n onStart(span: Span, parentContext: Context): void {\n if (span.kind === SpanKind.CLIENT) {\n // If the span is created when the message object is available it is created before the user action timeout has been reached so it belongs to the user-action.\n // In this case we can add the user action name and parentId to the span attributes.\n // If the span is created after the user action timeout span, the message object will be undefined which means the action has been cancelled or is ended.\n if (this.message) {\n span.attributes['faro.action.user.name'] = this.message?.name;\n span.attributes['faro.action.user.parentId'] = this.message?.parentId;\n }\n }\n\n this.processor.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n this.processor.onEnd(span);\n }\n\n shutdown(): Promise<void> {\n return this.processor.shutdown();\n }\n}\n"]}
@@ -3,14 +3,14 @@ import { W3CTraceContextPropagator } from '@opentelemetry/core';
3
3
  import { registerInstrumentations } from '@opentelemetry/instrumentation';
4
4
  import { defaultResource, resourceFromAttributes } from '@opentelemetry/resources';
5
5
  import { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';
6
- import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMRESATTRS_DEPLOYMENT_ENVIRONMENT, } from '@opentelemetry/semantic-conventions';
7
- import { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';
6
+ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, ATTR_USER_AGENT_ORIGINAL, SEMRESATTRS_DEPLOYMENT_ENVIRONMENT, } from '@opentelemetry/semantic-conventions';
7
+ import { BaseInstrumentation, isArray, VERSION } from '@grafana/faro-web-sdk';
8
8
  import { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';
9
9
  import { FaroTraceExporter } from './faroTraceExporter';
10
10
  import { FaroUserActionSpanProcessor } from './faroUserActionSpanProcessor';
11
11
  import { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';
12
12
  import { getSamplingDecision } from './sampler';
13
- import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME, ATTR_SERVICE_NAMESPACE } from './semconv';
13
+ import { ATTR_BROWSER_BRANDS, ATTR_BROWSER_LANGUAGE, ATTR_BROWSER_MOBILE, ATTR_BROWSER_PLATFORM, ATTR_DEPLOYMENT_ENVIRONMENT_NAME, ATTR_PROCESS_RUNTIME_NAME, ATTR_PROCESS_RUNTIME_VERSION, ATTR_SERVICE_NAMESPACE, ATTR_TELEMETRY_DISTRO_NAME, ATTR_TELEMETRY_DISTRO_VERSION, } from './semconv';
14
14
  // the providing of app name here is not great
15
15
  // should delay initialization and provide the full Faro config,
16
16
  // taking app name from it
@@ -22,7 +22,7 @@ export class TracingInstrumentation extends BaseInstrumentation {
22
22
  this.version = VERSION;
23
23
  }
24
24
  initialize() {
25
- var _a, _b, _c, _d;
25
+ var _a, _b, _c, _d, _e;
26
26
  const options = this.options;
27
27
  const attributes = {};
28
28
  if (this.config.app.name) {
@@ -41,6 +41,26 @@ export class TracingInstrumentation extends BaseInstrumentation {
41
41
  */
42
42
  attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;
43
43
  }
44
+ const browserMeta = this.metas.value.browser;
45
+ if (isArray(browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.brands)) {
46
+ attributes[ATTR_BROWSER_BRANDS] = browserMeta.brands.map((entry) => entry.brand);
47
+ }
48
+ if (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.language) {
49
+ attributes[ATTR_BROWSER_LANGUAGE] = browserMeta.language;
50
+ }
51
+ if (typeof (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.mobile) === 'boolean') {
52
+ attributes[ATTR_BROWSER_MOBILE] = Boolean(browserMeta.mobile);
53
+ }
54
+ if (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.os) {
55
+ attributes[ATTR_BROWSER_PLATFORM] = browserMeta.os;
56
+ }
57
+ if (browserMeta === null || browserMeta === void 0 ? void 0 : browserMeta.userAgent) {
58
+ attributes[ATTR_USER_AGENT_ORIGINAL] = browserMeta.userAgent;
59
+ }
60
+ attributes[ATTR_PROCESS_RUNTIME_NAME] = 'browser';
61
+ attributes[ATTR_PROCESS_RUNTIME_VERSION] = (_a = this.metas.value.browser) === null || _a === void 0 ? void 0 : _a.userAgent;
62
+ attributes[ATTR_TELEMETRY_DISTRO_NAME] = 'faro-web-sdk';
63
+ attributes[ATTR_TELEMETRY_DISTRO_VERSION] = VERSION;
44
64
  Object.assign(attributes, options.resourceAttributes);
45
65
  const resource = defaultResource().merge(resourceFromAttributes(attributes));
46
66
  const provider = new WebTracerProvider({
@@ -53,19 +73,19 @@ export class TracingInstrumentation extends BaseInstrumentation {
53
73
  },
54
74
  },
55
75
  spanProcessors: [
56
- (_a = options.spanProcessor) !== null && _a !== void 0 ? _a : new FaroUserActionSpanProcessor(new FaroMetaAttributesSpanProcessor(new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {
76
+ (_b = options.spanProcessor) !== null && _b !== void 0 ? _b : new FaroUserActionSpanProcessor(new FaroMetaAttributesSpanProcessor(new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {
57
77
  scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,
58
78
  maxExportBatchSize: 30,
59
79
  }), this.metas)),
60
80
  ],
61
81
  });
62
82
  provider.register({
63
- propagator: (_b = options.propagator) !== null && _b !== void 0 ? _b : new W3CTraceContextPropagator(),
83
+ propagator: (_c = options.propagator) !== null && _c !== void 0 ? _c : new W3CTraceContextPropagator(),
64
84
  contextManager: options.contextManager,
65
85
  });
66
- const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } = (_c = this.options.instrumentationOptions) !== null && _c !== void 0 ? _c : {};
86
+ const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } = (_d = this.options.instrumentationOptions) !== null && _d !== void 0 ? _d : {};
67
87
  registerInstrumentations({
68
- instrumentations: (_d = options.instrumentations) !== null && _d !== void 0 ? _d : getDefaultOTELInstrumentations({
88
+ instrumentations: (_e = options.instrumentations) !== null && _e !== void 0 ? _e : getDefaultOTELInstrumentations({
69
89
  ignoreUrls: this.getIgnoreUrls(),
70
90
  propagateTraceHeaderCorsUrls,
71
91
  fetchInstrumentationOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"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","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport type { Attributes } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { defaultResource, resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\n\nimport { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';\nimport type { Transport } from '@grafana/faro-web-sdk';\n\nimport { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { FaroUserActionSpanProcessor } from './faroUserActionSpanProcessor';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport { ATTR_DEPLOYMENT_ENVIRONMENT_NAME, ATTR_SERVICE_NAMESPACE } from './semconv';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: Attributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = defaultResource().merge(resourceFromAttributes(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n spanProcessors: [\n options.spanProcessor ??\n new FaroUserActionSpanProcessor(\n new FaroMetaAttributesSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n )\n ),\n ],\n });\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager,\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"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","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport type { Attributes } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { defaultResource, resourceFromAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n ATTR_USER_AGENT_ORIGINAL,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\n\nimport { BaseInstrumentation, isArray, VERSION } from '@grafana/faro-web-sdk';\nimport type { Transport } from '@grafana/faro-web-sdk';\n\nimport { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { FaroUserActionSpanProcessor } from './faroUserActionSpanProcessor';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport {\n ATTR_BROWSER_BRANDS,\n ATTR_BROWSER_LANGUAGE,\n ATTR_BROWSER_MOBILE,\n ATTR_BROWSER_PLATFORM,\n ATTR_DEPLOYMENT_ENVIRONMENT_NAME,\n ATTR_PROCESS_RUNTIME_NAME,\n ATTR_PROCESS_RUNTIME_VERSION,\n ATTR_SERVICE_NAMESPACE,\n ATTR_TELEMETRY_DISTRO_NAME,\n ATTR_TELEMETRY_DISTRO_VERSION,\n} from './semconv';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: Attributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n const browserMeta = this.metas.value.browser;\n\n if (isArray(browserMeta?.brands)) {\n attributes[ATTR_BROWSER_BRANDS] = browserMeta.brands.map((entry) => entry.brand);\n }\n\n if (browserMeta?.language) {\n attributes[ATTR_BROWSER_LANGUAGE] = browserMeta.language;\n }\n\n if (typeof browserMeta?.mobile === 'boolean') {\n attributes[ATTR_BROWSER_MOBILE] = Boolean(browserMeta.mobile);\n }\n\n if (browserMeta?.os) {\n attributes[ATTR_BROWSER_PLATFORM] = browserMeta.os;\n }\n\n if (browserMeta?.userAgent) {\n attributes[ATTR_USER_AGENT_ORIGINAL] = browserMeta.userAgent;\n }\n\n attributes[ATTR_PROCESS_RUNTIME_NAME] = 'browser';\n attributes[ATTR_PROCESS_RUNTIME_VERSION] = this.metas.value.browser?.userAgent;\n\n attributes[ATTR_TELEMETRY_DISTRO_NAME] = 'faro-web-sdk';\n attributes[ATTR_TELEMETRY_DISTRO_VERSION] = VERSION;\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = defaultResource().merge(resourceFromAttributes(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n spanProcessors: [\n options.spanProcessor ??\n new FaroUserActionSpanProcessor(\n new FaroMetaAttributesSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n )\n ),\n ],\n });\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager,\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
@@ -9,4 +9,15 @@
9
9
  export const ATTR_SESSION_ID = 'session.id';
10
10
  export const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';
11
11
  export const ATTR_SERVICE_NAMESPACE = 'service.namespace';
12
+ // https://opentelemetry.io/docs/specs/semconv/resource/process/#javascript-runtimes
13
+ export const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';
14
+ export const ATTR_PROCESS_RUNTIME_VERSION = 'process.runtime.version';
15
+ // https://opentelemetry.io/docs/specs/semconv/attributes-registry/telemetry/#telemetry-attributes
16
+ export const ATTR_TELEMETRY_DISTRO_NAME = 'telemetry.distro.name';
17
+ export const ATTR_TELEMETRY_DISTRO_VERSION = 'telemetry.distro.version';
18
+ // https://opentelemetry.io/docs/specs/semconv/resource/browser/
19
+ export const ATTR_BROWSER_BRANDS = 'browser.brands';
20
+ export const ATTR_BROWSER_LANGUAGE = 'browser.language';
21
+ export const ATTR_BROWSER_MOBILE = 'browser.mobile';
22
+ export const ATTR_BROWSER_PLATFORM = 'browser.platform';
12
23
  //# sourceMappingURL=semconv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAC5C,MAAM,CAAC,MAAM,gCAAgC,GAAG,6BAA6B,CAAC;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC","sourcesContent":["/**\n Unstable SemConv\n Because the \"incubating\" entry-point may include breaking changes in minor versions,\n it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,\n but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)\n \n See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating\n */\n\nexport const ATTR_SESSION_ID = 'session.id';\nexport const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';\nexport const ATTR_SERVICE_NAMESPACE = 'service.namespace';\n"]}
1
+ {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAC5C,MAAM,CAAC,MAAM,gCAAgC,GAAG,6BAA6B,CAAC;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,oFAAoF;AACpF,MAAM,CAAC,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAyB,CAAC;AAEtE,kGAAkG;AAClG,MAAM,CAAC,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAClE,MAAM,CAAC,MAAM,6BAA6B,GAAG,0BAA0B,CAAC;AAExE,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC","sourcesContent":["/**\n Unstable SemConv\n Because the \"incubating\" entry-point may include breaking changes in minor versions,\n it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,\n but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)\n \n See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating\n */\n\nexport const ATTR_SESSION_ID = 'session.id';\nexport const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';\nexport const ATTR_SERVICE_NAMESPACE = 'service.namespace';\n\n// https://opentelemetry.io/docs/specs/semconv/resource/process/#javascript-runtimes\nexport const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';\nexport const ATTR_PROCESS_RUNTIME_VERSION = 'process.runtime.version';\n\n// https://opentelemetry.io/docs/specs/semconv/attributes-registry/telemetry/#telemetry-attributes\nexport const ATTR_TELEMETRY_DISTRO_NAME = 'telemetry.distro.name';\nexport const ATTR_TELEMETRY_DISTRO_VERSION = 'telemetry.distro.version';\n\n// https://opentelemetry.io/docs/specs/semconv/resource/browser/\nexport const ATTR_BROWSER_BRANDS = 'browser.brands';\nexport const ATTR_BROWSER_LANGUAGE = 'browser.language';\nexport const ATTR_BROWSER_MOBILE = 'browser.mobile';\nexport const ATTR_BROWSER_PLATFORM = 'browser.platform';\n"]}
@@ -9,3 +9,11 @@
9
9
  export declare const ATTR_SESSION_ID = "session.id";
10
10
  export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
11
11
  export declare const ATTR_SERVICE_NAMESPACE = "service.namespace";
12
+ export declare const ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name";
13
+ export declare const ATTR_PROCESS_RUNTIME_VERSION = "process.runtime.version";
14
+ export declare const ATTR_TELEMETRY_DISTRO_NAME = "telemetry.distro.name";
15
+ export declare const ATTR_TELEMETRY_DISTRO_VERSION = "telemetry.distro.version";
16
+ export declare const ATTR_BROWSER_BRANDS = "browser.brands";
17
+ export declare const ATTR_BROWSER_LANGUAGE = "browser.language";
18
+ export declare const ATTR_BROWSER_MOBILE = "browser.mobile";
19
+ export declare const ATTR_BROWSER_PLATFORM = "browser.platform";
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@grafana/faro-web-tracing",
3
- "version": "1.18.1",
3
+ "version": "1.19.0",
4
4
  "description": "Faro web tracing implementation.",
5
- "engines": {
6
- "node": ">=18.0.0"
7
- },
8
5
  "keywords": [
9
6
  "observability",
10
7
  "apm",
@@ -35,34 +32,34 @@
35
32
  ],
36
33
  "scripts": {
37
34
  "start": "yarn watch",
38
- "build": "run-s build:*",
39
- "build:compile": "run-p build:compile:*",
35
+ "build": "run-s 'build:*'",
36
+ "build:compile": "run-p 'build:compile:*'",
40
37
  "build:compile:cjs": "tsc --build tsconfig.cjs.json",
41
38
  "build:compile:esm": "tsc --build tsconfig.esm.json",
42
- "build:compile:bundle": "run-s build:compile:bundle:*",
39
+ "build:compile:bundle": "run-s 'build:compile:bundle:*'",
43
40
  "build:compile:bundle:create": "rollup -c ./rollup.config.js",
44
41
  "build:compile:bundle:remove-extras": "rimraf dist/bundle/dist",
45
42
  "watch": "run-s watch:compile",
46
43
  "watch:compile": "yarn build:compile:cjs -w",
47
44
  "clean": "rimraf dist/ yarn-error.log",
48
- "quality": "run-s quality:*",
45
+ "quality": "run-s 'quality:*'",
49
46
  "quality:test": "jest",
50
47
  "quality:format": "prettier --cache --cache-location=../../.cache/prettier/webTracing --ignore-path ../../.prettierignore -w \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
51
- "quality:lint": "run-s quality:lint:*",
48
+ "quality:lint": "run-s 'quality:lint:*'",
52
49
  "quality:lint:eslint": "eslint --cache --cache-location ../../.cache/eslint/webTracing --ignore-path ../../.eslintignore \"./**/*.{js,jsx,ts,tsx}\"",
53
50
  "quality:lint:prettier": "prettier --cache --cache-location=../../.cache/prettier/webTracing --ignore-path ../../.prettierignore -c \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
54
51
  "quality:lint:md": "markdownlint README.md",
55
52
  "quality:circular-deps": "madge --circular ."
56
53
  },
57
54
  "dependencies": {
58
- "@grafana/faro-web-sdk": "^1.18.1",
55
+ "@grafana/faro-web-sdk": "^1.19.0",
59
56
  "@opentelemetry/api": "^1.9.0",
60
57
  "@opentelemetry/core": "^2.0.0",
61
- "@opentelemetry/exporter-trace-otlp-http": "^0.200.0",
62
- "@opentelemetry/instrumentation": "^0.200.0",
63
- "@opentelemetry/instrumentation-fetch": "^0.200.0",
64
- "@opentelemetry/instrumentation-xml-http-request": "^0.200.0",
65
- "@opentelemetry/otlp-transformer": "^0.200.0",
58
+ "@opentelemetry/exporter-trace-otlp-http": "^0.202.0",
59
+ "@opentelemetry/instrumentation": "^0.202.0",
60
+ "@opentelemetry/instrumentation-fetch": "^0.202.0",
61
+ "@opentelemetry/instrumentation-xml-http-request": "^0.202.0",
62
+ "@opentelemetry/otlp-transformer": "^0.202.0",
66
63
  "@opentelemetry/resources": "^2.0.0",
67
64
  "@opentelemetry/sdk-trace-web": "^2.0.0",
68
65
  "@opentelemetry/semantic-conventions": "^1.32.0"
@@ -70,5 +67,5 @@
70
67
  "publishConfig": {
71
68
  "access": "public"
72
69
  },
73
- "gitHead": "027478310001ab2dd3ae1a27f083c74c1f04e098"
70
+ "gitHead": "ffae80438840da07851a0d6da1e0414c24c04165"
74
71
  }