@bugsnag/browser-performance
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -1,2 +0,2 @@ | ||
import { createClient, InMemoryQueue } from '@bugsnag/core-performance'; | ||
import { createNoopClient, createClient, InMemoryQueue } from '@bugsnag/core-performance'; | ||
import createFetchDeliveryFactory from '@bugsnag/delivery-fetch-performance'; | ||
@@ -11,5 +11,5 @@ import { createFetchRequestTracker, createXmlHttpRequestTracker } from '@bugsnag/request-tracker-performance'; | ||
import { createSchema } from './config.js'; | ||
import { createDefaultRoutingProvider } from './default-routing-provider.js'; | ||
import { createNoopRoutingProvider, createDefaultRoutingProvider } from './default-routing-provider.js'; | ||
import idGenerator from './id-generator.js'; | ||
import createOnSettle from './on-settle/index.js'; | ||
import createOnSettle, { createNoopOnSettle } from './on-settle/index.js'; | ||
import makeBrowserPersistence from './persistence.js'; | ||
@@ -20,33 +20,44 @@ import createResourceAttributesSource from './resource-attributes-source.js'; | ||
const backgroundingListener = createBrowserBackgroundingListener(window); | ||
const spanAttributesSource = createSpanAttributesSource(document); | ||
const clock = createClock(performance, backgroundingListener); | ||
const persistence = makeBrowserPersistence(window); | ||
const resourceAttributesSource = createResourceAttributesSource(navigator, persistence); | ||
const fetchRequestTracker = createFetchRequestTracker(window, clock); | ||
const xhrRequestTracker = createXmlHttpRequestTracker(XMLHttpRequest, clock, document); | ||
const webVitals = new WebVitals(performance, clock, window.PerformanceObserver); | ||
const onSettle = createOnSettle(clock, window, fetchRequestTracker, xhrRequestTracker, performance); | ||
const DefaultRoutingProvider = createDefaultRoutingProvider(onSettle, window.location); | ||
const BugsnagPerformance = createClient({ | ||
backgroundingListener, | ||
clock, | ||
resourceAttributesSource, | ||
spanAttributesSource, | ||
deliveryFactory: createFetchDeliveryFactory(window.fetch, clock, backgroundingListener), | ||
idGenerator, | ||
schema: createSchema(window.location.hostname, new DefaultRoutingProvider()), | ||
plugins: (spanFactory, spanContextStorage) => [ | ||
onSettle, | ||
new FullPageLoadPlugin(document, window.location, spanFactory, webVitals, onSettle, backgroundingListener, performance), | ||
// ResourceLoadPlugin should always come after FullPageLoad plugin, as it should use that | ||
// span context as the parent of it's spans | ||
new ResourceLoadPlugin(spanFactory, spanContextStorage, window.PerformanceObserver), | ||
new NetworkRequestPlugin(spanFactory, fetchRequestTracker, xhrRequestTracker), | ||
new RouteChangePlugin(spanFactory, window.location, document) | ||
], | ||
persistence, | ||
retryQueueFactory: (delivery, retryQueueMaxSize) => new InMemoryQueue(delivery, retryQueueMaxSize) | ||
}); | ||
let onSettle; | ||
let DefaultRoutingProvider; | ||
let BugsnagPerformance; | ||
if (typeof window === 'undefined' || typeof document === 'undefined') { | ||
onSettle = createNoopOnSettle(); | ||
DefaultRoutingProvider = createNoopRoutingProvider(); | ||
BugsnagPerformance = createNoopClient(); | ||
} | ||
else { | ||
const backgroundingListener = createBrowserBackgroundingListener(window); | ||
const spanAttributesSource = createSpanAttributesSource(document); | ||
const clock = createClock(performance, backgroundingListener); | ||
const persistence = makeBrowserPersistence(window); | ||
const resourceAttributesSource = createResourceAttributesSource(navigator, persistence); | ||
const fetchRequestTracker = createFetchRequestTracker(window, clock); | ||
const xhrRequestTracker = createXmlHttpRequestTracker(XMLHttpRequest, clock, document); | ||
const webVitals = new WebVitals(performance, clock, window.PerformanceObserver); | ||
onSettle = createOnSettle(clock, window, fetchRequestTracker, xhrRequestTracker, performance); | ||
DefaultRoutingProvider = createDefaultRoutingProvider(onSettle, window.location); | ||
BugsnagPerformance = createClient({ | ||
backgroundingListener, | ||
clock, | ||
resourceAttributesSource, | ||
spanAttributesSource, | ||
deliveryFactory: createFetchDeliveryFactory(window.fetch, clock, backgroundingListener), | ||
idGenerator, | ||
schema: createSchema(window.location.hostname, new DefaultRoutingProvider()), | ||
plugins: (spanFactory, spanContextStorage) => [ | ||
onSettle, | ||
new FullPageLoadPlugin(document, window.location, spanFactory, webVitals, onSettle, backgroundingListener, performance), | ||
// ResourceLoadPlugin should always come after FullPageLoad plugin, as it should use that | ||
// span context as the parent of it's spans | ||
new ResourceLoadPlugin(spanFactory, spanContextStorage, window.PerformanceObserver), | ||
new NetworkRequestPlugin(spanFactory, fetchRequestTracker, xhrRequestTracker), | ||
new RouteChangePlugin(spanFactory, window.location, document) | ||
], | ||
persistence, | ||
retryQueueFactory: (delivery, retryQueueMaxSize) => new InMemoryQueue(delivery, retryQueueMaxSize) | ||
}); | ||
} | ||
const BugsnagPerformance$1 = BugsnagPerformance; | ||
export { DefaultRoutingProvider, BugsnagPerformance as default, onSettle }; | ||
export { DefaultRoutingProvider, BugsnagPerformance$1 as default, onSettle }; |
import { getAbsoluteUrl } from '@bugsnag/request-tracker-performance'; | ||
const defaultRouteResolver = (url) => url.pathname || '/'; | ||
const createNoopRoutingProvider = () => { | ||
return class NoopRoutingProvider { | ||
constructor(resolveRoute = defaultRouteResolver) { | ||
this.resolveRoute = resolveRoute; | ||
} | ||
listenForRouteChanges(startRouteChangeSpan) { } | ||
}; | ||
}; | ||
const createDefaultRoutingProvider = (onSettle, location) => { | ||
@@ -33,2 +41,2 @@ return class DefaultRoutingProvider { | ||
export { createDefaultRoutingProvider, defaultRouteResolver }; | ||
export { createDefaultRoutingProvider, createNoopRoutingProvider, defaultRouteResolver }; |
@@ -7,2 +7,7 @@ import DomMutationSettler from './dom-mutation-settler.js'; | ||
const TIMEOUT_MILLISECONDS = 60 * 1000; | ||
function createNoopOnSettle() { | ||
const noop = () => { }; | ||
noop.configure = () => { }; | ||
return noop; | ||
} | ||
function createOnSettle(clock, window, fetchRequestTracker, xhrRequestTracker, performance) { | ||
@@ -57,2 +62,2 @@ const domMutationSettler = new DomMutationSettler(clock, window.document); | ||
export { createOnSettle as default }; | ||
export { createNoopOnSettle, createOnSettle as default }; |
@@ -8,3 +8,3 @@ import cuid from '@bugsnag/cuid'; | ||
return function resourceAttributesSource(config) { | ||
const attributes = new ResourceAttributes(config.releaseStage, config.appVersion, 'bugsnag.performance.browser', '2.1.0'); | ||
const attributes = new ResourceAttributes(config.releaseStage, config.appVersion, 'bugsnag.performance.browser', '2.2.0'); | ||
attributes.set('browser.user_agent', navigator.userAgent); | ||
@@ -11,0 +11,0 @@ // chromium only |
@@ -1,10 +0,9 @@ | ||
export declare const onSettle: import("./on-settle").OnSettlePlugin; | ||
export declare const DefaultRoutingProvider: { | ||
new (resolveRoute?: import("./routing-provider").RouteResolver): { | ||
resolveRoute: import("./routing-provider").RouteResolver; | ||
listenForRouteChanges(startRouteChangeSpan: import("./routing-provider").StartRouteChangeCallback): void; | ||
}; | ||
}; | ||
declare const BugsnagPerformance: import("@bugsnag/core-performance").Client<import("./config").BrowserConfiguration>; | ||
import { type Client } from '@bugsnag/core-performance'; | ||
import { type BrowserConfiguration } from './config'; | ||
import { createDefaultRoutingProvider } from './default-routing-provider'; | ||
import { type OnSettlePlugin } from './on-settle'; | ||
export declare let onSettle: OnSettlePlugin; | ||
export declare let DefaultRoutingProvider: ReturnType<typeof createDefaultRoutingProvider>; | ||
declare let BugsnagPerformance: Client<BrowserConfiguration>; | ||
export default BugsnagPerformance; | ||
//# sourceMappingURL=browser.d.ts.map |
import { type OnSettle } from './on-settle'; | ||
import { type RouteResolver, type StartRouteChangeCallback } from './routing-provider'; | ||
export declare const defaultRouteResolver: RouteResolver; | ||
export declare const createNoopRoutingProvider: () => { | ||
new (resolveRoute?: RouteResolver): { | ||
resolveRoute: RouteResolver; | ||
listenForRouteChanges(startRouteChangeSpan: StartRouteChangeCallback): void; | ||
}; | ||
}; | ||
export declare const createDefaultRoutingProvider: (onSettle: OnSettle, location: Location) => { | ||
@@ -5,0 +11,0 @@ new (resolveRoute?: RouteResolver): { |
@@ -8,3 +8,4 @@ import { type PerformanceWithTiming } from './load-event-end-settler'; | ||
export type OnSettlePlugin = Plugin<BrowserConfiguration> & OnSettle; | ||
export declare function createNoopOnSettle(): OnSettlePlugin; | ||
export default function createOnSettle(clock: Clock, window: Window, fetchRequestTracker: RequestTracker, xhrRequestTracker: RequestTracker, performance: PerformanceWithTiming): OnSettlePlugin; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@bugsnag/browser-performance", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "BugSnag performance monitoring for browsers", | ||
@@ -24,6 +24,6 @@ "homepage": "https://www.bugsnag.com/", | ||
"dependencies": { | ||
"@bugsnag/core-performance": "^2.1.0", | ||
"@bugsnag/core-performance": "^2.2.0", | ||
"@bugsnag/cuid": "^3.0.2", | ||
"@bugsnag/delivery-fetch-performance": "^2.1.0", | ||
"@bugsnag/request-tracker-performance": "^2.1.0" | ||
"@bugsnag/delivery-fetch-performance": "^2.2.0", | ||
"@bugsnag/request-tracker-performance": "^2.2.0" | ||
}, | ||
@@ -36,3 +36,3 @@ "type": "module", | ||
], | ||
"gitHead": "fe8c5d081446b8de576dae8f590c7c75313ec842" | ||
"gitHead": "7b88c34595012a11948078bed7505a1ee0854e17" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79854
1326