Files
discord-decomp/_bundle/Module6410.js
T
2026-11-01 12:12:55 +02:00

36 lines
1.2 KiB
JavaScript

// Metro module 6410 (f6411).
import { getActiveSpan, getRootSpan } from "./spanTimeInputToSeconds";
import { DEBUG_BUILD } from "./Module6396";
import { logger } from "./consoleSandbox_6368";
import { SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT } from "./Module6383";
export function setMeasurement(a0, a1, a2, r5 = getActiveSpan()) {
const r4 = r5 && getRootSpan(r5);
if (r4) {
if (DEBUG_BUILD) {
logger.log(`[Measurement] Setting measurement on root span: ${a0} = ${a1} ${a2}`);
}
const r40 = {};
r40[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE] = a1;
r40[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT] = a2;
r4.addEvent(a0, r40);
}
}
export function timedEventsToMeasurements(a0) {
if (a0 && a0.length !== 0) {
const r6 = {};
let c15710_0 = r6;
a0.forEach((item) => {
const r5 = item.attributes || {};
const unit = r5[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT];
const value = r5[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE];
if (typeof unit === "string" ? typeof value === "number" : typeof unit === "string") {
c15710_0[item.name] = {
value,
unit
};
}
});
return r6;
}
}