@bugsnag/browser-performance
Advanced tools
Comparing version 1.0.0 to 1.1.0-alpha.0
@@ -1,2 +0,2 @@ | ||
import { defaultNetworkRequestCallback } from '../network-request-callback.js'; | ||
import { defaultNetworkRequestCallback } from '@bugsnag/request-tracker-performance'; | ||
@@ -3,0 +3,0 @@ const permittedPrefixes = ['http://', 'https://', '/', './', '../']; |
@@ -1,2 +0,2 @@ | ||
import { validateSpanOptions, isString, coreSpanOptionSchema } from '@bugsnag/core-performance'; | ||
import { isString, coreSpanOptionSchema } from '@bugsnag/core-performance'; | ||
import { getPermittedAttributes } from '../send-page-attributes.js'; | ||
@@ -51,3 +51,3 @@ import { defaultRouteResolver } from '../default-routing-provider.js'; | ||
const routeChangeSpanOptions = Object.assign(Object.assign({}, options), { trigger }); | ||
const cleanOptions = validateSpanOptions('[RouteChange]', routeChangeSpanOptions, routeChangeSpanOptionSchema, configuration.logger); | ||
const cleanOptions = this.spanFactory.validateSpanOptions('[RouteChange]', routeChangeSpanOptions, routeChangeSpanOptionSchema); | ||
const route = configuration.routingProvider.resolveRoute(absoluteUrl) || defaultRouteResolver(absoluteUrl); | ||
@@ -54,0 +54,0 @@ // update the span name using the validated route |
@@ -1,2 +0,4 @@ | ||
import { createClient } from '@bugsnag/core-performance'; | ||
import { createClient, InMemoryQueue } from '@bugsnag/core-performance'; | ||
import createFetchDeliveryFactory from '@bugsnag/delivery-fetch-performance'; | ||
import { createFetchRequestTracker, createXmlHttpRequestTracker } from '@bugsnag/request-tracker-performance'; | ||
import { FullPageLoadPlugin } from './auto-instrumentation/full-page-load-plugin.js'; | ||
@@ -10,8 +12,5 @@ import { NetworkRequestPlugin } from './auto-instrumentation/network-request-plugin.js'; | ||
import { createDefaultRoutingProvider } from './default-routing-provider.js'; | ||
import createBrowserDeliveryFactory from './delivery.js'; | ||
import idGenerator from './id-generator.js'; | ||
import createOnSettle from './on-settle/index.js'; | ||
import makeBrowserPersistence from './persistence.js'; | ||
import createFetchRequestTracker from './request-tracker/request-tracker-fetch.js'; | ||
import createXmlHttpRequestTracker from './request-tracker/request-tracker-xhr.js'; | ||
import createResourceAttributesSource from './resource-attributes-source.js'; | ||
@@ -27,3 +26,3 @@ import { createSpanAttributesSource } from './span-attributes-source.js'; | ||
const fetchRequestTracker = createFetchRequestTracker(window, clock); | ||
const xhrRequestTracker = createXmlHttpRequestTracker(window, clock); | ||
const xhrRequestTracker = createXmlHttpRequestTracker(XMLHttpRequest, clock, document); | ||
const webVitals = new WebVitals(performance, clock, window.PerformanceObserver); | ||
@@ -37,3 +36,3 @@ const onSettle = createOnSettle(clock, window, fetchRequestTracker, xhrRequestTracker, performance); | ||
spanAttributesSource, | ||
deliveryFactory: createBrowserDeliveryFactory(window.fetch, backgroundingListener, clock), | ||
deliveryFactory: createFetchDeliveryFactory(window.fetch, clock, backgroundingListener), | ||
idGenerator, | ||
@@ -50,5 +49,6 @@ schema: createSchema(window.location.hostname, new DefaultRoutingProvider()), | ||
], | ||
persistence | ||
persistence, | ||
retryQueueFactory: (delivery, retryQueueMaxSize) => new InMemoryQueue(delivery, retryQueueMaxSize) | ||
}); | ||
export { DefaultRoutingProvider, BugsnagPerformance as default, onSettle }; |
import { schema, isBoolean, isStringOrRegExpArray } from '@bugsnag/core-performance'; | ||
import { defaultNetworkRequestCallback, isNetworkRequestCallback } from './network-request-callback.js'; | ||
import { defaultNetworkRequestCallback, isNetworkRequestCallback } from '@bugsnag/request-tracker-performance'; | ||
import { isRoutingProvider } from './routing-provider.js'; | ||
@@ -4,0 +4,0 @@ import { defaultSendPageAttributes, isSendPageAttributes } from './send-page-attributes.js'; |
@@ -1,2 +0,2 @@ | ||
import getAbsoluteUrl from './request-tracker/url-helpers.js'; | ||
import { getAbsoluteUrl } from '@bugsnag/request-tracker-performance'; | ||
@@ -3,0 +3,0 @@ const defaultRouteResolver = (url) => url.pathname || '/'; |
@@ -1,2 +0,2 @@ | ||
import { InMemoryPersistence, isPersistedProbabilty } from '@bugsnag/core-performance'; | ||
import { InMemoryPersistence, toPersistedPayload } from '@bugsnag/core-performance'; | ||
@@ -15,26 +15,2 @@ function makeBrowserPersistence(window) { | ||
} | ||
// NOTE: this should be kept in sync with the notifier | ||
// https://github.com/bugsnag/bugsnag-js/blob/next/packages/plugin-browser-device/device.js | ||
function isDeviceId(raw) { | ||
// make sure the persisted value looks like a valid cuid | ||
return /^c[a-z0-9]{20,32}$/.test(raw); | ||
} | ||
function toPersistedPayload(key, raw) { | ||
switch (key) { | ||
case 'bugsnag-sampling-probability': { | ||
const json = JSON.parse(raw); | ||
return isPersistedProbabilty(json) | ||
? json | ||
: undefined; | ||
} | ||
case 'bugsnag-anonymous-id': | ||
return isDeviceId(raw) | ||
? raw | ||
: undefined; | ||
default: { | ||
const _exhaustiveCheck = key; | ||
return _exhaustiveCheck; | ||
} | ||
} | ||
} | ||
function toString(key, value) { | ||
@@ -46,6 +22,4 @@ switch (key) { | ||
return value; | ||
default: { | ||
const _exhaustiveCheck = key; | ||
return _exhaustiveCheck; | ||
} | ||
default: | ||
return key; | ||
} | ||
@@ -52,0 +26,0 @@ } |
@@ -8,3 +8,3 @@ import cuid from '@bugsnag/cuid'; | ||
return function resourceAttributesSource(config) { | ||
const attributes = new ResourceAttributes(config.releaseStage, config.appVersion, 'bugsnag.performance.browser', '1.0.0'); | ||
const attributes = new ResourceAttributes(config.releaseStage, config.appVersion, 'bugsnag.performance.browser', '1.1.0-alpha.0'); | ||
attributes.set('browser.user_agent', navigator.userAgent); | ||
@@ -11,0 +11,0 @@ // chromium only |
import { type InternalConfiguration, type Plugin, type SpanFactory } from '@bugsnag/core-performance'; | ||
import { type NetworkRequestInfo, type RequestTracker } from '@bugsnag/request-tracker-performance'; | ||
import { type BrowserConfiguration } from '../config'; | ||
import { type RequestTracker } from '../request-tracker/request-tracker'; | ||
export interface BrowserNetworkRequestInfo extends NetworkRequestInfo { | ||
readonly type: PerformanceResourceTiming['initiatorType']; | ||
} | ||
export declare class NetworkRequestPlugin implements Plugin<BrowserConfiguration> { | ||
@@ -5,0 +8,0 @@ private spanFactory; |
@@ -8,4 +8,4 @@ export declare const onSettle: import("./on-settle").OnSettlePlugin; | ||
}; | ||
declare const BugsnagPerformance: import("@bugsnag/core-performance").BugsnagPerformance<import("./config").BrowserConfiguration>; | ||
declare const BugsnagPerformance: import("@bugsnag/core-performance").Client<import("./config").BrowserConfiguration>; | ||
export default BugsnagPerformance; | ||
//# sourceMappingURL=browser.d.ts.map |
import { type ConfigOption, type Configuration, type CoreSchema } from '@bugsnag/core-performance'; | ||
import { type NetworkRequestCallback } from './network-request-callback'; | ||
import { type NetworkRequestCallback } from '@bugsnag/request-tracker-performance'; | ||
import { type BrowserNetworkRequestInfo } from './auto-instrumentation'; | ||
import { type RoutingProvider } from './routing-provider'; | ||
@@ -12,3 +13,3 @@ import { type SendPageAttributes } from './send-page-attributes'; | ||
settleIgnoreUrls: ConfigOption<Array<string | RegExp>>; | ||
networkRequestCallback: ConfigOption<NetworkRequestCallback>; | ||
networkRequestCallback: ConfigOption<NetworkRequestCallback<BrowserNetworkRequestInfo>>; | ||
sendPageAttributes: ConfigOption<SendPageAttributes>; | ||
@@ -23,3 +24,3 @@ } | ||
settleIgnoreUrls?: Array<string | RegExp>; | ||
networkRequestCallback?: NetworkRequestCallback; | ||
networkRequestCallback?: NetworkRequestCallback<BrowserNetworkRequestInfo>; | ||
sendPageAttributes?: SendPageAttributes; | ||
@@ -26,0 +27,0 @@ } |
import { type PerformanceWithTiming } from './load-event-end-settler'; | ||
import { type BrowserConfiguration } from '../config'; | ||
import { type RequestTracker } from '../request-tracker/request-tracker'; | ||
import { type RequestTracker } from '@bugsnag/request-tracker-performance'; | ||
import { type Clock, type Plugin } from '@bugsnag/core-performance'; | ||
@@ -5,0 +5,0 @@ export type OnSettle = (callback: OnSettleCallback) => void; |
import { type Clock } from '@bugsnag/core-performance'; | ||
import { Settler } from './settler'; | ||
import { type RequestTracker } from '../request-tracker/request-tracker'; | ||
import { type RequestTracker } from '@bugsnag/request-tracker-performance'; | ||
declare class RequestSettler extends Settler { | ||
@@ -5,0 +5,0 @@ private timeout; |
{ | ||
"name": "@bugsnag/browser-performance", | ||
"version": "1.0.0", | ||
"version": "1.1.0-alpha.0", | ||
"description": "BugSnag performance monitoring for browsers", | ||
@@ -24,4 +24,6 @@ "homepage": "https://www.bugsnag.com/", | ||
"dependencies": { | ||
"@bugsnag/core-performance": "^1.0.0", | ||
"@bugsnag/cuid": "^3.0.2" | ||
"@bugsnag/core-performance": "^1.1.0-alpha.0", | ||
"@bugsnag/cuid": "^3.0.2", | ||
"@bugsnag/delivery-fetch-performance": "^1.1.0-alpha.0", | ||
"@bugsnag/request-tracker-performance": "^1.1.0-alpha.0" | ||
}, | ||
@@ -34,3 +36,3 @@ "type": "module", | ||
], | ||
"gitHead": "d30abd6e95ef5fe79582fd63186e243aa40269de" | ||
"gitHead": "d1a7bff635829b206a9c57e79a6b445175bff61b" | ||
} |
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
75194
4
77
1239
1
+ Added@bugsnag/delivery-fetch-performance@1.2.0(transitive)
+ Added@bugsnag/request-tracker-performance@1.2.0(transitive)