New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@grafana/faro-instrumentation-performance-timeline

Package Overview
Dependencies
Maintainers
19
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grafana/faro-instrumentation-performance-timeline - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.5

2

dist/bundle/faro-instrumentation-performance-timeline.iife.js

@@ -1,1 +0,1 @@

var GrafanaFaroInstrumentationPerformanceTimeline=function(e){"use strict";function r(e,r){return typeof e===r}const n=e=>!(e=>r(e,"null"))(e)&&r(e,"object"),t=e=>function(e,r){return Object.prototype.toString.call(e)===`[object ${r}]`}(e,"Array");function i(){}var s;!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"}(s||(s={}));const o={debug:i,error:i,info:i,prefix:"Faro",warn:i};s.ERROR;const a=Object.assign({},console);class u{constructor(){this.unpatchedConsole=a,this.internalLogger=o,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 f extends u{constructor(){super(...arguments),this.api={},this.transports={}}}const l=[{type:"navigation",buffered:!0},{type:"resource",buffered:!0}];return e.DEFAULT_PERFORMANCE_TIMELINE_ENTRY_TYPES=l,e.PerformanceTimelineInstrumentation=class extends f{constructor(e){var r,n,t,i;super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-performance-timeline",this.version="1.0.4",this.resourceTimingBufferSize=null!==(r=null==e?void 0:e.resourceTimingBufferSize)&&void 0!==r?r:250,this.maxResourceTimingBufferSize=null!==(n=null==e?void 0:e.maxResourceTimingBufferSize)&&void 0!==n?n:1e3,this.observeEntryTypes=null!==(t=null==e?void 0:e.observeEntryTypes)&&void 0!==t?t:l,this.skipEntries=null!==(i=null==e?void 0:e.skipEntries)&&void 0!==i?i:[]}initialize(){this.validateIfObservedEntryTypesSupportedByBrowser(),this.setIgnoredUrls(),this.configureResourceTimingBuffer(),this.registerPerformanceObserver(),this.observe()}validateIfObservedEntryTypesSupportedByBrowser(){const e=[];for(const r of this.observeEntryTypes)PerformanceObserver.supportedEntryTypes.includes(r.type)||e.push(r.type);e.length>0&&this.internalLogger.info("The following entryTypes are not supported by this browser")}setIgnoredUrls(){var e,r;this.ignoredUrls=null!==(r=null===(e=this.options)||void 0===e?void 0:e.ignoredUrls)&&void 0!==r?r:this.getIgnoreUrls()}configureResourceTimingBuffer(){performance.setResourceTimingBufferSize(this.resourceTimingBufferSize),performance.addEventListener("resourcetimingbufferfull",(()=>{this.internalLogger.info(`Resource Timing Buffer is FULL! Increasing buffer size to ${this.maxResourceTimingBufferSize}.`),performance.setResourceTimingBufferSize(this.maxResourceTimingBufferSize)}))}registerPerformanceObserver(){this.observer=new PerformanceObserver(this.handlePerformanceEntry.bind(this))}handlePerformanceEntry(e,r,n=0){var t;for(const r of e.getEntries()){if(null===(t=this.ignoredUrls)||void 0===t?void 0:t.some((e=>null!=r.name.match(e)))){this.internalLogger.info("Drop performance entry because it matches one of the ignored URLs");continue}const e=r.toJSON();if(this.isEntryExcluded(e)){this.internalLogger.info("Drop performance entry because it matches one of the skip entries");continue}const n=this.objectValuesToString(e);n.serverTiming||(n.serverTiming="[]"),this.api.pushEvent("performanceEntry",n)}n>0&&this.internalLogger.warn(`${n} entries got dropped due to the browser buffer being full.`)}isEntryExcluded(e){if(this.skipEntries&&this.skipEntries.length)for(const r of this.skipEntries)if(this.isScopedSkipEntry(r)){if(r.applyToEntryTypes.includes(e.entryType)&&r.skipEntries.some((({key:r,value:n})=>e[r]===n)))return!0}else if(e[r.key]===r.value)return!0;return!1}observe(){var e;null===(e=this.observeEntryTypes)||void 0===e||e.forEach((e=>{var r;null===(r=this.observer)||void 0===r||r.observe(e)}))}getIgnoreUrls(){var e;return null===(e=this.transports.transports)||void 0===e?void 0:e.flatMap((e=>e.getIgnoreUrls()))}objectValuesToString(e={}){const r={};for(const[i,s]of Object.entries(e))t(s)?r[i]=s.map((e=>this.objectValuesToString(e))).toString():n(s)?r[i]=this.objectValuesToString():r[i]=s.toString();return r}isScopedSkipEntry(e){return e.hasOwnProperty("applyToEntryTypes")&&e.hasOwnProperty("skipEntries")}},e}({});
var GrafanaFaroInstrumentationPerformanceTimeline=function(e){"use strict";function r(e,r){return typeof e===r}const n=e=>!(e=>r(e,"null"))(e)&&r(e,"object"),t=e=>function(e,r){return Object.prototype.toString.call(e)===`[object ${r}]`}(e,"Array");function i(){}var s;!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"}(s||(s={}));const o={debug:i,error:i,info:i,prefix:"Faro",warn:i};s.ERROR;const a=Object.assign({},console);class u{constructor(){this.unpatchedConsole=a,this.internalLogger=o,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 f extends u{constructor(){super(...arguments),this.api={},this.transports={}}}const l=[{type:"navigation",buffered:!0},{type:"resource",buffered:!0}];return e.DEFAULT_PERFORMANCE_TIMELINE_ENTRY_TYPES=l,e.PerformanceTimelineInstrumentation=class extends f{constructor(e){var r,n,t,i;super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-performance-timeline",this.version="1.0.5",this.resourceTimingBufferSize=null!==(r=null==e?void 0:e.resourceTimingBufferSize)&&void 0!==r?r:250,this.maxResourceTimingBufferSize=null!==(n=null==e?void 0:e.maxResourceTimingBufferSize)&&void 0!==n?n:1e3,this.observeEntryTypes=null!==(t=null==e?void 0:e.observeEntryTypes)&&void 0!==t?t:l,this.skipEntries=null!==(i=null==e?void 0:e.skipEntries)&&void 0!==i?i:[]}initialize(){this.validateIfObservedEntryTypesSupportedByBrowser(),this.setIgnoredUrls(),this.configureResourceTimingBuffer(),this.registerPerformanceObserver(),this.observe()}validateIfObservedEntryTypesSupportedByBrowser(){const e=[];for(const r of this.observeEntryTypes)PerformanceObserver.supportedEntryTypes.includes(r.type)||e.push(r.type);e.length>0&&this.internalLogger.info("The following entryTypes are not supported by this browser")}setIgnoredUrls(){var e,r;this.ignoredUrls=null!==(r=null===(e=this.options)||void 0===e?void 0:e.ignoredUrls)&&void 0!==r?r:this.getIgnoreUrls()}configureResourceTimingBuffer(){performance.setResourceTimingBufferSize(this.resourceTimingBufferSize),performance.addEventListener("resourcetimingbufferfull",(()=>{this.internalLogger.info(`Resource Timing Buffer is FULL! Increasing buffer size to ${this.maxResourceTimingBufferSize}.`),performance.setResourceTimingBufferSize(this.maxResourceTimingBufferSize)}))}registerPerformanceObserver(){this.observer=new PerformanceObserver(this.handlePerformanceEntry.bind(this))}handlePerformanceEntry(e,r,n=0){var t;for(const r of e.getEntries()){if(null===(t=this.ignoredUrls)||void 0===t?void 0:t.some((e=>null!=r.name.match(e)))){this.internalLogger.info("Drop performance entry because it matches one of the ignored URLs");continue}const e=r.toJSON();if(this.isEntryExcluded(e)){this.internalLogger.info("Drop performance entry because it matches one of the skip entries");continue}const n=this.objectValuesToString(e);n.serverTiming||(n.serverTiming="[]"),this.api.pushEvent("performanceEntry",n)}n>0&&this.internalLogger.warn(`${n} entries got dropped due to the browser buffer being full.`)}isEntryExcluded(e){if(this.skipEntries&&this.skipEntries.length)for(const r of this.skipEntries)if(this.isScopedSkipEntry(r)){if(r.applyToEntryTypes.includes(e.entryType)&&r.skipEntries.some((({key:r,value:n})=>e[r]===n)))return!0}else if(e[r.key]===r.value)return!0;return!1}observe(){var e;null===(e=this.observeEntryTypes)||void 0===e||e.forEach((e=>{var r;null===(r=this.observer)||void 0===r||r.observe(e)}))}getIgnoreUrls(){var e;return null===(e=this.transports.transports)||void 0===e?void 0:e.flatMap((e=>e.getIgnoreUrls()))}objectValuesToString(e={}){const r={};for(const[i,s]of Object.entries(e))t(s)?r[i]=s.map((e=>this.objectValuesToString(e))).toString():n(s)?r[i]=this.objectValuesToString():r[i]=s.toString();return r}isScopedSkipEntry(e){return e.hasOwnProperty("applyToEntryTypes")&&e.hasOwnProperty("skipEntries")}},e}({});

@@ -17,3 +17,3 @@ import { BaseInstrumentation } from '@grafana/faro-core';

readonly name = "@grafana/faro-web-sdk:instrumentation-performance-timeline";
readonly version = "1.0.4";
readonly version = "1.0.5";
private resourceTimingBufferSize;

@@ -20,0 +20,0 @@ private maxResourceTimingBufferSize;

{
"name": "@grafana/faro-instrumentation-performance-timeline",
"version": "1.0.0-beta.1",
"version": "1.0.5",
"description": "Faro instrumentation to capture Browser Performance Timeline data.",

@@ -52,3 +52,3 @@ "keywords": [

"devDependencies": {
"@grafana/faro-core": "^1.0.4"
"@grafana/faro-core": "^1.0.5"
},

@@ -58,3 +58,3 @@ "publishConfig": {

},
"gitHead": "a3bc84bd68058f5d58f9c0fd8577f02706aad19f"
"gitHead": "bfcaf6fef4e1e50ae20466e4de180d7fd3f35b80"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc