@grafana/faro-transport-otlp-http 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var GrafanaFaroTransportOtlpHttp=function(e){"use strict";function t(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}var r;function n(e,t){return typeof e===t}"function"==typeof SuppressedError&&SuppressedError,function(e){e.EXCEPTION="exception",e.LOG="log",e.MEASUREMENT="measurement",e.TRACE="trace",e.EVENT="event"}(r||(r={})),r.EXCEPTION,r.LOG,r.MEASUREMENT,r.TRACE,r.EVENT;const o=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),s=e=>!(e=>n(e,"null"))(e)&&n(e,"object"),i=e=>function(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}(e,"Array");var a,l;function u(){}!function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.LOG="log",e.WARN="warn",e.ERROR="error"}(a||(a={})),a.LOG,a.TRACE,a.DEBUG,a.INFO,a.LOG,a.WARN,a.ERROR,function(e){e[e.OFF=0]="OFF",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE"}(l||(l={}));const c={debug:u,error:u,info:u,prefix:"Faro",warn:u};l.ERROR;const d=Object.assign({},console);class g{constructor(){this.unpatchedConsole=d,this.internalLogger=c,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class v extends g{isBatched(){return!1}getIgnoreUrls(){return[]}}const p="2.2.2",f="exception.message",m="exception.type";function h(e){return(e=>n(e,"string"))(e)?{stringValue:e}:(e=>o(e)&&Number.isInteger(e))(e)?{intValue:e}:o(e)?{doubleValue:e}:(e=>n(e,"boolean"))(e)?{boolValue:e}:i(e)?{arrayValue:{values:e.map(h)}}:e instanceof Uint8Array?{bytesValue:e}:s(e)?{kvlistValue:{values:Object.entries(e).map(([e,t])=>b(e,t)).filter(y)}}:{}}function b(e,t){if(null!=t&&""!==t)return{key:e,value:h(t)}}function y(e){return Boolean(e)&&"string"==typeof(null==e?void 0:e.key)&&void 0!==(null==e?void 0:e.value)}function O(e,t){function n(e){return{scope:{name:"@grafana/faro-web-sdk",version:p},logRecords:[o(e)]}}function o(n){const{type:o}=n;switch(o){case r.LOG:return function(e){var t,r;const{meta:n,payload:o}=e,l=i(o.timestamp),u=h(o.message);function c(e){switch(e){case a.TRACE:return{severityNumber:1,severityText:"TRACE"};case a.DEBUG:return{severityNumber:5,severityText:"DEBUG"};case a.INFO:return{severityNumber:9,severityText:"INFO"};case a.LOG:return{severityNumber:10,severityText:"INFO2"};case a.WARN:return{severityNumber:13,severityText:"WARN"};case a.ERROR:return{severityNumber:17,severityText:"ERROR"}}}return Object.assign(Object.assign({timeUnixNano:l},c(o.level)),{body:u,attributes:[...s(n),b("faro.log.context",o.context)].filter(y),traceId:null===(t=o.trace)||void 0===t?void 0:t.trace_id,spanId:null===(r=o.trace)||void 0===r?void 0:r.span_id})}(n);case r.EXCEPTION:return function(e){var r,n;const{meta:o,payload:a}=e,l=i(a.timestamp),u=R(e,null==t?void 0:t.createErrorLogBody);return Object.assign(Object.assign({timeUnixNano:l},u?{body:u}:{}),{attributes:[...s(o),b(m,a.type),b(f,a.value),b("faro.error.stacktrace",a.stacktrace),b("faro.error.context",a.context)].filter(y),traceId:null===(r=a.trace)||void 0===r?void 0:r.trace_id,spanId:null===(n=a.trace)||void 0===n?void 0:n.span_id})}(n);case r.EVENT:return function(e){var t,r;const{meta:n,payload:o}=e,a=i(o.timestamp),l=h(o.name);return{timeUnixNano:a,body:l,attributes:[...s(n),b("event.name",o.name),b("event.domain",o.domain),b("event.attributes",o.attributes)].filter(y),traceId:null===(t=o.trace)||void 0===t?void 0:t.trace_id,spanId:null===(r=o.trace)||void 0===r?void 0:r.span_id}}(n);case r.MEASUREMENT:return function(e){var r,n;const{meta:o,payload:a}=e,l=i(a.timestamp),[u,c]=Object.entries(a.values).flat(),d=R(e,null==t?void 0:t.createMeasurementLogBody);return Object.assign(Object.assign({timeUnixNano:l},d?{body:d}:{}),{attributes:[...s(o),b("measurement.type",a.type),b("measurement.name",u),b("measurement.value",c),b("faro.measurement.context",a.context)].filter(y),traceId:null===(r=a.trace)||void 0===r?void 0:r.trace_id,spanId:null===(n=a.trace)||void 0===n?void 0:n.span_id})}(n);default:return null==e||e.error(`Unknown TransportItemType: ${o}`),{}}}function s(e){const{view:t,page:r,session:n,user:o}=e;return[b("view.name",null==t?void 0:t.name),b("url.full",null==r?void 0:r.url),b("page.id",null==r?void 0:r.id),b("page.attributes",null==r?void 0:r.attributes),b("session.id",null==n?void 0:n.id),b("session.attributes",null==n?void 0:n.attributes),b("user.id",null==o?void 0:o.id),b("user.name",null==o?void 0:o.username),b("user.email",null==o?void 0:o.email),b("user.full_name",null==o?void 0:o.fullName),b("user.roles",null==o?void 0:o.roles),b("user.hash",null==o?void 0:o.hash),b("user.attributes",null==o?void 0:o.attributes)].filter(y)}function i(e){return 1e6*Date.parse(e)}return{toResourceLog:function(e){return{resource:E(e),scopeLogs:[n(e)]}},toScopeLog:n,toLogRecord:o}}function E(e){const{browser:t,sdk:r,app:n}=e.meta;return{attributes:[b("browser.mobile",null==t?void 0:t.mobile),b("user_agent.original",null==t?void 0:t.userAgent),b("browser.language",null==t?void 0:t.language),b("browser.brands",null==t?void 0:t.brands),b("browser.platform",null==t?void 0:t.os),b("browser.name",null==t?void 0:t.name),b("browser.version",null==t?void 0:t.version),b("browser.screen_width",null==t?void 0:t.viewportWidth),b("browser.screen_height",null==t?void 0:t.viewportHeight),b("telemetry.sdk.name",null==r?void 0:r.name),b("telemetry.sdk.version",null==r?void 0:r.version),r?b("telemetry.sdk.language","webjs"):void 0,b("service.name",null==n?void 0:n.name),b("service.version",null==n?void 0:n.version),b("service.namespace",null==n?void 0:n.namespace),b("deployment.environment.name",null==n?void 0:n.environment)].filter(y)}}function R(e,t){return"function"==typeof t?h(t(e)):void 0}class L{constructor({internalLogger:e,customOtlpTransform:t,transportItem:r}){this.resourceSpans=[],this.internalLogger=e,this.resourceLogs=[],this.getLogTransforms=O(this.internalLogger,t),this.getTraceTransforms=(this.internalLogger,{toResourceSpan:function(e){var t,r;const n=E(e),o=null===(r=null===(t=e.payload.resourceSpans)||void 0===t?void 0:t[0])||void 0===r?void 0:r.scopeSpans;return{resource:n,scopeSpans:null!=o?o:[]}}}),r&&this.addResourceItem(r)}getPayload(){return{resourceLogs:this.resourceLogs,resourceSpans:this.resourceSpans}}addResourceItem(e){var t,n,o,s;const{type:i}=e;try{switch(i){case r.LOG:case r.EXCEPTION:case r.EVENT:case r.MEASUREMENT:{const{toLogRecord:r,toResourceLog:o}=this.getLogTransforms;0===this.resourceLogs.length?this.resourceLogs=[o(e)]:null===(n=null===(t=this.resourceLogs[0])||void 0===t?void 0:t.scopeLogs[0])||void 0===n||n.logRecords.push(r(e));break}case r.TRACE:{const{toResourceSpan:t}=this.getTraceTransforms;this.resourceSpans.push(t(e));break}default:null===(o=this.internalLogger)||void 0===o||o.error(`Unknown TransportItemType: ${i}`)}}catch(e){null===(s=this.internalLogger)||void 0===s||s.error(e)}}}return e.OtlpHttpTransport=class extends v{constructor(e){var t,r,n;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-otlp-http",this.version=p,this.sendingTracesDisabledUntil=new Date,this.sendingLogsDisabledUntil=new Date,this.rateLimitBackoffMs=null!==(t=e.defaultRateLimitBackoffMs)&&void 0!==t?t:5e3,this.promiseBuffer=function(e){const{size:t,concurrency:r}=e,n=[];let o=0;const s=()=>{if(o<r&&n.length){const{producer:e,resolve:t,reject:r}=n.shift();o++,e().then(e=>{o--,s(),t(e)},e=>{o--,s(),r(e)})}};return{add:e=>{if(n.length+o>=t)throw new Error("Task buffer full");return new Promise((t,r)=>{n.push({producer:e,resolve:t,reject:r}),s()})}}}({size:null!==(r=null==e?void 0:e.bufferSize)&&void 0!==r?r:30,concurrency:null!==(n=null==e?void 0:e.concurrency)&&void 0!==n?n:5})}getIgnoreUrls(){var e;const{tracesURL:t="",logsURL:r=""}=this.options;return[t,r].filter(Boolean).concat(null!==(e=this.config.ignoreUrls)&&void 0!==e?e:[])}isBatched(){return!0}send(e){const t=new L({internalLogger:this.internalLogger,customOtlpTransform:this.options.otlpTransform});e.forEach(e=>t.addResourceItem(e)),this.sendPayload(t.getPayload())}sendPayload(e){try{const{tracesURL:r="",logsURL:n=""}=this.options;for(const[o,s]of Object.entries(e)){if(!(i(s)&&s.length>0))continue;let e,a=e=>{},l="";switch(o){case"resourceSpans":l=r,e=this.sendingTracesDisabledUntil,a=e=>{this.sendingTracesDisabledUntil=e};break;case"resourceLogs":l=n,e=this.sendingLogsDisabledUntil,a=e=>{this.sendingLogsDisabledUntil=e}}if(e&&e>new Date(Date.now()))return void this.logWarn(`Dropping transport item due to too many requests. Backoff until ${e}`);const c=JSON.stringify({[o]:s}),{requestOptions:d,apiKey:g}=this.options,v=null!=d?d:{},{headers:p={}}=v,f=t(v,["headers"]);if(!l)continue;const m={};for(const[e,t]of Object.entries(p))m[e]="function"==typeof t?t():t;this.promiseBuffer.add(()=>fetch(l,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},m),g?{"x-api-key":g}:{}),body:c,keepalive:c.length<=6e4},null!=f?f:{})).then(t=>(429===t.status&&(a(this.getRetryAfterDate(t)),this.logWarn(`Too many requests, backing off until ${e}`)),t.text().catch(u),t)).catch(e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(c),e)}))}}catch(e){this.logError(e)}}getRetryAfterDate(e){const t=Date.now(),r=e.headers.get("Retry-After");if(r){const e=Number(r);if(!isNaN(e))return new Date(1e3*e+t);const n=Date.parse(r);if(!isNaN(n))return new Date(n)}return new Date(t+this.rateLimitBackoffMs)}},e}({});
1
+ var GrafanaFaroTransportOtlpHttp=function(e){"use strict";function t(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}var r;function n(e,t){return typeof e===t}"function"==typeof SuppressedError&&SuppressedError,function(e){e.EXCEPTION="exception",e.LOG="log",e.MEASUREMENT="measurement",e.TRACE="trace",e.EVENT="event"}(r||(r={})),r.EXCEPTION,r.LOG,r.MEASUREMENT,r.TRACE,r.EVENT;const o=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),s=e=>!(e=>n(e,"null"))(e)&&n(e,"object"),i=e=>function(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}(e,"Array");var a,l;function u(){}!function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.LOG="log",e.WARN="warn",e.ERROR="error"}(a||(a={})),a.LOG,a.TRACE,a.DEBUG,a.INFO,a.LOG,a.WARN,a.ERROR,function(e){e[e.OFF=0]="OFF",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE"}(l||(l={}));const c={debug:u,error:u,info:u,prefix:"Faro",warn:u};l.ERROR;const d=Object.assign({},console);class g{constructor(){this.unpatchedConsole=d,this.internalLogger=c,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class v extends g{isBatched(){return!1}getIgnoreUrls(){return[]}}const p="2.2.3",f="exception.message",m="exception.type";function h(e){return(e=>n(e,"string"))(e)?{stringValue:e}:(e=>o(e)&&Number.isInteger(e))(e)?{intValue:e}:o(e)?{doubleValue:e}:(e=>n(e,"boolean"))(e)?{boolValue:e}:i(e)?{arrayValue:{values:e.map(h)}}:e instanceof Uint8Array?{bytesValue:e}:s(e)?{kvlistValue:{values:Object.entries(e).map(([e,t])=>b(e,t)).filter(y)}}:{}}function b(e,t){if(null!=t&&""!==t)return{key:e,value:h(t)}}function y(e){return Boolean(e)&&"string"==typeof(null==e?void 0:e.key)&&void 0!==(null==e?void 0:e.value)}function O(e,t){function n(e){return{scope:{name:"@grafana/faro-web-sdk",version:p},logRecords:[o(e)]}}function o(n){const{type:o}=n;switch(o){case r.LOG:return function(e){var t,r;const{meta:n,payload:o}=e,l=i(o.timestamp),u=h(o.message);function c(e){switch(e){case a.TRACE:return{severityNumber:1,severityText:"TRACE"};case a.DEBUG:return{severityNumber:5,severityText:"DEBUG"};case a.INFO:return{severityNumber:9,severityText:"INFO"};case a.LOG:return{severityNumber:10,severityText:"INFO2"};case a.WARN:return{severityNumber:13,severityText:"WARN"};case a.ERROR:return{severityNumber:17,severityText:"ERROR"}}}return Object.assign(Object.assign({timeUnixNano:l},c(o.level)),{body:u,attributes:[...s(n),b("faro.log.context",o.context)].filter(y),traceId:null===(t=o.trace)||void 0===t?void 0:t.trace_id,spanId:null===(r=o.trace)||void 0===r?void 0:r.span_id})}(n);case r.EXCEPTION:return function(e){var r,n;const{meta:o,payload:a}=e,l=i(a.timestamp),u=R(e,null==t?void 0:t.createErrorLogBody);return Object.assign(Object.assign({timeUnixNano:l},u?{body:u}:{}),{attributes:[...s(o),b(m,a.type),b(f,a.value),b("faro.error.stacktrace",a.stacktrace),b("faro.error.context",a.context)].filter(y),traceId:null===(r=a.trace)||void 0===r?void 0:r.trace_id,spanId:null===(n=a.trace)||void 0===n?void 0:n.span_id})}(n);case r.EVENT:return function(e){var t,r;const{meta:n,payload:o}=e,a=i(o.timestamp),l=h(o.name);return{timeUnixNano:a,body:l,attributes:[...s(n),b("event.name",o.name),b("event.domain",o.domain),b("event.attributes",o.attributes)].filter(y),traceId:null===(t=o.trace)||void 0===t?void 0:t.trace_id,spanId:null===(r=o.trace)||void 0===r?void 0:r.span_id}}(n);case r.MEASUREMENT:return function(e){var r,n;const{meta:o,payload:a}=e,l=i(a.timestamp),[u,c]=Object.entries(a.values).flat(),d=R(e,null==t?void 0:t.createMeasurementLogBody);return Object.assign(Object.assign({timeUnixNano:l},d?{body:d}:{}),{attributes:[...s(o),b("measurement.type",a.type),b("measurement.name",u),b("measurement.value",c),b("faro.measurement.context",a.context)].filter(y),traceId:null===(r=a.trace)||void 0===r?void 0:r.trace_id,spanId:null===(n=a.trace)||void 0===n?void 0:n.span_id})}(n);default:return null==e||e.error(`Unknown TransportItemType: ${o}`),{}}}function s(e){const{view:t,page:r,session:n,user:o}=e;return[b("view.name",null==t?void 0:t.name),b("url.full",null==r?void 0:r.url),b("page.id",null==r?void 0:r.id),b("page.attributes",null==r?void 0:r.attributes),b("session.id",null==n?void 0:n.id),b("session.attributes",null==n?void 0:n.attributes),b("user.id",null==o?void 0:o.id),b("user.name",null==o?void 0:o.username),b("user.email",null==o?void 0:o.email),b("user.full_name",null==o?void 0:o.fullName),b("user.roles",null==o?void 0:o.roles),b("user.hash",null==o?void 0:o.hash),b("user.attributes",null==o?void 0:o.attributes)].filter(y)}function i(e){return 1e6*Date.parse(e)}return{toResourceLog:function(e){return{resource:E(e),scopeLogs:[n(e)]}},toScopeLog:n,toLogRecord:o}}function E(e){const{browser:t,sdk:r,app:n}=e.meta;return{attributes:[b("browser.mobile",null==t?void 0:t.mobile),b("user_agent.original",null==t?void 0:t.userAgent),b("browser.language",null==t?void 0:t.language),b("browser.brands",null==t?void 0:t.brands),b("browser.platform",null==t?void 0:t.os),b("browser.name",null==t?void 0:t.name),b("browser.version",null==t?void 0:t.version),b("browser.screen_width",null==t?void 0:t.viewportWidth),b("browser.screen_height",null==t?void 0:t.viewportHeight),b("telemetry.sdk.name",null==r?void 0:r.name),b("telemetry.sdk.version",null==r?void 0:r.version),r?b("telemetry.sdk.language","webjs"):void 0,b("service.name",null==n?void 0:n.name),b("service.version",null==n?void 0:n.version),b("service.namespace",null==n?void 0:n.namespace),b("deployment.environment.name",null==n?void 0:n.environment)].filter(y)}}function R(e,t){return"function"==typeof t?h(t(e)):void 0}class L{constructor({internalLogger:e,customOtlpTransform:t,transportItem:r}){this.resourceSpans=[],this.internalLogger=e,this.resourceLogs=[],this.getLogTransforms=O(this.internalLogger,t),this.getTraceTransforms=(this.internalLogger,{toResourceSpan:function(e){var t,r;const n=E(e),o=null===(r=null===(t=e.payload.resourceSpans)||void 0===t?void 0:t[0])||void 0===r?void 0:r.scopeSpans;return{resource:n,scopeSpans:null!=o?o:[]}}}),r&&this.addResourceItem(r)}getPayload(){return{resourceLogs:this.resourceLogs,resourceSpans:this.resourceSpans}}addResourceItem(e){var t,n,o,s;const{type:i}=e;try{switch(i){case r.LOG:case r.EXCEPTION:case r.EVENT:case r.MEASUREMENT:{const{toLogRecord:r,toResourceLog:o}=this.getLogTransforms;0===this.resourceLogs.length?this.resourceLogs=[o(e)]:null===(n=null===(t=this.resourceLogs[0])||void 0===t?void 0:t.scopeLogs[0])||void 0===n||n.logRecords.push(r(e));break}case r.TRACE:{const{toResourceSpan:t}=this.getTraceTransforms;this.resourceSpans.push(t(e));break}default:null===(o=this.internalLogger)||void 0===o||o.error(`Unknown TransportItemType: ${i}`)}}catch(e){null===(s=this.internalLogger)||void 0===s||s.error(e)}}}return e.OtlpHttpTransport=class extends v{constructor(e){var t,r,n;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-otlp-http",this.version=p,this.sendingTracesDisabledUntil=new Date,this.sendingLogsDisabledUntil=new Date,this.rateLimitBackoffMs=null!==(t=e.defaultRateLimitBackoffMs)&&void 0!==t?t:5e3,this.promiseBuffer=function(e){const{size:t,concurrency:r}=e,n=[];let o=0;const s=()=>{if(o<r&&n.length){const{producer:e,resolve:t,reject:r}=n.shift();o++,e().then(e=>{o--,s(),t(e)},e=>{o--,s(),r(e)})}};return{add:e=>{if(n.length+o>=t)throw new Error("Task buffer full");return new Promise((t,r)=>{n.push({producer:e,resolve:t,reject:r}),s()})}}}({size:null!==(r=null==e?void 0:e.bufferSize)&&void 0!==r?r:30,concurrency:null!==(n=null==e?void 0:e.concurrency)&&void 0!==n?n:5})}getIgnoreUrls(){var e;const{tracesURL:t="",logsURL:r=""}=this.options;return[t,r].filter(Boolean).concat(null!==(e=this.config.ignoreUrls)&&void 0!==e?e:[])}isBatched(){return!0}send(e){const t=new L({internalLogger:this.internalLogger,customOtlpTransform:this.options.otlpTransform});e.forEach(e=>t.addResourceItem(e)),this.sendPayload(t.getPayload())}sendPayload(e){try{const{tracesURL:r="",logsURL:n=""}=this.options;for(const[o,s]of Object.entries(e)){if(!(i(s)&&s.length>0))continue;let e,a=e=>{},l="";switch(o){case"resourceSpans":l=r,e=this.sendingTracesDisabledUntil,a=e=>{this.sendingTracesDisabledUntil=e};break;case"resourceLogs":l=n,e=this.sendingLogsDisabledUntil,a=e=>{this.sendingLogsDisabledUntil=e}}if(e&&e>new Date(Date.now()))return void this.logWarn(`Dropping transport item due to too many requests. Backoff until ${e}`);const c=JSON.stringify({[o]:s}),{requestOptions:d,apiKey:g}=this.options,v=null!=d?d:{},{headers:p={}}=v,f=t(v,["headers"]);if(!l)continue;const m={};for(const[e,t]of Object.entries(p))m[e]="function"==typeof t?t():t;this.promiseBuffer.add(()=>fetch(l,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},m),g?{"x-api-key":g}:{}),body:c,keepalive:c.length<=6e4},null!=f?f:{})).then(t=>(429===t.status&&(a(this.getRetryAfterDate(t)),this.logWarn(`Too many requests, backing off until ${e}`)),t.text().catch(u),t)).catch(e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(c),e)}))}}catch(e){this.logError(e)}}getRetryAfterDate(e){const t=Date.now(),r=e.headers.get("Retry-After");if(r){const e=Number(r);if(!isNaN(e))return new Date(1e3*e+t);const n=Date.parse(r);if(!isNaN(n))return new Date(n)}return new Date(t+this.rateLimitBackoffMs)}},e}({});
@@ -4,7 +4,7 @@ import type { OtlpHttpTransportOptions } from './types';
4
4
  export declare class OtlpHttpTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-otlp-http";
