Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _traceFetch(getCurrentHub: () => Hub): void {
if (!supportsNativeFetch()) {
return;
}
// tslint:disable: only-arrow-functions
fill(getGlobalObject(), 'fetch', function(originalFetch: () => void): () => void {
return function(...args: any[]): void {
// @ts-ignore
const self = getCurrentHub().getIntegration(Tracing);
if (self && self._options.tracingOrigins) {
const url = args[0] as string;
const options = (args[1] = (args[1] as { [key: string]: any }) || {});
let whiteListed = false;
self._options.tracingOrigins.forEach((whiteListUrl: string | RegExp) => {
if (!whiteListed) {
whiteListed = isMatchingPattern(url, whiteListUrl);
}
});
if (whiteListed) {
if (options.headers) {
public showReportDialog(options: ReportDialogOptions = {}): void {
// doesn't work without a document (React Native)
const document = getGlobalObject().document;
if (!document) {
return;
}
if (!this._isEnabled()) {
logger.error('Trying to call showReportDialog with Sentry Client is disabled');
return;
}
const dsn = options.dsn || this.getDsn();
if (!options.eventId) {
logger.error('Missing `eventId` option in showReportDialog call');
return;
}
public constructor(options: { Ember?: any } = {}) {
// tslint:disable-next-line: no-unsafe-any
this._Ember = options.Ember || getGlobalObject().Ember;
}
private _traceXHR(getCurrentHub: () => Hub): void {
if (!('XMLHttpRequest' in getGlobalObject())) {
return;
}
const xhrproto = XMLHttpRequest.prototype;
fill(
xhrproto,
'open',
originalOpen =>
function(this: XMLHttpRequest, ...args: any[]): void {
// @ts-ignore
const self = getCurrentHub().getIntegration(Tracing);
if (self) {
self._xhrUrl = args[1] as string;
}
// tslint:disable-next-line: no-unsafe-any
export function getMainCarrier(): Carrier {
const carrier = getGlobalObject();
carrier.__SENTRY__ = carrier.__SENTRY__ || {
extensions: {},
hub: undefined,
};
return carrier;
}
import { getGlobalObject } from '@sentry/utils';
/** JSDoc */
interface TransactionActivityOptions {
idleTimeout: number;
startTransactionOnLocationChange: boolean;
tracesSampleRate: number;
}
/** JSDoc */
interface Activity {
name: string;
span?: Span;
}
const global = getGlobalObject();
/** JSDoc */
export class TransactionActivity implements Integration {
/**
* @inheritDoc
*/
public name: string = TransactionActivity.id;
/**
* @inheritDoc
*/
public static id: string = 'TransactionActivity';
/**
* Is Tracing enabled, this will be determined once per pageload.
*/
* on initalization.
* 0 = 0% chance of instrumenting
* 1 = 100% change of instrumenting
*
* Default: 1
*/
tracesSampleRate: number;
}
/** JSDoc */
interface Activity {
name: string;
span?: Span;
}
const global = getGlobalObject();
/**
* Tracing Integration
*/
export class Tracing implements Integration {
/**
* @inheritDoc
*/
public name: string = Tracing.id;
/**
* @inheritDoc
*/
public static id: string = 'Tracing';
/**