@vercel/otel 1.2.0 → 1.2.1-36420893-20240202015332
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 +3 -3
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +3 -3
- package/package.json +1 -1
package/dist/edge/index.js
CHANGED
|
@@ -14,5 +14,5 @@ var Pl=Object.create;var Vr=Object.defineProperty;var xl=Object.getOwnPropertyDe
|
|
|
14
14
|
To resolve the conflict:`,Ln(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
|
`,Rn(a,n),`To resolve the conflict:
|
|
17
|
-
`,Ln(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 La=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 Ia=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 wa=function(){function u(){this._buffer=new Map}return u.prototype.observe=function(n,o,c){if(c===void 0&&(c={}),!!ye(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 wn=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())})},Cn=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}}},Ca=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},Ua=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))},Ma=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(ye));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(ye)),l=this._findBatchCallback(n,c);l<0||this._batchCallbacks.splice(l,1)},u.prototype.observe=function(n,o){return wn(this,void 0,void 0,function(){var c,l,i,e;return Cn(this,function(t){switch(t.label){case 0:return c=this._observeCallbacks(n,o),l=this._observeBatchCallbacks(n,o),[4,fa(Ua(Ua([],Ca(c),!1),Ca(l),!1))];case 1:return i=t.sent(),e=i.filter(pa).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 wn(c,void 0,void 0,function(){var t,r;return Cn(this,function(a){switch(a.label){case 0:return t=new Ia(e._descriptor.name,e._descriptor.valueType),r=Promise.resolve(i(t)),o!=null&&(r=Nn(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 wn(c,void 0,void 0,function(){var t,r;return Cn(this,function(a){switch(a.label){case 0:return t=new wa,r=Promise.resolve(i(t)),o!=null&&(r=Nn(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&&da(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)}}(),Da=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 yr(c),e._temporalMetricStorage=new hr(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}(dr);var Ba=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)}}(),mr=function(){function u(){}return u.Noop=function(){return yf},u}();var df=function(u){Ba(n,u);function n(){return u!==null&&u.apply(this,arguments)||this}return n.prototype.process=function(o,c){return o},n}(mr);var Hh=function(u){Ba(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}(mr);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},ka=function(){function u(n,o){this._meterProviderSharedState=n,this._instrumentationScope=o,this.metricStorageRegistry=new Ra,this.observableRegistry=new Ma,this.meter=new Aa(this)}return u.prototype.registerMetricStorage=function(n){var o=this._registerMetricStorage(n,Da);return o.length===1?o[0]:new La(o)},u.prototype.registerAsyncMetricStorage=function(n){var o=this._registerMetricStorage(n,xa);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(la),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=ha(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,mr.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.")},Va=function(){function u(n){this.resource=n,this.viewRegistry=new va,this.metricCollectors=[],this.meterSharedStates=new Map}return u.prototype.getMeterSharedState=function(n){var o=sa(n),c=this.meterSharedStates.get(o);return c==null&&(c=new ka(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 Ga=N(U()),vr=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())})},_r=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))},Ha=function(){function u(n,o){this._sharedState=n,this._metricReader=o}return u.prototype.collect=function(n){return vr(this,void 0,void 0,function(){var o,c,l,i,e=this;return _r(this,function(t){switch(t.label){case 0:return o=(0,Ga.millisToHrTime)(Date.now()),c=[],l=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(function(r){return vr(e,void 0,void 0,function(){var a;return _r(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 vr(this,void 0,void 0,function(){return _r(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 vr(this,void 0,void 0,function(){return _r(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 ja=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())})},Fa=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.")},Un=function(){function u(n){var o,c,l;this._shutdown=!1;var i=q.default().merge((l=n?.resource)!==null&&l!==void 0?l:q.empty());if(this._sharedState=new Va(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 Ha(this._sharedState,n);n.setMetricProducer(o),this._sharedState.metricCollectors.push(o)},u.prototype.shutdown=function(n){return ja(this,void 0,void 0,function(){return Fa(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 ja(this,void 0,void 0,function(){return Fa(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 Tl=N(Et(),1),ae=N(Ie(),1),Ol=N(Ya(),1),it=N(U(),1);S();var Pf=Symbol.for("@vercel/request-context");function Sr(){return globalThis[Pf]?.get()}var Bn=N(Et(),1);function Tr(u){return Object.fromEntries(Object.entries(u).filter(([n,o])=>o!==void 0))}function Ja(u){return u?u.split("::").at(-1):void 0}function za(u=Sr()){if(u)return Tr({[Bn.SemanticAttributes.HTTP_HOST]:u.headers.host,[Bn.SemanticAttributes.HTTP_USER_AGENT]:u.headers["user-agent"],"http.referer":u.headers.referer,"vercel.request_id":Ja(u.headers["x-vercel-id"]),"vercel.matched_path":u.headers["x-matched-path"],"vercel.edge_region":u.headers["x-vercel-edge-region"]})}var Or=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("@vercel/otel: 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=za();t&&n.setAttributes(t);let r=Sr();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 lu=N(qn(),1);var uu=N(Pr(),1);S();var $t=class extends uu.OTLPExporterBase{constructor(n={}){super(n),n.headers&&(this._headers=n.headers)}onShutdown(){y.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){y.diag.debug("@vercel/otel/otlp: onInit")}send(n,o,c){if(this._shutdownOnce.isCalled){y.diag.debug("@vercel/otel/otlp: 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("@vercel/otel/otlp: no proto",a);return}let r=fetch(this.url,{method:"POST",body:i,headers:{...this._headers,...t,"Content-Type":e,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(a=>{y.diag.debug("@vercel/otel/otlp: onSuccess",a.status,a.statusText),o()}).catch(a=>{y.diag.error("@vercel/otel/otlp: 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 xr(u){return typeof u.url=="string"?u.url:Wf}var Qt=class extends $t{convert(n){return(0,lu.createExportTraceServiceRequest)(n,{useHex:!0,useLongBits:!1})}toMessage(n){return{body:JSON.stringify(n),contentType:"application/json"}}getDefaultUrl(n){return xr(n)}};var ml=N(qn(),1),vl=N(hl(),1),_l=N(yo(),1);var Gt=class extends $t{convert(n){return(0,ml.createExportTraceServiceRequest)(n,void 0)}toMessage(n){let o=vl.ServiceClientType.SPANS,c=(0,_l.getExportRequestProto)(o),l=c.create(n);return{body:c.encode(l).finish(),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(n){return xr(n)}};S();var Lt=N(Et(),1),oe=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:{[Lt.SemanticAttributes.HTTP_METHOD]:b.method,[Lt.SemanticAttributes.HTTP_URL]:b.url,[Lt.SemanticAttributes.HTTP_HOST]:g.host,[Lt.SemanticAttributes.HTTP_SCHEME]:g.protocol.replace(":",""),[Lt.SemanticAttributes.NET_PEER_NAME]:g.hostname,[Lt.SemanticAttributes.NET_PEER_PORT]:g.port}},async G=>{r(g)&&y.propagation.inject(y.context.active(),b.headers,Op);try{let B=await a(d,{...v,headers:b.headers});return G.setAttribute(Lt.SemanticAttributes.HTTP_STATUS_CODE,B.status),B.status>=500&&G.setStatus({code:y.SpanStatusCode.ERROR,message:`Status: ${B.status} (${B.statusText})`}),G.end(),B}catch(B){throw B instanceof Error?(G.recordException(B),G.setStatus({code:y.SpanStatusCode.ERROR,message:B.message})):G.setStatus({code:y.SpanStatusCode.ERROR,message:String(B)}),G.end(),B}})};globalThis.fetch=s}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},Op={set(u,n,o){u.set(n,o)}};var kr=class{constructor(n={}){this.configuration=n}start(){let n=gp(),o=(0,ae.getEnvWithoutDefaults)(),c=this.configuration,l=process.env.NEXT_RUNTIME||"nodejs",i=!!n.OTEL_SDK_DISABLED;if(o.OTEL_LOG_LEVEL&&y.diag.setLogger(new y.DiagConsoleLogger,{logLevel:o.OTEL_LOG_LEVEL}),i)return;let e=c.idGenerator??new ar,t=c.contextManager??new Ol.AsyncLocalStorageContextManager;t.enable(),this.contextManager=t;let r=n.OTEL_SERVICE_NAME||c.serviceName||"app",a=new q(Tr({[Tl.SemanticResourceAttributes.SERVICE_NAME]:r,"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":l,"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})),s=c.resourceDetectors??[Vi];if(c.autoDetectResources??!0){let $={detectors:s};a=a.merge(Hi($))}let v=Np(c.propagators,n),b=Pp(c.traceSampler,n),g=xp(c.spanProcessors,c,n);g.length===0&&y.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let G=c.spanLimits,B=new Ki({resource:a,idGenerator:e,sampler:b,spanLimits:G});if(B.addSpanProcessor(new Or(g)),B.register({contextManager:t,propagator:new it.CompositePropagator({propagators:v})}),this.tracerProvider=B,c.logRecordProcessor){let $=new An({resource:a});this.loggerProvider=$,$.addLogRecordProcessor(c.logRecordProcessor),st.logs.setGlobalLoggerProvider($)}if(c.metricReader||c.views){let $=new Un({resource:a,views:c.views??[]});c.metricReader&&$.addMetricReader(c.metricReader),y.metrics.setGlobalMeterProvider($),this.meterProvider=$}let yt=Ap(c.instrumentations,c.instrumentationConfig);this.disableInstumentations=(0,Sl.registerInstrumentations)({instrumentations:yt}),y.diag.info("@vercel/otel: started",r,l)}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,ae.parseEnvironment)(process.env);return{...ae.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 oe(n?.fetch)]):o==="fetch"?(y.diag.debug("@vercel/otel: Configure instrumentations: fetch",n?.fetch),new oe(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 El="always_on",ie=1;function Pp(u,n){if(u&&typeof u!="string")return u;let o=u&&u!=="auto"?u:n.OTEL_TRACES_SAMPLER||El;switch(y.diag.debug("@vercel/otel: Configure sampler: ",o),o){case"always_on":return new J;case"always_off":return new ct;case"parentbased_always_on":return new St({root:new J});case"parentbased_always_off":return new St({root:new ct});case"traceidratio":return new Kt(bl(n));case"parentbased_traceidratio":return new St({root:new Kt(bl(n))});default:return y.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(n.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${El}".`),new J}}function bl(u){if(u.OTEL_TRACES_SAMPLER_ARG===void 0||u.OTEL_TRACES_SAMPLER_ARG==="")return y.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ie}.`),ie;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(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${ie}.`),ie):n<0||n>1?(y.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${ie}.`),ie):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 Gt(e):new Qt(e);return new de(t)}return n.traceExporter||o.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||o.OTEL_EXPORTER_OTLP_ENDPOINT?new de(Rp(n.traceExporter,o)):void 0}return c}).filter(wp)}function Rp(u,n){if(u&&u!=="auto")return u;let o=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.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 Qt({url:c,headers:l});case"http/protobuf":return new Gt({url:c,headers:l});default:return y.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${o}. Using http/protobuf.`),new Gt}}var gl="v1/traces",Lp=`http://localhost:4318/${gl}`;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}/${gl}`:Lp}function wp(u){return u!=null}function Rv(u){let n;u?typeof u=="string"?n={serviceName:u}:n=u:n={},new kr(n).start()}export{oe as FetchInstrumentation,Qt as OTLPHttpJsonTraceExporter,Gt as OTLPHttpProtoTraceExporter,Rv as registerOTel};
|
|
17
|
+
`,Ln(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 La=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 Ia=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 wa=function(){function u(){this._buffer=new Map}return u.prototype.observe=function(n,o,c){if(c===void 0&&(c={}),!!ye(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 wn=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())})},Cn=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}}},Ca=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},Ua=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))},Ma=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(ye));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(ye)),l=this._findBatchCallback(n,c);l<0||this._batchCallbacks.splice(l,1)},u.prototype.observe=function(n,o){return wn(this,void 0,void 0,function(){var c,l,i,e;return Cn(this,function(t){switch(t.label){case 0:return c=this._observeCallbacks(n,o),l=this._observeBatchCallbacks(n,o),[4,fa(Ua(Ua([],Ca(c),!1),Ca(l),!1))];case 1:return i=t.sent(),e=i.filter(pa).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 wn(c,void 0,void 0,function(){var t,r;return Cn(this,function(a){switch(a.label){case 0:return t=new Ia(e._descriptor.name,e._descriptor.valueType),r=Promise.resolve(i(t)),o!=null&&(r=Nn(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 wn(c,void 0,void 0,function(){var t,r;return Cn(this,function(a){switch(a.label){case 0:return t=new wa,r=Promise.resolve(i(t)),o!=null&&(r=Nn(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&&da(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)}}(),Da=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 yr(c),e._temporalMetricStorage=new hr(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}(dr);var Ba=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)}}(),mr=function(){function u(){}return u.Noop=function(){return yf},u}();var df=function(u){Ba(n,u);function n(){return u!==null&&u.apply(this,arguments)||this}return n.prototype.process=function(o,c){return o},n}(mr);var Hh=function(u){Ba(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}(mr);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},ka=function(){function u(n,o){this._meterProviderSharedState=n,this._instrumentationScope=o,this.metricStorageRegistry=new Ra,this.observableRegistry=new Ma,this.meter=new Aa(this)}return u.prototype.registerMetricStorage=function(n){var o=this._registerMetricStorage(n,Da);return o.length===1?o[0]:new La(o)},u.prototype.registerAsyncMetricStorage=function(n){var o=this._registerMetricStorage(n,xa);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(la),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=ha(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,mr.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.")},Va=function(){function u(n){this.resource=n,this.viewRegistry=new va,this.metricCollectors=[],this.meterSharedStates=new Map}return u.prototype.getMeterSharedState=function(n){var o=sa(n),c=this.meterSharedStates.get(o);return c==null&&(c=new ka(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 Ga=N(U()),vr=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())})},_r=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))},Ha=function(){function u(n,o){this._sharedState=n,this._metricReader=o}return u.prototype.collect=function(n){return vr(this,void 0,void 0,function(){var o,c,l,i,e=this;return _r(this,function(t){switch(t.label){case 0:return o=(0,Ga.millisToHrTime)(Date.now()),c=[],l=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(function(r){return vr(e,void 0,void 0,function(){var a;return _r(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 vr(this,void 0,void 0,function(){return _r(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 vr(this,void 0,void 0,function(){return _r(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 ja=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())})},Fa=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.")},Un=function(){function u(n){var o,c,l;this._shutdown=!1;var i=q.default().merge((l=n?.resource)!==null&&l!==void 0?l:q.empty());if(this._sharedState=new Va(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 Ha(this._sharedState,n);n.setMetricProducer(o),this._sharedState.metricCollectors.push(o)},u.prototype.shutdown=function(n){return ja(this,void 0,void 0,function(){return Fa(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 ja(this,void 0,void 0,function(){return Fa(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 Tl=N(Et(),1),ae=N(Ie(),1),Ol=N(Ya(),1),it=N(U(),1);S();var Pf=Symbol.for("@vercel/request-context");function Sr(){return globalThis[Pf]?.get()}var Bn=N(Et(),1);function Tr(u){return Object.fromEntries(Object.entries(u).filter(([n,o])=>o!==void 0))}function Ja(u){return u?u.split("::").at(-1):void 0}function za(u=Sr()){if(u)return Tr({[Bn.SemanticAttributes.HTTP_HOST]:u.headers.host,[Bn.SemanticAttributes.HTTP_USER_AGENT]:u.headers["user-agent"],"http.referer":u.headers.referer,"vercel.request_id":Ja(u.headers["x-vercel-id"]),"vercel.matched_path":u.headers["x-matched-path"],"vercel.edge_region":u.headers["x-vercel-edge-region"]})}var Or=class{constructor(n){this.processors=n;this.rootSpanIds=new Map;this.waitSpanEnd=new Map}forceFlush(){return Promise.all(this.processors.map(n=>n.forceFlush().catch(o=>{y.diag.error("@vercel/otel: 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=za();t&&n.setAttributes(t);let r=Sr();r&&r.waitUntil(async()=>{if(this.rootSpanIds.has(c)){let a=new Promise(d=>{this.waitSpanEnd.set(c,d)}),s;await Promise.race([a,new Promise(d=>{s=setTimeout(()=>{this.waitSpanEnd.delete(c),d(void 0)},50)})]),s&&clearTimeout(s)}return this.forceFlush()})}for(let t of this.processors)t.onStart(n,o)}onEnd(n){let{traceId:o,spanId:c}=n.spanContext(),l=this.rootSpanIds.get(o)===c;for(let i of this.processors)i.onEnd(n);if(l){this.rootSpanIds.delete(o);let i=this.waitSpanEnd.get(o);i&&(this.waitSpanEnd.delete(o),i())}}};function xf(u){return(u&y.TraceFlags.SAMPLED)!==0}var lu=N(qn(),1);var uu=N(Pr(),1);S();var $t=class extends uu.OTLPExporterBase{constructor(n={}){super(n),n.headers&&(this._headers=n.headers)}onShutdown(){y.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){y.diag.debug("@vercel/otel/otlp: onInit")}send(n,o,c){if(this._shutdownOnce.isCalled){y.diag.debug("@vercel/otel/otlp: 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("@vercel/otel/otlp: no proto",a);return}let r=fetch(this.url,{method:"POST",body:i,headers:{...this._headers,...t,"Content-Type":e,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(a=>{y.diag.debug("@vercel/otel/otlp: onSuccess",a.status,a.statusText),o(),a.arrayBuffer().catch(()=>{})}).catch(a=>{y.diag.error("@vercel/otel/otlp: 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 xr(u){return typeof u.url=="string"?u.url:Wf}var Qt=class extends $t{convert(n){return(0,lu.createExportTraceServiceRequest)(n,{useHex:!0,useLongBits:!1})}toMessage(n){return{body:JSON.stringify(n),contentType:"application/json"}}getDefaultUrl(n){return xr(n)}};var ml=N(qn(),1),vl=N(hl(),1),_l=N(yo(),1);var Gt=class extends $t{convert(n){return(0,ml.createExportTraceServiceRequest)(n,void 0)}toMessage(n){let o=vl.ServiceClientType.SPANS,c=(0,_l.getExportRequestProto)(o),l=c.create(n);return{body:c.encode(l).finish(),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(n){return xr(n)}};S();var Lt=N(Et(),1),oe=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:{[Lt.SemanticAttributes.HTTP_METHOD]:b.method,[Lt.SemanticAttributes.HTTP_URL]:b.url,[Lt.SemanticAttributes.HTTP_HOST]:g.host,[Lt.SemanticAttributes.HTTP_SCHEME]:g.protocol.replace(":",""),[Lt.SemanticAttributes.NET_PEER_NAME]:g.hostname,[Lt.SemanticAttributes.NET_PEER_PORT]:g.port}},async G=>{r(g)&&y.propagation.inject(y.context.active(),b.headers,Op);try{let B=await a(d,{...v,headers:b.headers});return G.setAttribute(Lt.SemanticAttributes.HTTP_STATUS_CODE,B.status),B.status>=500&&G.setStatus({code:y.SpanStatusCode.ERROR,message:`Status: ${B.status} (${B.statusText})`}),G.end(),B}catch(B){throw B instanceof Error?(G.recordException(B),G.setStatus({code:y.SpanStatusCode.ERROR,message:B.message})):G.setStatus({code:y.SpanStatusCode.ERROR,message:String(B)}),G.end(),B}})};globalThis.fetch=s}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},Op={set(u,n,o){u.set(n,o)}};var kr=class{constructor(n={}){this.configuration=n}start(){let n=gp(),o=(0,ae.getEnvWithoutDefaults)(),c=this.configuration,l=process.env.NEXT_RUNTIME||"nodejs",i=!!n.OTEL_SDK_DISABLED;if(o.OTEL_LOG_LEVEL&&y.diag.setLogger(new y.DiagConsoleLogger,{logLevel:o.OTEL_LOG_LEVEL}),i)return;let e=c.idGenerator??new ar,t=c.contextManager??new Ol.AsyncLocalStorageContextManager;t.enable(),this.contextManager=t;let r=n.OTEL_SERVICE_NAME||c.serviceName||"app",a=new q(Tr({[Tl.SemanticResourceAttributes.SERVICE_NAME]:r,"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":l,"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})),s=c.resourceDetectors??[Vi];if(c.autoDetectResources??!0){let $={detectors:s};a=a.merge(Hi($))}let v=Np(c.propagators,n),b=Pp(c.traceSampler,n),g=xp(c.spanProcessors,c,n);g.length===0&&y.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let G=c.spanLimits,B=new Ki({resource:a,idGenerator:e,sampler:b,spanLimits:G});if(B.addSpanProcessor(new Or(g)),B.register({contextManager:t,propagator:new it.CompositePropagator({propagators:v})}),this.tracerProvider=B,c.logRecordProcessor){let $=new An({resource:a});this.loggerProvider=$,$.addLogRecordProcessor(c.logRecordProcessor),st.logs.setGlobalLoggerProvider($)}if(c.metricReader||c.views){let $=new Un({resource:a,views:c.views??[]});c.metricReader&&$.addMetricReader(c.metricReader),y.metrics.setGlobalMeterProvider($),this.meterProvider=$}let yt=Ap(c.instrumentations,c.instrumentationConfig);this.disableInstumentations=(0,Sl.registerInstrumentations)({instrumentations:yt}),y.diag.info("@vercel/otel: started",r,l)}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,ae.parseEnvironment)(process.env);return{...ae.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 oe(n?.fetch)]):o==="fetch"?(y.diag.debug("@vercel/otel: Configure instrumentations: fetch",n?.fetch),new oe(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 El="always_on",ie=1;function Pp(u,n){if(u&&typeof u!="string")return u;let o=u&&u!=="auto"?u:n.OTEL_TRACES_SAMPLER||El;switch(y.diag.debug("@vercel/otel: Configure sampler: ",o),o){case"always_on":return new J;case"always_off":return new ct;case"parentbased_always_on":return new St({root:new J});case"parentbased_always_off":return new St({root:new ct});case"traceidratio":return new Kt(bl(n));case"parentbased_traceidratio":return new St({root:new Kt(bl(n))});default:return y.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(n.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${El}".`),new J}}function bl(u){if(u.OTEL_TRACES_SAMPLER_ARG===void 0||u.OTEL_TRACES_SAMPLER_ARG==="")return y.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ie}.`),ie;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(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${ie}.`),ie):n<0||n>1?(y.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${u.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${ie}.`),ie):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 Gt(e):new Qt(e);return new de(t)}return n.traceExporter||o.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||o.OTEL_EXPORTER_OTLP_ENDPOINT?new de(Rp(n.traceExporter,o)):void 0}return c}).filter(wp)}function Rp(u,n){if(u&&u!=="auto")return u;let o=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.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 Qt({url:c,headers:l});case"http/protobuf":return new Gt({url:c,headers:l});default:return y.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${o}. Using http/protobuf.`),new Gt}}var gl="v1/traces",Lp=`http://localhost:4318/${gl}`;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}/${gl}`:Lp}function wp(u){return u!=null}function Rv(u){let n;u?typeof u=="string"?n={serviceName:u}:n=u:n={},new kr(n).start()}export{oe as FetchInstrumentation,Qt as OTLPHttpJsonTraceExporter,Gt as OTLPHttpProtoTraceExporter,Rv as registerOTel};
|
|
18
18
|
//# sourceMappingURL=index.js.map
|