96 lines
3.0 KiB
JavaScript
96 lines
3.0 KiB
JavaScript
// Metro module 1166 (f1167).
|
|
import { isWeb } from "./Module1002";
|
|
import { defaultIdleOptions, addDefaultOpForSpanFrom, addThreadInfoToSpan } from "./startIdleSpan";
|
|
import { getDevServer } from "./getDevServer";
|
|
import { instrumentOutgoingRequests } from "./Module1024";
|
|
import { getClient } from "./Module817";
|
|
const name = "ReactNativeTracing";
|
|
let c970_3 = {
|
|
traceFetch: !!isWeb(),
|
|
traceXHR: true,
|
|
enableHTTPTimings: true
|
|
};
|
|
export const INTEGRATION_NAME = "ReactNativeTracing";
|
|
export { c970_3 as defaultReactNativeTracingOptions };
|
|
export const reactNativeTracingIntegration = function(r2 = {}) {
|
|
let c12872_1, shouldCreateSpanForRequest, url;
|
|
c12872_1 = void 0;
|
|
shouldCreateSpanForRequest = void 0;
|
|
url = void 0;
|
|
const state = {
|
|
currentRoute: void 0
|
|
};
|
|
let c12872_0 = state;
|
|
const r8 = Object;
|
|
const r16 = {
|
|
...c970_3,
|
|
...r2
|
|
};
|
|
let beforeStartSpan = r2.beforeStartSpan;
|
|
const r18 = r2;
|
|
if (!(beforeStartSpan !== null && beforeStartSpan !== void 0)) {
|
|
beforeStartSpan = (a0) => a0;
|
|
}
|
|
let finalTimeoutMs = r18.finalTimeoutMs;
|
|
if (!(finalTimeoutMs !== null && finalTimeoutMs !== void 0)) {
|
|
finalTimeoutMs = defaultIdleOptions.finalTimeout;
|
|
}
|
|
let idleTimeoutMs = r18.idleTimeoutMs;
|
|
if (!(idleTimeoutMs !== null && idleTimeoutMs !== void 0)) {
|
|
idleTimeoutMs = defaultIdleOptions.idleTimeout;
|
|
}
|
|
const options = r8.assign(r16, {
|
|
beforeStartSpan,
|
|
finalTimeoutMs,
|
|
idleTimeoutMs
|
|
});
|
|
c12872_1 = options;
|
|
let shouldCreateSpanForRequest2 = options.shouldCreateSpanForRequest;
|
|
shouldCreateSpanForRequest = shouldCreateSpanForRequest2;
|
|
const devServer = getDevServer();
|
|
url = devServer !== null ? devServer !== void 0 ? devServer.url : void 0 : void 0;
|
|
if (url !== void 0) {
|
|
shouldCreateSpanForRequest2 = (a0) => {
|
|
const r5 = a0.startsWith(url);
|
|
return r5 ? !r5 : shouldCreateSpanForRequest ? shouldCreateSpanForRequest(a0) : !shouldCreateSpanForRequest;
|
|
};
|
|
}
|
|
options.shouldCreateSpanForRequest = shouldCreateSpanForRequest2;
|
|
return {
|
|
name,
|
|
setup: (a0) => {
|
|
addDefaultOpForSpanFrom(a0);
|
|
addThreadInfoToSpan(a0);
|
|
instrumentOutgoingRequests(a0, {
|
|
traceFetch: c12872_1.traceFetch,
|
|
traceXHR: c12872_1.traceXHR,
|
|
shouldCreateSpanForRequest: c12872_1.shouldCreateSpanForRequest,
|
|
tracePropagationTargets: a0.getOptions().tracePropagationTargets || (isWeb() ? void 0 : [/.*/])
|
|
});
|
|
},
|
|
processEvent: (a0) => {
|
|
if (a0.contexts && c12872_0.currentRoute) {
|
|
a0.contexts.app = {
|
|
view_names: [c12872_0.currentRoute],
|
|
...a0.contexts.app
|
|
};
|
|
}
|
|
return a0;
|
|
},
|
|
options,
|
|
state,
|
|
setCurrentRoute: (a0) => {
|
|
c12872_0.currentRoute = a0;
|
|
}
|
|
};
|
|
};
|
|
export function getCurrentReactNativeTracingIntegration() {
|
|
const client = getClient();
|
|
if (client) {
|
|
return client.getIntegrationByName(name);
|
|
}
|
|
}
|
|
export function getReactNativeTracingIntegration(a0) {
|
|
return a0.getIntegrationByName(name);
|
|
}
|