88 lines
3.0 KiB
JavaScript
88 lines
3.0 KiB
JavaScript
// Metro module 6404 (f6405).
|
|
import { dropUndefinedKeys, addNonEnumerableProperty } from "./addNonEnumerableProperty_6374";
|
|
import { DEFAULT_ENVIRONMENT } from "./Module6405";
|
|
import { getClient } from "./Module6395";
|
|
import { getRootSpan, spanToJSON, spanIsSampled } from "./spanTimeInputToSeconds";
|
|
import { baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader } from "./Module6381";
|
|
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./Module6383";
|
|
import { hasTracingEnabled } from "./Module6400";
|
|
let c4102_2;
|
|
const getDynamicSamplingContextFromSpan = function getDynamicSamplingContextFromSpan(a0) {
|
|
const client = getClient();
|
|
if (client) {
|
|
const rootSpan = getRootSpan(a0);
|
|
const r21 = rootSpan[c4102_2];
|
|
if (r21) {
|
|
return r21;
|
|
}
|
|
const traceState = rootSpan.spanContext().traceState;
|
|
const r11 = traceState && traceState.get("sentry.dsc");
|
|
const r26 = r11 && baggageHeaderToDynamicSamplingContext(r11);
|
|
if (r26) {
|
|
return r26;
|
|
}
|
|
const traceId = a0.spanContext().traceId;
|
|
const options = client.getOptions();
|
|
const r43 = dropUndefinedKeys({
|
|
environment: options.environment || DEFAULT_ENVIRONMENT,
|
|
release: options.release,
|
|
public_key: (client.getDsn() || {}).publicKey,
|
|
trace_id: traceId
|
|
});
|
|
client.emit("createDsc", r43);
|
|
const r50 = spanToJSON(rootSpan);
|
|
const r51 = r50.data || {};
|
|
const r55 = r51[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];
|
|
if (r55 != null) {
|
|
r43.sample_rate = `${r55}`;
|
|
}
|
|
const r64 = r51[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
const description = r50.description;
|
|
if (r64 !== "url" && description) {
|
|
r43.transaction = description;
|
|
}
|
|
if (hasTracingEnabled()) {
|
|
r43.sampled = String(spanIsSampled(rootSpan));
|
|
}
|
|
client.emit("createDsc", r43, rootSpan);
|
|
return r43;
|
|
}
|
|
return {};
|
|
};
|
|
c4102_2 = "_frozenDsc";
|
|
export function freezeDscOnSpan(a0, a1) {
|
|
addNonEnumerableProperty(a0, c4102_2, a1);
|
|
}
|
|
export function getDynamicSamplingContextFromClient(a0, a1) {
|
|
const options = a1.getOptions();
|
|
const r19 = dropUndefinedKeys({
|
|
environment: options.environment || DEFAULT_ENVIRONMENT,
|
|
release: options.release,
|
|
public_key: (a1.getDsn() || {}).publicKey,
|
|
trace_id: a0
|
|
});
|
|
a1.emit("createDsc", r19);
|
|
return r19;
|
|
}
|
|
export function getDynamicSamplingContextFromScope(a0, a1) {
|
|
const propagationContext = a1.getPropagationContext();
|
|
let dsc = propagationContext.dsc;
|
|
if (!dsc) {
|
|
const traceId = propagationContext.traceId;
|
|
const options = a0.getOptions();
|
|
const r23 = dropUndefinedKeys({
|
|
environment: options.environment || DEFAULT_ENVIRONMENT,
|
|
release: options.release,
|
|
public_key: (a0.getDsn() || {}).publicKey,
|
|
trace_id: traceId
|
|
});
|
|
a0.emit("createDsc", r23);
|
|
dsc = r23;
|
|
}
|
|
return dsc;
|
|
}
|
|
export { getDynamicSamplingContextFromSpan };
|
|
export function spanToBaggageHeader(a0) {
|
|
return dynamicSamplingContextToSentryBaggageHeader(getDynamicSamplingContextFromSpan(a0));
|
|
}
|