MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / markAsInstrumented

Function markAsInstrumented

packages/cloudflare/src/instrument.ts:31–45  ·  view source on GitHub ↗
(original: T, instrumented?: T)

Source from the content-addressed store, hash-verified

29 * @param instrumented The instrumented version (defaults to original if not provided)
30 */
31export function markAsInstrumented<T>(original: T, instrumented?: T): void {
32 try {
33 if (isWeakMapKey(original)) {
34 // Store mapping from original to instrumented version
35 // If instrumented is not provided, store original (for backwards compat)
36 getInstrumentedMap().set(original, instrumented ?? original);
37 }
38 // Also mark the instrumented version itself so we recognize it
39 if (isWeakMapKey(instrumented) && instrumented !== original) {
40 getInstrumentedMap().set(instrumented, instrumented);
41 }
42 } catch {
43 // ignore errors here
44 }
45}
46
47/**
48 * Get the instrumented version of an object, if available.

Callers 3

instrument.test.tsFile · 0.90
withSentry.test.tsFile · 0.90
ensureInstrumentedFunction · 0.70

Calls 3

isWeakMapKeyFunction · 0.85
getInstrumentedMapFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected