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

Function serializeAttributes

packages/core/src/attributes.ts:115–127  ·  view source on GitHub ↗
(
  attributes: RawAttributes<T> | undefined,
  fallback: boolean | 'skip-undefined' = false,
)

Source from the content-addressed store, hash-verified

113 * @returns The serialized attributes.
114 */
115export function serializeAttributes<T>(
116 attributes: RawAttributes<T> | undefined,
117 fallback: boolean | 'skip-undefined' = false,
118): Attributes {
119 const serializedAttributes: Attributes = {};
120 for (const [key, value] of Object.entries(attributes ?? {})) {
121 const typedValue = attributeValueToTypedAttributeValue(value, fallback);
122 if (typedValue) {
123 serializedAttributes[key] = typedValue;
124 }
125 }
126 return serializedAttributes;
127}
128
129/**
130 * Estimates the serialized byte size of {@link Attributes},

Callers 4

attributes.test.tsFile · 0.90
_INTERNAL_captureLogFunction · 0.90
_buildSerializedMetricFunction · 0.90

Calls 2

entriesMethod · 0.65

Tested by

no test coverage detected