Files
klz-cables.com/.pnpm-store/v10/files/e9/a96dafae0b1bb7486c9a34de8993ddd16c2113f228839029add3e8800b4746b535f624ad628d12fd92a24a51e39ceea8f71eee1395d2a90e4931bac6401b00
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

46 lines
1.5 KiB
Plaintext

import { DEBUG_BUILD } from '../debug-build.js';
import { SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE } from '../semanticAttributes.js';
import { debug } from '../utils/debug-logger.js';
import { getRootSpan, getActiveSpan } from '../utils/spanUtils.js';
/**
* Adds a measurement to the active transaction on the current global scope. You can optionally pass in a different span
* as the 4th parameter.
*/
function setMeasurement(name, value, unit, activeSpan = getActiveSpan()) {
const rootSpan = activeSpan && getRootSpan(activeSpan);
if (rootSpan) {
DEBUG_BUILD && debug.log(`[Measurement] Setting measurement on root span: ${name} = ${value} ${unit}`);
rootSpan.addEvent(name, {
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: value,
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: unit ,
});
}
}
/**
* Convert timed events to measurements.
*/
function timedEventsToMeasurements(events) {
if (!events || events.length === 0) {
return undefined;
}
const measurements = {};
events.forEach(event => {
const attributes = event.attributes || {};
const unit = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT] ;
const value = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE] ;
if (typeof unit === 'string' && typeof value === 'number') {
measurements[event.name] = { value, unit };
}
});
return measurements;
}
export { setMeasurement, timedEventsToMeasurements };
//# sourceMappingURL=measurement.js.map