7
- readonly version = "2.2.2";
7
+ readonly version = "2.2.3";
8
8
  private readonly promiseBuffer;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private sendingTracesDisabledUntil;
@@ -4,7 +4,7 @@ import type { OtlpHttpTransportOptions } from './types';
4
4
  export declare class OtlpHttpTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-otlp-http";
7
- readonly version = "2.2.2";
7
+ readonly version = "2.2.3";
8
8
  private readonly promiseBuffer;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private sendingTracesDisabledUntil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-transport-otlp-http",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Faro transport which converts the Faro data model to the Otlp data model.",
5
5
  "keywords": [
6
6
  "observability",
@@ -50,7 +50,7 @@
50
50
  "quality:circular-deps": "madge --circular ."
51
51
  },
52
52
  "devDependencies": {
53
- "@grafana/faro-core": "^2.2.2"
53
+ "@grafana/faro-core": "^2.2.3"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
@@ -59,5 +59,5 @@
59
59
  "@opentelemetry/otlp-transformer": "^0.211.0",
60
60
  "@opentelemetry/semantic-conventions": "^1.28.0"
61
61
  },
62
- "gitHead": "70f34a9324d349cad92e8dd50fba2f796a897c45"
62
+ "gitHead": "27cb5bebe06077a050cfba9ea07c7c2f0bcdc455"
63
63
  }