@vercel/otel 1.0.1 → 1.1.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.
- package/dist/edge/index.js +1 -1
- package/dist/edge/index.js.map +2 -2
- package/dist/node/index.js +3 -3
- package/dist/node/index.js.map +2 -2
- package/package.json +1 -1
package/dist/edge/index.js
CHANGED
|
@@ -14,5 +14,5 @@ var Pl=Object.create;var kr=Object.defineProperty;var xl=Object.getOwnPropertyDe
|
|
|
14
14
|
To resolve the conflict:`,Rn(a,n))),i=r):y.diag.warn("A view or instrument with the name ",n.name,` has already been registered and is incompatible with another registered view.
|
|
15
15
|
`,`Details:
|
|
16
16
|
`,xn(a,n),`To resolve the conflict:
|
|
17
|
-
`,Rn(a,n))}}catch(s){c={error:s}}finally{try{t&&!t.done&&(l=e.return)&&l.call(e)}finally{if(c)throw c.error}}return i},u}();var Ra=function(){function u(n){this._backingStorages=n}return u.prototype.record=function(n,o,c,l){this._backingStorages.forEach(function(i){i.record(n,o,c,l)})},u}();S();S();var La=function(){function u(n,o){this._instrumentName=n,this._valueType=o,this._buffer=new et}return u.prototype.observe=function(n,o){if(o===void 0&&(o={}),typeof n!="number"){y.diag.warn("non-number value provided to metric "+this._instrumentName+": "+n);return}this._valueType===y.ValueType.INT&&!Number.isInteger(n)&&(y.diag.warn("INT value type cannot accept a floating-point value for "+this._instrumentName+", ignoring the fractional digits."),n=Math.trunc(n),!Number.isInteger(n))||this._buffer.set(o,n)},u}();var Ia=function(){function u(){this._buffer=new Map}return u.prototype.observe=function(n,o,c){if(c===void 0&&(c={}),!!de(n)){var l=this._buffer.get(n);if(l==null&&(l=new et,this._buffer.set(n,l)),typeof o!="number"){y.diag.warn("non-number value provided to metric "+n._descriptor.name+": "+o);return}n._descriptor.valueType===y.ValueType.INT&&!Number.isInteger(o)&&(y.diag.warn("INT value type cannot accept a floating-point value for "+n._descriptor.name+", ignoring the fractional digits."),o=Math.trunc(o),!Number.isInteger(o))||l.set(c,o)}},u}();var In=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},wn=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},wa=function(u,n){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var c=o.call(u),l,i=[],e;try{for(;(n===void 0||n-- >0)&&!(l=c.next()).done;)i.push(l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return i},Ca=function(u,n,o){if(o||arguments.length===2)for(var c=0,l=n.length,i;c<l;c++)(i||!(c in n))&&(i||(i=Array.prototype.slice.call(n,0,c)),i[c]=n[c]);return u.concat(i||Array.prototype.slice.call(n))},Ua=function(){function u(){this._callbacks=[],this._batchCallbacks=[]}return u.prototype.addCallback=function(n,o){var c=this._findCallback(n,o);c>=0||this._callbacks.push({callback:n,instrument:o})},u.prototype.removeCallback=function(n,o){var c=this._findCallback(n,o);c<0||this._callbacks.splice(c,1)},u.prototype.addBatchCallback=function(n,o){var c=new Set(o.filter(de));if(c.size===0){y.diag.error("BatchObservableCallback is not associated with valid instruments",o);return}var l=this._findBatchCallback(n,c);l>=0||this._batchCallbacks.push({callback:n,instruments:c})},u.prototype.removeBatchCallback=function(n,o){var c=new Set(o.filter(de)),l=this._findBatchCallback(n,c);l<0||this._batchCallbacks.splice(l,1)},u.prototype.observe=function(n,o){return In(this,void 0,void 0,function(){var c,l,i,e;return wn(this,function(t){switch(t.label){case 0:return c=this._observeCallbacks(n,o),l=this._observeBatchCallbacks(n,o),[4,sa(Ca(Ca([],wa(c),!1),wa(l),!1))];case 1:return i=t.sent(),e=i.filter(fa).map(function(r){return r.reason}),[2,e]}})})},u.prototype._observeCallbacks=function(n,o){var c=this;return this._callbacks.map(function(l){var i=l.callback,e=l.instrument;return In(c,void 0,void 0,function(){var t,r;return wn(this,function(a){switch(a.label){case 0:return t=new La(e._descriptor.name,e._descriptor.valueType),r=Promise.resolve(i(t)),o!=null&&(r=An(r,o)),[4,r];case 1:return a.sent(),e._metricStorages.forEach(function(s){s.record(t._buffer,n)}),[2]}})})})},u.prototype._observeBatchCallbacks=function(n,o){var c=this;return this._batchCallbacks.map(function(l){var i=l.callback,e=l.instruments;return In(c,void 0,void 0,function(){var t,r;return wn(this,function(a){switch(a.label){case 0:return t=new Ia,r=Promise.resolve(i(t)),o!=null&&(r=An(r,o)),[4,r];case 1:return a.sent(),e.forEach(function(s){var d=t._buffer.get(s);d!=null&&s._metricStorages.forEach(function(v){v.record(d,n)})}),[2]}})})})},u.prototype._findCallback=function(n,o){return this._callbacks.findIndex(function(c){return c.callback===n&&c.instrument===o})},u.prototype._findBatchCallback=function(n,o){return this._batchCallbacks.findIndex(function(c){return c.callback===n&&pa(c.instruments,o)})},u}();var pf=function(){var u=function(n,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,l){c.__proto__=l}||function(c,l){for(var i in l)Object.prototype.hasOwnProperty.call(l,i)&&(c[i]=l[i])},u(n,o)};return function(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(n,o);function c(){this.constructor=n}n.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Ma=function(u){pf(n,u);function n(o,c,l,i){var e=u.call(this,o)||this;return e._attributesProcessor=l,e._deltaMetricStorage=new dr(c),e._temporalMetricStorage=new yr(c,i),e}return n.prototype.record=function(o,c,l,i){c=this._attributesProcessor.process(c,l),this._deltaMetricStorage.record(o,c,l,i)},n.prototype.collect=function(o,c){var l=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(o,this._instrumentDescriptor,l,c)},n}(pr);var Da=function(){var u=function(n,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,l){c.__proto__=l}||function(c,l){for(var i in l)Object.prototype.hasOwnProperty.call(l,i)&&(c[i]=l[i])},u(n,o)};return function(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(n,o);function c(){this.constructor=n}n.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),hr=function(){function u(){}return u.Noop=function(){return yf},u}();var df=function(u){Da(n,u);function n(){return u!==null&&u.apply(this,arguments)||this}return n.prototype.process=function(o,c){return o},n}(hr);var Hh=function(u){Da(n,u);function n(o){var c=u.call(this)||this;return c._allowedAttributeNames=o,c}return n.prototype.process=function(o,c){var l=this,i={};return Object.keys(o).filter(function(e){return l._allowedAttributeNames.includes(e)}).forEach(function(e){return i[e]=o[e]}),i},n}(hr);var yf=new df;var hf=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},mf=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},vf=function(u,n){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var c=o.call(u),l,i=[],e;try{for(;(n===void 0||n-- >0)&&!(l=c.next()).done;)i.push(l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return i},Ba=function(){function u(n,o){this._meterProviderSharedState=n,this._instrumentationScope=o,this.metricStorageRegistry=new xa,this.observableRegistry=new Ua,this.meter=new ga(this)}return u.prototype.registerMetricStorage=function(n){var o=this._registerMetricStorage(n,Ma);return o.length===1?o[0]:new Ra(o)},u.prototype.registerAsyncMetricStorage=function(n){var o=this._registerMetricStorage(n,Pa);return o},u.prototype.collect=function(n,o,c){return hf(this,void 0,void 0,function(){var l,i,e;return mf(this,function(t){switch(t.label){case 0:return[4,this.observableRegistry.observe(o,c?.timeoutMillis)];case 1:return l=t.sent(),i=this.metricStorageRegistry.getStorages(n),i.length===0?[2,null]:(e=i.map(function(r){return r.collect(n,o)}).filter(ua),e.length===0?[2,{errors:l}]:[2,{scopeMetrics:{scope:this._instrumentationScope,metrics:e},errors:l}])}})})},u.prototype._registerMetricStorage=function(n,o){var c=this,l=this._meterProviderSharedState.viewRegistry.findViews(n,this._instrumentationScope),i=l.map(function(r){var a=ya(r,n),s=c.metricStorageRegistry.findOrUpdateCompatibleStorage(a);if(s!=null)return s;var d=r.aggregation.createAggregator(a),v=new o(a,d,r.attributesProcessor,c._meterProviderSharedState.metricCollectors);return c.metricStorageRegistry.register(v),v});if(i.length===0){var e=this._meterProviderSharedState.selectAggregations(n.type),t=e.map(function(r){var a=vf(r,2),s=a[0],d=a[1],v=c.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(s,n);if(v!=null)return v;var b=d.createAggregator(n),g=new o(n,b,hr.Noop(),[s]);return c.metricStorageRegistry.registerForCollector(s,g),g});i=i.concat(t)}return i},u}();var _f=function(u){var n=typeof Symbol=="function"&&Symbol.iterator,o=n&&u[n],c=0;if(o)return o.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&c>=u.length&&(u=void 0),{value:u&&u[c++],done:!u}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},ka=function(){function u(n){this.resource=n,this.viewRegistry=new ma,this.metricCollectors=[],this.meterSharedStates=new Map}return u.prototype.getMeterSharedState=function(n){var o=ca(n),c=this.meterSharedStates.get(o);return c==null&&(c=new Ba(this,n),this.meterSharedStates.set(o,c)),c},u.prototype.selectAggregations=function(n){var o,c,l=[];try{for(var i=_f(this.metricCollectors),e=i.next();!e.done;e=i.next()){var t=e.value;l.push([t,t.selectAggregation(n)])}}catch(r){o={error:r}}finally{try{e&&!e.done&&(c=i.return)&&c.call(i)}finally{if(o)throw o.error}}return l},u}();var Va=N(U()),mr=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},vr=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Ef=function(u,n){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var c=o.call(u),l,i=[],e;try{for(;(n===void 0||n-- >0)&&!(l=c.next()).done;)i.push(l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return i},bf=function(u,n,o){if(o||arguments.length===2)for(var c=0,l=n.length,i;c<l;c++)(i||!(c in n))&&(i||(i=Array.prototype.slice.call(n,0,c)),i[c]=n[c]);return u.concat(i||Array.prototype.slice.call(n))},Ga=function(){function u(n,o){this._sharedState=n,this._metricReader=o}return u.prototype.collect=function(n){return mr(this,void 0,void 0,function(){var o,c,l,i,e=this;return vr(this,function(t){switch(t.label){case 0:return o=(0,Va.millisToHrTime)(Date.now()),c=[],l=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(function(r){return mr(e,void 0,void 0,function(){var a;return vr(this,function(s){switch(s.label){case 0:return[4,r.collect(this,o,n)];case 1:return a=s.sent(),a?.scopeMetrics!=null&&c.push(a.scopeMetrics),a?.errors!=null&&l.push.apply(l,bf([],Ef(a.errors),!1)),[2]}})})}),[4,Promise.all(i)];case 1:return t.sent(),[2,{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:c},errors:l}]}})})},u.prototype.forceFlush=function(n){return mr(this,void 0,void 0,function(){return vr(this,function(o){switch(o.label){case 0:return[4,this._metricReader.forceFlush(n)];case 1:return o.sent(),[2]}})})},u.prototype.shutdown=function(n){return mr(this,void 0,void 0,function(){return vr(this,function(o){switch(o.label){case 0:return[4,this._metricReader.shutdown(n)];case 1:return o.sent(),[2]}})})},u.prototype.selectAggregationTemporality=function(n){return this._metricReader.selectAggregationTemporality(n)},u.prototype.selectAggregation=function(n){return this._metricReader.selectAggregation(n)},u}();var Ha=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},ja=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Sf=function(u){var n=typeof Symbol=="function"&&Symbol.iterator,o=n&&u[n],c=0;if(o)return o.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&c>=u.length&&(u=void 0),{value:u&&u[c++],done:!u}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Cn=function(){function u(n){var o,c,l;this._shutdown=!1;var i=K.default().merge((l=n?.resource)!==null&&l!==void 0?l:K.empty());if(this._sharedState=new ka(i),n?.views!=null&&n.views.length>0)try{for(var e=Sf(n.views),t=e.next();!t.done;t=e.next()){var r=t.value;this._sharedState.viewRegistry.addView(r)}}catch(a){o={error:a}}finally{try{t&&!t.done&&(c=e.return)&&c.call(e)}finally{if(o)throw o.error}}}return u.prototype.getMeter=function(n,o,c){return o===void 0&&(o=""),c===void 0&&(c={}),this._shutdown?(y.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,y.createNoopMeter)()):this._sharedState.getMeterSharedState({name:n,version:o,schemaUrl:c.schemaUrl}).meter},u.prototype.addMetricReader=function(n){var o=new Ga(this._sharedState,n);n.setMetricProducer(o),this._sharedState.metricCollectors.push(o)},u.prototype.shutdown=function(n){return Ha(this,void 0,void 0,function(){return ja(this,function(o){switch(o.label){case 0:return this._shutdown?(y.diag.warn("shutdown may only be called once per MeterProvider"),[2]):(this._shutdown=!0,[4,Promise.all(this._sharedState.metricCollectors.map(function(c){return c.shutdown(n)}))]);case 1:return o.sent(),[2]}})})},u.prototype.forceFlush=function(n){return Ha(this,void 0,void 0,function(){return ja(this,function(o){switch(o.label){case 0:return this._shutdown?(y.diag.warn("invalid attempt to force flush after MeterProvider shutdown"),[2]):[4,Promise.all(this._sharedState.metricCollectors.map(function(c){return c.forceFlush(n)}))];case 1:return o.sent(),[2]}})})},u}();var Sl=N(_t(),1),ie=N(Le(),1),Tl=N(Xa(),1),it=N(U(),1);S();var Pf=Symbol.for("@vercel/request-context");function br(){return globalThis[Pf]?.get()}var Dn=N(_t(),1);function Sr(u){return Object.fromEntries(Object.entries(u).filter(([n,o])=>o!==void 0))}function Ya(u){return u?u.split("::").at(-1):void 0}function Ja(u=br()){if(u)return Sr({[Dn.SemanticAttributes.HTTP_HOST]:u.headers.host,[Dn.SemanticAttributes.HTTP_USER_AGENT]:u.headers["user-agent"],"http.referer":u.headers.referer,"vercel.request_id":Ya(u.headers["x-vercel-id"]),"vercel.matched_path":u.headers["x-matched-path"],"vercel.edge_region":u.headers["x-vercel-edge-region"]})}var Tr=class{constructor(n){this.processors=n;this.rootSpanIds=new Map}forceFlush(){return Promise.all(this.processors.map(n=>n.forceFlush().catch(o=>{y.diag.error("forceFlush failed:",o)}))).then(()=>{})}shutdown(){return Promise.all(this.processors.map(n=>n.shutdown().catch(()=>{}))).then(()=>{})}onStart(n,o){let{traceId:c,spanId:l,traceFlags:i}=n.spanContext(),e=!n.parentSpanId||!this.rootSpanIds.has(c);if(e&&this.rootSpanIds.set(c,l),e&&xf(i)){let t=Ja();t&&n.setAttributes(t);let r=br();r&&r.waitUntil(()=>this.forceFlush())}for(let t of this.processors)t.onStart(n,o)}onEnd(n){let{traceId:o,spanId:c}=n.spanContext();this.rootSpanIds.get(o)===c&&this.rootSpanIds.delete(o);for(let i of this.processors)i.onEnd(n)}};function xf(u){return(u&y.TraceFlags.SAMPLED)!==0}var uu=N(Fn(),1);var au=N(Nr(),1);S();var Wt=class extends au.OTLPExporterBase{constructor(n={}){super(n),n.headers&&(this._headers=n.headers)}onShutdown(){y.diag.debug("[OTLPExporterEdgeBase] onShutdown")}onInit(){y.diag.debug("[OTLPExporterEdgeBase] onInit")}send(n,o,c){if(this._shutdownOnce.isCalled){y.diag.debug("[OTLPExporterEdgeBase] Shutdown already started. Cannot send objects");return}let l=this.convert(n),i,e,t;try{({body:i,contentType:e,headers:t}=this.toMessage(l))}catch(a){y.diag.warn("[OTLPExporterProtoEdgeBase] no proto",a);return}let r=fetch(this.url,{method:"POST",body:i,headers:{...this._headers,...t,"Content-Type":e},next:{internal:!0}}).then(a=>{y.diag.debug("[OTLPExporterEdgeBase] onSuccess",a.status,a.statusText),o()}).catch(a=>{y.diag.error("[OTLPExporterEdgeBase] onError",a),c(a)}).finally(()=>{let a=this._sendingPromises.indexOf(r);this._sendingPromises.splice(a,1)});this._sendingPromises.push(r)}getDefaultUrl(n){throw new Error("Method not implemented.")}};var zf="v1/traces",Wf=`http://localhost:4318/${zf}`;function Pr(u){return typeof u.url=="string"?u.url:Wf}var $t=class extends Wt{convert(n){return(0,uu.createExportTraceServiceRequest)(n,{useHex:!0})}toMessage(n){return{body:JSON.stringify(n),contentType:"application/json"}}getDefaultUrl(n){return Pr(n)}};var hl=N(Fn(),1),ml=N(yl(),1),vl=N(po(),1);var Vt=class extends Wt{convert(n){return(0,hl.createExportTraceServiceRequest)(n,{useHex:!0})}toMessage(n){let o=ml.ServiceClientType.SPANS,c=(0,vl.getExportRequestProto)(o),l=c.create(n);return{body:c.encode(l).finish(),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(n){return Pr(n)}};S();var Rt=N(_t(),1),ne=class{constructor(n={}){this.instrumentationName="@vercel/otel/fetch";this.instrumentationVersion="1.0.0";this.config=n}getConfig(){return this.config}setConfig(){}setTracerProvider(n){this.tracerProvider=n}setMeterProvider(){}enable(){this.disable();let{tracerProvider:n}=this;if(!n)return;let o=n.getTracer(this.instrumentationName,this.instrumentationVersion),c=this.config.ignoreUrls??[],l=d=>{if(c.length===0)return!1;let v=d.toString();return c.some(b=>typeof b=="string"?v.startsWith(b):b.test(v))},i=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,e=this.config.propagateContextUrls??[],t=this.config.dontPropagateContextUrls??[],r=d=>{let v=d.toString();return t.length>0&&t.some(b=>typeof b=="string"?v.startsWith(b):b.test(v))?!1:i&&d.protocol==="https:"&&d.host===i?!0:e.some(b=>typeof b=="string"?v.startsWith(b):b.test(v))};process.env.NEXT_OTEL_FETCH_DISABLED="1";let a=globalThis.fetch;this.originalFetch=a;let s=(d,v)=>{if(v?.next?.internal)return a(d,v);let b=new Request(d,v),g=new URL(b.url);return l(g)?a(d,v):o.startActiveSpan(`fetch ${b.method} ${b.url}`,{kind:y.SpanKind.CLIENT,attributes:{[Rt.SemanticAttributes.HTTP_METHOD]:b.method,[Rt.SemanticAttributes.HTTP_URL]:b.url,[Rt.SemanticAttributes.HTTP_HOST]:g.host,[Rt.SemanticAttributes.HTTP_SCHEME]:g.protocol.replace(":",""),[Rt.SemanticAttributes.NET_PEER_NAME]:g.hostname,[Rt.SemanticAttributes.NET_PEER_PORT]:g.port}},async k=>{r(g)&&y.propagation.inject(y.context.active(),b.headers,Op);try{let V=await a(b);return k.setAttribute(Rt.SemanticAttributes.HTTP_STATUS_CODE,V.status),V.status>=500&&k.setStatus({code:y.SpanStatusCode.ERROR,message:`Status: ${V.status} (${V.statusText})`}),k.end(),V}catch(V){throw V instanceof Error?(k.recordException(V),k.setStatus({code:y.SpanStatusCode.ERROR,message:V.message})):k.setStatus({code:y.SpanStatusCode.ERROR,message:String(V)}),k.end(),V}})};globalThis.fetch=s}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},Op={set(u,n,o){u.set(n,o)}};var Br=class{constructor(n={}){this.configuration=n}start(){let n=gp(),o=(0,ie.getEnvWithoutDefaults)(),c=this.configuration,l=!!n.OTEL_SDK_DISABLED;if(o.OTEL_LOG_LEVEL&&y.diag.setLogger(new y.DiagConsoleLogger,{logLevel:o.OTEL_LOG_LEVEL}),l)return;let i=c.idGenerator??new ir,e=c.contextManager??new Tl.AsyncLocalStorageContextManager;e.enable(),this.contextManager=e;let t=n.OTEL_SERVICE_NAME||c.serviceName||"app",r=new K(Sr({[Sl.SemanticResourceAttributes.SERVICE_NAME]:t,"node.ci":process.env.CI?!0:void 0,"node.env":"production","vercel.env":process.env.VERCEL_ENV||process.env.NEXT_PUBLIC_VERCEL_ENV,"vercel.region":process.env.VERCEL_REGION,"vercel.runtime":process.env.NEXT_RUNTIME,"vercel.sha":process.env.VERCEL_GIT_COMMIT_SHA||process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,"vercel.host":process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||void 0,...c.attributes})),a=c.resourceDetectors??[ki];if(c.autoDetectResources??!0){let H={detectors:a};r=r.merge(Gi(H))}let d=Np(c.propagators,n),v=Pp(c.traceSampler,n),b=xp(c.spanProcessors,c,n);b.length===0&&y.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let g=c.spanLimits,k=new qi({resource:r,idGenerator:i,sampler:v,spanLimits:g});if(k.addSpanProcessor(new Tr(b)),k.register({contextManager:e,propagator:new it.CompositePropagator({propagators:d})}),this.tracerProvider=k,c.logRecordProcessor){let H=new gn({resource:r});this.loggerProvider=H,H.addLogRecordProcessor(c.logRecordProcessor),st.logs.setGlobalLoggerProvider(H)}if(c.metricReader||c.views){let H=new Cn({resource:r,views:c.views??[]});c.metricReader&&H.addMetricReader(c.metricReader),y.metrics.setGlobalMeterProvider(H),this.meterProvider=H}let V=Ap(c.instrumentations,c.instrumentationConfig);this.disableInstumentations=(0,bl.registerInstrumentations)({instrumentations:V}),y.diag.info("@vercel/otel: started",t,process.env.NEXT_RUNTIME)}async shutdown(){let n=[];this.tracerProvider&&n.push(this.tracerProvider.shutdown()),this.loggerProvider&&n.push(this.loggerProvider.shutdown()),this.meterProvider&&n.push(this.meterProvider.shutdown()),y.diag.info("@vercel/otel: shutting down",n.length,process.env.NEXT_RUNTIME),await Promise.all(n),this.contextManager&&this.contextManager.disable();let{disableInstumentations:o}=this;o&&o()}};function gp(){let u=(0,ie.parseEnvironment)(process.env);return{...ie.DEFAULT_ENVIRONMENT,...u}}function Ap(u,n){return(u??["auto"]).map(o=>o==="auto"?(y.diag.debug("@vercel/otel: Configure instrumentations: fetch",n?.fetch),[new ne(n?.fetch)]):o==="fetch"?(y.diag.debug("@vercel/otel: Configure instrumentations: fetch",n?.fetch),new ne(n?.fetch)):o).flat()}function Np(u,n){let o=n.OTEL_PROPAGATORS&&n.OTEL_PROPAGATORS.length>0?n.OTEL_PROPAGATORS:void 0;return(u??o??["auto"]).map(c=>{if(c==="none")return[];if(c==="auto")return y.diag.debug("@vercel/otel: Configure propagators: tracecontext, baggage"),[new it.W3CTraceContextPropagator,new it.W3CBaggagePropagator];if(c==="tracecontext")return y.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new it.W3CTraceContextPropagator;if(c==="baggage")return y.diag.debug("@vercel/otel: Configure propagator: baggage"),new it.W3CBaggagePropagator;if(typeof c=="string")throw new Error(`Unknown propagator: "${c}"`);return c}).flat()}var _l="always_on",oe=1;function Pp(u,n){if(u&&typeof u!="string")return u;let o=u&&u!=="auto"?u:n.OTEL_TRACES_SAMPLER||_l;switch(y.diag.debug("@vercel/otel: Configure sampler: ",o),o){case"always_on":return new z;case"always_off":return new ct;case"parentbased_always_on":return new bt({root:new z});case"parentbased_always_off":return new bt({root:new ct});case"traceidratio":return new qt(El(n));case"parentbased_traceidratio":return new bt({root:new qt(El(n))});default:return y.diag.error(`OTEL_TRACES_SAMPLER value "${String(n.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${_l}".`),new z}}function El(u){if(u.OTEL_TRACES_SAMPLER_ARG===void 0||u.OTEL_TRACES_SAMPLER_ARG==="")return y.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${oe}.`),oe;y.diag.debug("@vercel/otel: Configure sampler probability: ",u.OTEL_TRACES_SAMPLER_ARG);let n=Number(u.OTEL_TRACES_SAMPLER_ARG);return isNaN(n)?(y.diag.error(`OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${oe}.`),oe):n<0||n>1?(y.diag.error(`OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${oe}.`),oe):n}function xp(u,n,o){return(u??["auto"]).map(c=>{if(c==="auto"){if(process.env.VERCEL_OTEL_ENDPOINTS){let l=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",i=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";y.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",l,i);let e={url:`http://localhost:${l}/v1/traces`,headers:{}},t=i==="http/protobuf"?new Vt(e):new $t(e);return new pe(t)}return n.traceExporter||o.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||o.OTEL_EXPORTER_OTLP_ENDPOINT?new pe(Rp(n.traceExporter,o)):void 0}return c}).filter(wp)}function Rp(u,n){if(u&&u!=="auto")return u;let o=n.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??n.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",c=Ip(n),l={...it.baggageUtils.parseKeyPairsIntoRecord(n.OTEL_EXPORTER_OTLP_HEADERS),...it.baggageUtils.parseKeyPairsIntoRecord(n.OTEL_EXPORTER_OTLP_TRACES_HEADERS)};switch(y.diag.debug("@vercel/otel: Configure trace exporter: ",o,c,`headers: ${Object.keys(l).join(",")||"<none>"}`),o){case"http/json":return new $t({url:c,headers:l});case"http/protobuf":return new Vt({url:c,headers:l});default:return y.diag.warn(`Unsupported OTLP traces protocol: ${o}. Using http/protobuf.`),new Vt}}var Ol="v1/traces",Lp=`http://localhost:4318/${Ol}`;function Ip(u){let n=u.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;if(n&&typeof n=="string")return n;let o=u.OTEL_EXPORTER_OTLP_ENDPOINT;return o&&typeof o=="string"?`${o}/${Ol}`:Lp}function wp(u){return u!=null}function Rv(u){let n;u?typeof u=="string"?n={serviceName:u}:n=u:n={},new Br(n).start()}export{ne as FetchInstrumentation,$t as OTLPHttpJsonTraceExporter,Vt as OTLPHttpProtoTraceExporter,Rv as registerOTel};
|
|
17
|
+
`,Rn(a,n))}}catch(s){c={error:s}}finally{try{t&&!t.done&&(l=e.return)&&l.call(e)}finally{if(c)throw c.error}}return i},u}();var Ra=function(){function u(n){this._backingStorages=n}return u.prototype.record=function(n,o,c,l){this._backingStorages.forEach(function(i){i.record(n,o,c,l)})},u}();S();S();var La=function(){function u(n,o){this._instrumentName=n,this._valueType=o,this._buffer=new et}return u.prototype.observe=function(n,o){if(o===void 0&&(o={}),typeof n!="number"){y.diag.warn("non-number value provided to metric "+this._instrumentName+": "+n);return}this._valueType===y.ValueType.INT&&!Number.isInteger(n)&&(y.diag.warn("INT value type cannot accept a floating-point value for "+this._instrumentName+", ignoring the fractional digits."),n=Math.trunc(n),!Number.isInteger(n))||this._buffer.set(o,n)},u}();var Ia=function(){function u(){this._buffer=new Map}return u.prototype.observe=function(n,o,c){if(c===void 0&&(c={}),!!de(n)){var l=this._buffer.get(n);if(l==null&&(l=new et,this._buffer.set(n,l)),typeof o!="number"){y.diag.warn("non-number value provided to metric "+n._descriptor.name+": "+o);return}n._descriptor.valueType===y.ValueType.INT&&!Number.isInteger(o)&&(y.diag.warn("INT value type cannot accept a floating-point value for "+n._descriptor.name+", ignoring the fractional digits."),o=Math.trunc(o),!Number.isInteger(o))||l.set(c,o)}},u}();var In=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},wn=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},wa=function(u,n){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var c=o.call(u),l,i=[],e;try{for(;(n===void 0||n-- >0)&&!(l=c.next()).done;)i.push(l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return i},Ca=function(u,n,o){if(o||arguments.length===2)for(var c=0,l=n.length,i;c<l;c++)(i||!(c in n))&&(i||(i=Array.prototype.slice.call(n,0,c)),i[c]=n[c]);return u.concat(i||Array.prototype.slice.call(n))},Ua=function(){function u(){this._callbacks=[],this._batchCallbacks=[]}return u.prototype.addCallback=function(n,o){var c=this._findCallback(n,o);c>=0||this._callbacks.push({callback:n,instrument:o})},u.prototype.removeCallback=function(n,o){var c=this._findCallback(n,o);c<0||this._callbacks.splice(c,1)},u.prototype.addBatchCallback=function(n,o){var c=new Set(o.filter(de));if(c.size===0){y.diag.error("BatchObservableCallback is not associated with valid instruments",o);return}var l=this._findBatchCallback(n,c);l>=0||this._batchCallbacks.push({callback:n,instruments:c})},u.prototype.removeBatchCallback=function(n,o){var c=new Set(o.filter(de)),l=this._findBatchCallback(n,c);l<0||this._batchCallbacks.splice(l,1)},u.prototype.observe=function(n,o){return In(this,void 0,void 0,function(){var c,l,i,e;return wn(this,function(t){switch(t.label){case 0:return c=this._observeCallbacks(n,o),l=this._observeBatchCallbacks(n,o),[4,sa(Ca(Ca([],wa(c),!1),wa(l),!1))];case 1:return i=t.sent(),e=i.filter(fa).map(function(r){return r.reason}),[2,e]}})})},u.prototype._observeCallbacks=function(n,o){var c=this;return this._callbacks.map(function(l){var i=l.callback,e=l.instrument;return In(c,void 0,void 0,function(){var t,r;return wn(this,function(a){switch(a.label){case 0:return t=new La(e._descriptor.name,e._descriptor.valueType),r=Promise.resolve(i(t)),o!=null&&(r=An(r,o)),[4,r];case 1:return a.sent(),e._metricStorages.forEach(function(s){s.record(t._buffer,n)}),[2]}})})})},u.prototype._observeBatchCallbacks=function(n,o){var c=this;return this._batchCallbacks.map(function(l){var i=l.callback,e=l.instruments;return In(c,void 0,void 0,function(){var t,r;return wn(this,function(a){switch(a.label){case 0:return t=new Ia,r=Promise.resolve(i(t)),o!=null&&(r=An(r,o)),[4,r];case 1:return a.sent(),e.forEach(function(s){var d=t._buffer.get(s);d!=null&&s._metricStorages.forEach(function(v){v.record(d,n)})}),[2]}})})})},u.prototype._findCallback=function(n,o){return this._callbacks.findIndex(function(c){return c.callback===n&&c.instrument===o})},u.prototype._findBatchCallback=function(n,o){return this._batchCallbacks.findIndex(function(c){return c.callback===n&&pa(c.instruments,o)})},u}();var pf=function(){var u=function(n,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,l){c.__proto__=l}||function(c,l){for(var i in l)Object.prototype.hasOwnProperty.call(l,i)&&(c[i]=l[i])},u(n,o)};return function(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(n,o);function c(){this.constructor=n}n.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Ma=function(u){pf(n,u);function n(o,c,l,i){var e=u.call(this,o)||this;return e._attributesProcessor=l,e._deltaMetricStorage=new dr(c),e._temporalMetricStorage=new yr(c,i),e}return n.prototype.record=function(o,c,l,i){c=this._attributesProcessor.process(c,l),this._deltaMetricStorage.record(o,c,l,i)},n.prototype.collect=function(o,c){var l=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(o,this._instrumentDescriptor,l,c)},n}(pr);var Da=function(){var u=function(n,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,l){c.__proto__=l}||function(c,l){for(var i in l)Object.prototype.hasOwnProperty.call(l,i)&&(c[i]=l[i])},u(n,o)};return function(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(n,o);function c(){this.constructor=n}n.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),hr=function(){function u(){}return u.Noop=function(){return yf},u}();var df=function(u){Da(n,u);function n(){return u!==null&&u.apply(this,arguments)||this}return n.prototype.process=function(o,c){return o},n}(hr);var Hh=function(u){Da(n,u);function n(o){var c=u.call(this)||this;return c._allowedAttributeNames=o,c}return n.prototype.process=function(o,c){var l=this,i={};return Object.keys(o).filter(function(e){return l._allowedAttributeNames.includes(e)}).forEach(function(e){return i[e]=o[e]}),i},n}(hr);var yf=new df;var hf=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},mf=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},vf=function(u,n){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var c=o.call(u),l,i=[],e;try{for(;(n===void 0||n-- >0)&&!(l=c.next()).done;)i.push(l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return i},Ba=function(){function u(n,o){this._meterProviderSharedState=n,this._instrumentationScope=o,this.metricStorageRegistry=new xa,this.observableRegistry=new Ua,this.meter=new ga(this)}return u.prototype.registerMetricStorage=function(n){var o=this._registerMetricStorage(n,Ma);return o.length===1?o[0]:new Ra(o)},u.prototype.registerAsyncMetricStorage=function(n){var o=this._registerMetricStorage(n,Pa);return o},u.prototype.collect=function(n,o,c){return hf(this,void 0,void 0,function(){var l,i,e;return mf(this,function(t){switch(t.label){case 0:return[4,this.observableRegistry.observe(o,c?.timeoutMillis)];case 1:return l=t.sent(),i=this.metricStorageRegistry.getStorages(n),i.length===0?[2,null]:(e=i.map(function(r){return r.collect(n,o)}).filter(ua),e.length===0?[2,{errors:l}]:[2,{scopeMetrics:{scope:this._instrumentationScope,metrics:e},errors:l}])}})})},u.prototype._registerMetricStorage=function(n,o){var c=this,l=this._meterProviderSharedState.viewRegistry.findViews(n,this._instrumentationScope),i=l.map(function(r){var a=ya(r,n),s=c.metricStorageRegistry.findOrUpdateCompatibleStorage(a);if(s!=null)return s;var d=r.aggregation.createAggregator(a),v=new o(a,d,r.attributesProcessor,c._meterProviderSharedState.metricCollectors);return c.metricStorageRegistry.register(v),v});if(i.length===0){var e=this._meterProviderSharedState.selectAggregations(n.type),t=e.map(function(r){var a=vf(r,2),s=a[0],d=a[1],v=c.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(s,n);if(v!=null)return v;var b=d.createAggregator(n),g=new o(n,b,hr.Noop(),[s]);return c.metricStorageRegistry.registerForCollector(s,g),g});i=i.concat(t)}return i},u}();var _f=function(u){var n=typeof Symbol=="function"&&Symbol.iterator,o=n&&u[n],c=0;if(o)return o.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&c>=u.length&&(u=void 0),{value:u&&u[c++],done:!u}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},ka=function(){function u(n){this.resource=n,this.viewRegistry=new ma,this.metricCollectors=[],this.meterSharedStates=new Map}return u.prototype.getMeterSharedState=function(n){var o=ca(n),c=this.meterSharedStates.get(o);return c==null&&(c=new Ba(this,n),this.meterSharedStates.set(o,c)),c},u.prototype.selectAggregations=function(n){var o,c,l=[];try{for(var i=_f(this.metricCollectors),e=i.next();!e.done;e=i.next()){var t=e.value;l.push([t,t.selectAggregation(n)])}}catch(r){o={error:r}}finally{try{e&&!e.done&&(c=i.return)&&c.call(i)}finally{if(o)throw o.error}}return l},u}();var Va=N(U()),mr=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},vr=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Ef=function(u,n){var o=typeof Symbol=="function"&&u[Symbol.iterator];if(!o)return u;var c=o.call(u),l,i=[],e;try{for(;(n===void 0||n-- >0)&&!(l=c.next()).done;)i.push(l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(e)throw e.error}}return i},bf=function(u,n,o){if(o||arguments.length===2)for(var c=0,l=n.length,i;c<l;c++)(i||!(c in n))&&(i||(i=Array.prototype.slice.call(n,0,c)),i[c]=n[c]);return u.concat(i||Array.prototype.slice.call(n))},Ga=function(){function u(n,o){this._sharedState=n,this._metricReader=o}return u.prototype.collect=function(n){return mr(this,void 0,void 0,function(){var o,c,l,i,e=this;return vr(this,function(t){switch(t.label){case 0:return o=(0,Va.millisToHrTime)(Date.now()),c=[],l=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(function(r){return mr(e,void 0,void 0,function(){var a;return vr(this,function(s){switch(s.label){case 0:return[4,r.collect(this,o,n)];case 1:return a=s.sent(),a?.scopeMetrics!=null&&c.push(a.scopeMetrics),a?.errors!=null&&l.push.apply(l,bf([],Ef(a.errors),!1)),[2]}})})}),[4,Promise.all(i)];case 1:return t.sent(),[2,{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:c},errors:l}]}})})},u.prototype.forceFlush=function(n){return mr(this,void 0,void 0,function(){return vr(this,function(o){switch(o.label){case 0:return[4,this._metricReader.forceFlush(n)];case 1:return o.sent(),[2]}})})},u.prototype.shutdown=function(n){return mr(this,void 0,void 0,function(){return vr(this,function(o){switch(o.label){case 0:return[4,this._metricReader.shutdown(n)];case 1:return o.sent(),[2]}})})},u.prototype.selectAggregationTemporality=function(n){return this._metricReader.selectAggregationTemporality(n)},u.prototype.selectAggregation=function(n){return this._metricReader.selectAggregation(n)},u}();var Ha=function(u,n,o,c){function l(i){return i instanceof o?i:new o(function(e){e(i)})}return new(o||(o=Promise))(function(i,e){function t(s){try{a(c.next(s))}catch(d){e(d)}}function r(s){try{a(c.throw(s))}catch(d){e(d)}}function a(s){s.done?i(s.value):l(s.value).then(t,r)}a((c=c.apply(u,n||[])).next())})},ja=function(u,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},c,l,i,e;return e={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e;function t(a){return function(s){return r([a,s])}}function r(a){if(c)throw new TypeError("Generator is already executing.");for(;o;)try{if(c=1,l&&(i=a[0]&2?l.return:a[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,a[1])).done)return i;switch(l=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,l=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=n.call(u,o)}catch(s){a=[6,s],l=0}finally{c=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Sf=function(u){var n=typeof Symbol=="function"&&Symbol.iterator,o=n&&u[n],c=0;if(o)return o.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&c>=u.length&&(u=void 0),{value:u&&u[c++],done:!u}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Cn=function(){function u(n){var o,c,l;this._shutdown=!1;var i=K.default().merge((l=n?.resource)!==null&&l!==void 0?l:K.empty());if(this._sharedState=new ka(i),n?.views!=null&&n.views.length>0)try{for(var e=Sf(n.views),t=e.next();!t.done;t=e.next()){var r=t.value;this._sharedState.viewRegistry.addView(r)}}catch(a){o={error:a}}finally{try{t&&!t.done&&(c=e.return)&&c.call(e)}finally{if(o)throw o.error}}}return u.prototype.getMeter=function(n,o,c){return o===void 0&&(o=""),c===void 0&&(c={}),this._shutdown?(y.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,y.createNoopMeter)()):this._sharedState.getMeterSharedState({name:n,version:o,schemaUrl:c.schemaUrl}).meter},u.prototype.addMetricReader=function(n){var o=new Ga(this._sharedState,n);n.setMetricProducer(o),this._sharedState.metricCollectors.push(o)},u.prototype.shutdown=function(n){return Ha(this,void 0,void 0,function(){return ja(this,function(o){switch(o.label){case 0:return this._shutdown?(y.diag.warn("shutdown may only be called once per MeterProvider"),[2]):(this._shutdown=!0,[4,Promise.all(this._sharedState.metricCollectors.map(function(c){return c.shutdown(n)}))]);case 1:return o.sent(),[2]}})})},u.prototype.forceFlush=function(n){return Ha(this,void 0,void 0,function(){return ja(this,function(o){switch(o.label){case 0:return this._shutdown?(y.diag.warn("invalid attempt to force flush after MeterProvider shutdown"),[2]):[4,Promise.all(this._sharedState.metricCollectors.map(function(c){return c.forceFlush(n)}))];case 1:return o.sent(),[2]}})})},u}();var Sl=N(_t(),1),ie=N(Le(),1),Tl=N(Xa(),1),it=N(U(),1);S();var Pf=Symbol.for("@vercel/request-context");function br(){return globalThis[Pf]?.get()}var Dn=N(_t(),1);function Sr(u){return Object.fromEntries(Object.entries(u).filter(([n,o])=>o!==void 0))}function Ya(u){return u?u.split("::").at(-1):void 0}function Ja(u=br()){if(u)return Sr({[Dn.SemanticAttributes.HTTP_HOST]:u.headers.host,[Dn.SemanticAttributes.HTTP_USER_AGENT]:u.headers["user-agent"],"http.referer":u.headers.referer,"vercel.request_id":Ya(u.headers["x-vercel-id"]),"vercel.matched_path":u.headers["x-matched-path"],"vercel.edge_region":u.headers["x-vercel-edge-region"]})}var Tr=class{constructor(n){this.processors=n;this.rootSpanIds=new Map}forceFlush(){return Promise.all(this.processors.map(n=>n.forceFlush().catch(o=>{y.diag.error("forceFlush failed:",o)}))).then(()=>{})}shutdown(){return Promise.all(this.processors.map(n=>n.shutdown().catch(()=>{}))).then(()=>{})}onStart(n,o){let{traceId:c,spanId:l,traceFlags:i}=n.spanContext(),e=!n.parentSpanId||!this.rootSpanIds.has(c);if(e&&this.rootSpanIds.set(c,l),e&&xf(i)){let t=Ja();t&&n.setAttributes(t);let r=br();r&&r.waitUntil(()=>this.forceFlush())}for(let t of this.processors)t.onStart(n,o)}onEnd(n){let{traceId:o,spanId:c}=n.spanContext();this.rootSpanIds.get(o)===c&&this.rootSpanIds.delete(o);for(let i of this.processors)i.onEnd(n)}};function xf(u){return(u&y.TraceFlags.SAMPLED)!==0}var uu=N(Fn(),1);var au=N(Nr(),1);S();var Wt=class extends au.OTLPExporterBase{constructor(n={}){super(n),n.headers&&(this._headers=n.headers)}onShutdown(){y.diag.debug("[OTLPExporterEdgeBase] onShutdown")}onInit(){y.diag.debug("[OTLPExporterEdgeBase] onInit")}send(n,o,c){if(this._shutdownOnce.isCalled){y.diag.debug("[OTLPExporterEdgeBase] Shutdown already started. Cannot send objects");return}let l=this.convert(n),i,e,t;try{({body:i,contentType:e,headers:t}=this.toMessage(l))}catch(a){y.diag.warn("[OTLPExporterProtoEdgeBase] no proto",a);return}let r=fetch(this.url,{method:"POST",body:i,headers:{...this._headers,...t,"Content-Type":e},next:{internal:!0}}).then(a=>{y.diag.debug("[OTLPExporterEdgeBase] onSuccess",a.status,a.statusText),o()}).catch(a=>{y.diag.error("[OTLPExporterEdgeBase] onError",a),c(a)}).finally(()=>{let a=this._sendingPromises.indexOf(r);this._sendingPromises.splice(a,1)});this._sendingPromises.push(r)}getDefaultUrl(n){throw new Error("Method not implemented.")}};var zf="v1/traces",Wf=`http://localhost:4318/${zf}`;function Pr(u){return typeof u.url=="string"?u.url:Wf}var $t=class extends Wt{convert(n){return(0,uu.createExportTraceServiceRequest)(n,{useHex:!0})}toMessage(n){return{body:JSON.stringify(n),contentType:"application/json"}}getDefaultUrl(n){return Pr(n)}};var hl=N(Fn(),1),ml=N(yl(),1),vl=N(po(),1);var Vt=class extends Wt{convert(n){return(0,hl.createExportTraceServiceRequest)(n,{useHex:!0})}toMessage(n){let o=ml.ServiceClientType.SPANS,c=(0,vl.getExportRequestProto)(o),l=c.create(n);return{body:c.encode(l).finish(),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(n){return Pr(n)}};S();var Rt=N(_t(),1),ne=class{constructor(n={}){this.instrumentationName="@vercel/otel/fetch";this.instrumentationVersion="1.0.0";this.config=n}getConfig(){return this.config}setConfig(){}setTracerProvider(n){this.tracerProvider=n}setMeterProvider(){}enable(){this.disable();let{tracerProvider:n}=this;if(!n)return;let o=n.getTracer(this.instrumentationName,this.instrumentationVersion),c=this.config.ignoreUrls??[],l=d=>{if(c.length===0)return!1;let v=d.toString();return c.some(b=>typeof b=="string"?v.startsWith(b):b.test(v))},i=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,e=this.config.propagateContextUrls??[],t=this.config.dontPropagateContextUrls??[],r=d=>{let v=d.toString();return t.length>0&&t.some(b=>typeof b=="string"?v.startsWith(b):b.test(v))?!1:i&&d.protocol==="https:"&&d.host===i?!0:e.some(b=>typeof b=="string"?v.startsWith(b):b.test(v))};process.env.NEXT_OTEL_FETCH_DISABLED="1";let a=globalThis.fetch;this.originalFetch=a;let s=(d,v)=>{if(v?.next?.internal)return a(d,v);let b=new Request(d,v),g=new URL(b.url);return l(g)?a(d,v):o.startActiveSpan(`fetch ${b.method} ${b.url}`,{kind:y.SpanKind.CLIENT,attributes:{[Rt.SemanticAttributes.HTTP_METHOD]:b.method,[Rt.SemanticAttributes.HTTP_URL]:b.url,[Rt.SemanticAttributes.HTTP_HOST]:g.host,[Rt.SemanticAttributes.HTTP_SCHEME]:g.protocol.replace(":",""),[Rt.SemanticAttributes.NET_PEER_NAME]:g.hostname,[Rt.SemanticAttributes.NET_PEER_PORT]:g.port}},async k=>{r(g)&&y.propagation.inject(y.context.active(),b.headers,Op);try{let V=await a(d,{...v,headers:b.headers});return k.setAttribute(Rt.SemanticAttributes.HTTP_STATUS_CODE,V.status),V.status>=500&&k.setStatus({code:y.SpanStatusCode.ERROR,message:`Status: ${V.status} (${V.statusText})`}),k.end(),V}catch(V){throw V instanceof Error?(k.recordException(V),k.setStatus({code:y.SpanStatusCode.ERROR,message:V.message})):k.setStatus({code:y.SpanStatusCode.ERROR,message:String(V)}),k.end(),V}})};globalThis.fetch=s}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},Op={set(u,n,o){u.set(n,o)}};var Br=class{constructor(n={}){this.configuration=n}start(){let n=gp(),o=(0,ie.getEnvWithoutDefaults)(),c=this.configuration,l=!!n.OTEL_SDK_DISABLED;if(o.OTEL_LOG_LEVEL&&y.diag.setLogger(new y.DiagConsoleLogger,{logLevel:o.OTEL_LOG_LEVEL}),l)return;let i=c.idGenerator??new ir,e=c.contextManager??new Tl.AsyncLocalStorageContextManager;e.enable(),this.contextManager=e;let t=n.OTEL_SERVICE_NAME||c.serviceName||"app",r=new K(Sr({[Sl.SemanticResourceAttributes.SERVICE_NAME]:t,"node.ci":process.env.CI?!0:void 0,"node.env":"production","vercel.env":process.env.VERCEL_ENV||process.env.NEXT_PUBLIC_VERCEL_ENV,"vercel.region":process.env.VERCEL_REGION,"vercel.runtime":process.env.NEXT_RUNTIME,"vercel.sha":process.env.VERCEL_GIT_COMMIT_SHA||process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,"vercel.host":process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||void 0,...c.attributes})),a=c.resourceDetectors??[ki];if(c.autoDetectResources??!0){let H={detectors:a};r=r.merge(Gi(H))}let d=Np(c.propagators,n),v=Pp(c.traceSampler,n),b=xp(c.spanProcessors,c,n);b.length===0&&y.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let g=c.spanLimits,k=new qi({resource:r,idGenerator:i,sampler:v,spanLimits:g});if(k.addSpanProcessor(new Tr(b)),k.register({contextManager:e,propagator:new it.CompositePropagator({propagators:d})}),this.tracerProvider=k,c.logRecordProcessor){let H=new gn({resource:r});this.loggerProvider=H,H.addLogRecordProcessor(c.logRecordProcessor),st.logs.setGlobalLoggerProvider(H)}if(c.metricReader||c.views){let H=new Cn({resource:r,views:c.views??[]});c.metricReader&&H.addMetricReader(c.metricReader),y.metrics.setGlobalMeterProvider(H),this.meterProvider=H}let V=Ap(c.instrumentations,c.instrumentationConfig);this.disableInstumentations=(0,bl.registerInstrumentations)({instrumentations:V}),y.diag.info("@vercel/otel: started",t,process.env.NEXT_RUNTIME)}async shutdown(){let n=[];this.tracerProvider&&n.push(this.tracerProvider.shutdown()),this.loggerProvider&&n.push(this.loggerProvider.shutdown()),this.meterProvider&&n.push(this.meterProvider.shutdown()),y.diag.info("@vercel/otel: shutting down",n.length,process.env.NEXT_RUNTIME),await Promise.all(n),this.contextManager&&this.contextManager.disable();let{disableInstumentations:o}=this;o&&o()}};function gp(){let u=(0,ie.parseEnvironment)(process.env);return{...ie.DEFAULT_ENVIRONMENT,...u}}function Ap(u,n){return(u??["auto"]).map(o=>o==="auto"?(y.diag.debug("@vercel/otel: Configure instrumentations: fetch",n?.fetch),[new ne(n?.fetch)]):o==="fetch"?(y.diag.debug("@vercel/otel: Configure instrumentations: fetch",n?.fetch),new ne(n?.fetch)):o).flat()}function Np(u,n){let o=n.OTEL_PROPAGATORS&&n.OTEL_PROPAGATORS.length>0?n.OTEL_PROPAGATORS:void 0;return(u??o??["auto"]).map(c=>{if(c==="none")return[];if(c==="auto")return y.diag.debug("@vercel/otel: Configure propagators: tracecontext, baggage"),[new it.W3CTraceContextPropagator,new it.W3CBaggagePropagator];if(c==="tracecontext")return y.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new it.W3CTraceContextPropagator;if(c==="baggage")return y.diag.debug("@vercel/otel: Configure propagator: baggage"),new it.W3CBaggagePropagator;if(typeof c=="string")throw new Error(`Unknown propagator: "${c}"`);return c}).flat()}var _l="always_on",oe=1;function Pp(u,n){if(u&&typeof u!="string")return u;let o=u&&u!=="auto"?u:n.OTEL_TRACES_SAMPLER||_l;switch(y.diag.debug("@vercel/otel: Configure sampler: ",o),o){case"always_on":return new z;case"always_off":return new ct;case"parentbased_always_on":return new bt({root:new z});case"parentbased_always_off":return new bt({root:new ct});case"traceidratio":return new qt(El(n));case"parentbased_traceidratio":return new bt({root:new qt(El(n))});default:return y.diag.error(`OTEL_TRACES_SAMPLER value "${String(n.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${_l}".`),new z}}function El(u){if(u.OTEL_TRACES_SAMPLER_ARG===void 0||u.OTEL_TRACES_SAMPLER_ARG==="")return y.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${oe}.`),oe;y.diag.debug("@vercel/otel: Configure sampler probability: ",u.OTEL_TRACES_SAMPLER_ARG);let n=Number(u.OTEL_TRACES_SAMPLER_ARG);return isNaN(n)?(y.diag.error(`OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${oe}.`),oe):n<0||n>1?(y.diag.error(`OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${oe}.`),oe):n}function xp(u,n,o){return(u??["auto"]).map(c=>{if(c==="auto"){if(process.env.VERCEL_OTEL_ENDPOINTS){let l=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",i=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";y.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",l,i);let e={url:`http://localhost:${l}/v1/traces`,headers:{}},t=i==="http/protobuf"?new Vt(e):new $t(e);return new pe(t)}return n.traceExporter||o.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||o.OTEL_EXPORTER_OTLP_ENDPOINT?new pe(Rp(n.traceExporter,o)):void 0}return c}).filter(wp)}function Rp(u,n){if(u&&u!=="auto")return u;let o=n.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??n.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",c=Ip(n),l={...it.baggageUtils.parseKeyPairsIntoRecord(n.OTEL_EXPORTER_OTLP_HEADERS),...it.baggageUtils.parseKeyPairsIntoRecord(n.OTEL_EXPORTER_OTLP_TRACES_HEADERS)};switch(y.diag.debug("@vercel/otel: Configure trace exporter: ",o,c,`headers: ${Object.keys(l).join(",")||"<none>"}`),o){case"http/json":return new $t({url:c,headers:l});case"http/protobuf":return new Vt({url:c,headers:l});default:return y.diag.warn(`Unsupported OTLP traces protocol: ${o}. Using http/protobuf.`),new Vt}}var Ol="v1/traces",Lp=`http://localhost:4318/${Ol}`;function Ip(u){let n=u.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;if(n&&typeof n=="string")return n;let o=u.OTEL_EXPORTER_OTLP_ENDPOINT;return o&&typeof o=="string"?`${o}/${Ol}`:Lp}function wp(u){return u!=null}function Rv(u){let n;u?typeof u=="string"?n={serviceName:u}:n=u:n={},new Br(n).start()}export{ne as FetchInstrumentation,$t as OTLPHttpJsonTraceExporter,Vt as OTLPHttpProtoTraceExporter,Rv as registerOTel};
|
|
18
18
|
//# sourceMappingURL=index.js.map
|