From c6fbdd8027e164099aa8f90f8c0ce4ec3e6a781a Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Sun, 8 Sep 2024 13:29:48 +0200 Subject: [PATCH 1/2] feat(core): Allow adding measurements without global client --- packages/core/src/tracing/measurement.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/tracing/measurement.ts b/packages/core/src/tracing/measurement.ts index 817569a03930..7ed3034c4b6c 100644 --- a/packages/core/src/tracing/measurement.ts +++ b/packages/core/src/tracing/measurement.ts @@ -8,8 +8,7 @@ import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; /** * Adds a measurement to the current active transaction. */ -export function setMeasurement(name: string, value: number, unit: MeasurementUnit): void { - const activeSpan = getActiveSpan(); +export function setMeasurement(name: string, value: number, unit: MeasurementUnit, activeSpan = getActiveSpan()): void { const rootSpan = activeSpan && getRootSpan(activeSpan); if (rootSpan) { From e0ebe5ba44d3d4218b362ab32c3ed73602540948 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Mon, 9 Sep 2024 12:12:54 +0200 Subject: [PATCH 2/2] Change docs --- packages/core/src/tracing/measurement.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/tracing/measurement.ts b/packages/core/src/tracing/measurement.ts index 7ed3034c4b6c..c8802023bf2e 100644 --- a/packages/core/src/tracing/measurement.ts +++ b/packages/core/src/tracing/measurement.ts @@ -6,7 +6,8 @@ import { import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; /** - * Adds a measurement to the current active transaction. + * Adds a measurement to the active transaction on the current global scope. You can optionally pass in a different span + * as the 4th parameter. */ export function setMeasurement(name: string, value: number, unit: MeasurementUnit, activeSpan = getActiveSpan()): void { const rootSpan = activeSpan && getRootSpan(activeSpan);