@sentry/core 10.32.0-alpha.0 → 10.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/attributes.js +74 -57
- package/build/cjs/attributes.js.map +1 -1
- package/build/cjs/client.js +6 -11
- package/build/cjs/client.js.map +1 -1
- package/build/cjs/envelope.js +7 -41
- package/build/cjs/envelope.js.map +1 -1
- package/build/cjs/index.js +0 -29
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/eventFilters.js +1 -1
- package/build/cjs/integrations/eventFilters.js.map +1 -1
- package/build/cjs/integrations/requestdata.js +6 -72
- package/build/cjs/integrations/requestdata.js.map +1 -1
- package/build/cjs/logs/internal.js +8 -54
- package/build/cjs/logs/internal.js.map +1 -1
- package/build/cjs/scope.js +12 -6
- package/build/cjs/scope.js.map +1 -1
- package/build/cjs/semanticAttributes.js +0 -36
- package/build/cjs/semanticAttributes.js.map +1 -1
- package/build/cjs/tracing/sentrySpan.js +0 -31
- package/build/cjs/tracing/sentrySpan.js.map +1 -1
- package/build/cjs/tracing/trace.js +0 -1
- package/build/cjs/tracing/trace.js.map +1 -1
- package/build/cjs/tracing/vercel-ai/index.js +0 -1
- package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
- package/build/cjs/utils/applyScopeDataToEvent.js +1 -4
- package/build/cjs/utils/applyScopeDataToEvent.js.map +1 -1
- package/build/cjs/utils/featureFlags.js +0 -1
- package/build/cjs/utils/featureFlags.js.map +1 -1
- package/build/cjs/utils/should-ignore-span.js +9 -31
- package/build/cjs/utils/should-ignore-span.js.map +1 -1
- package/build/cjs/utils/spanUtils.js +2 -101
- package/build/cjs/utils/spanUtils.js.map +1 -1
- package/build/cjs/utils/version.js +1 -1
- package/build/cjs/utils/version.js.map +1 -1
- package/build/esm/attributes.js +74 -58
- package/build/esm/attributes.js.map +1 -1
- package/build/esm/client.js +1 -6
- package/build/esm/client.js.map +1 -1
- package/build/esm/envelope.js +8 -41
- package/build/esm/envelope.js.map +1 -1
- package/build/esm/index.js +3 -9
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/eventFilters.js +1 -1
- package/build/esm/integrations/eventFilters.js.map +1 -1
- package/build/esm/integrations/requestdata.js +6 -72
- package/build/esm/integrations/requestdata.js.map +1 -1
- package/build/esm/logs/internal.js +9 -54
- package/build/esm/logs/internal.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/scope.js +12 -6
- package/build/esm/scope.js.map +1 -1
- package/build/esm/semanticAttributes.js +1 -26
- package/build/esm/semanticAttributes.js.map +1 -1
- package/build/esm/tracing/sentrySpan.js +1 -32
- package/build/esm/tracing/sentrySpan.js.map +1 -1
- package/build/esm/tracing/trace.js +0 -1
- package/build/esm/tracing/trace.js.map +1 -1
- package/build/esm/tracing/vercel-ai/index.js +0 -1
- package/build/esm/tracing/vercel-ai/index.js.map +1 -1
- package/build/esm/utils/applyScopeDataToEvent.js +1 -4
- package/build/esm/utils/applyScopeDataToEvent.js.map +1 -1
- package/build/esm/utils/featureFlags.js +0 -1
- package/build/esm/utils/featureFlags.js.map +1 -1
- package/build/esm/utils/should-ignore-span.js +9 -31
- package/build/esm/utils/should-ignore-span.js.map +1 -1
- package/build/esm/utils/spanUtils.js +3 -97
- package/build/esm/utils/spanUtils.js.map +1 -1
- package/build/esm/utils/version.js +1 -1
- package/build/esm/utils/version.js.map +1 -1
- package/build/types/attributes.d.ts +18 -5
- package/build/types/attributes.d.ts.map +1 -1
- package/build/types/client.d.ts +2 -40
- package/build/types/client.d.ts.map +1 -1
- package/build/types/envelope.d.ts +1 -6
- package/build/types/envelope.d.ts.map +1 -1
- package/build/types/index.d.ts +4 -10
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/requestdata.d.ts.map +1 -1
- package/build/types/logs/internal.d.ts +1 -9
- package/build/types/logs/internal.d.ts.map +1 -1
- package/build/types/scope.d.ts +12 -6
- package/build/types/scope.d.ts.map +1 -1
- package/build/types/semanticAttributes.d.ts +0 -21
- package/build/types/semanticAttributes.d.ts.map +1 -1
- package/build/types/tracing/sentrySpan.d.ts +1 -10
- package/build/types/tracing/sentrySpan.d.ts.map +1 -1
- package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
- package/build/types/types-hoist/envelope.d.ts +2 -22
- package/build/types/types-hoist/envelope.d.ts.map +1 -1
- package/build/types/types-hoist/link.d.ts +2 -2
- package/build/types/types-hoist/link.d.ts.map +1 -1
- package/build/types/types-hoist/log.d.ts +2 -14
- package/build/types/types-hoist/log.d.ts.map +1 -1
- package/build/types/types-hoist/options.d.ts +2 -18
- package/build/types/types-hoist/options.d.ts.map +1 -1
- package/build/types/types-hoist/span.d.ts +0 -27
- package/build/types/types-hoist/span.d.ts.map +1 -1
- package/build/types/utils/applyScopeDataToEvent.d.ts +1 -1
- package/build/types/utils/applyScopeDataToEvent.d.ts.map +1 -1
- package/build/types/utils/featureFlags.d.ts.map +1 -1
- package/build/types/utils/should-ignore-span.d.ts +3 -3
- package/build/types/utils/should-ignore-span.d.ts.map +1 -1
- package/build/types/utils/spanUtils.d.ts +2 -26
- package/build/types/utils/spanUtils.d.ts.map +1 -1
- package/build/types-ts3.8/attributes.d.ts +18 -5
- package/build/types-ts3.8/client.d.ts +2 -40
- package/build/types-ts3.8/envelope.d.ts +1 -6
- package/build/types-ts3.8/index.d.ts +4 -10
- package/build/types-ts3.8/logs/internal.d.ts +1 -9
- package/build/types-ts3.8/scope.d.ts +12 -6
- package/build/types-ts3.8/semanticAttributes.d.ts +0 -21
- package/build/types-ts3.8/tracing/sentrySpan.d.ts +1 -10
- package/build/types-ts3.8/types-hoist/envelope.d.ts +2 -22
- package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
- package/build/types-ts3.8/types-hoist/log.d.ts +2 -14
- package/build/types-ts3.8/types-hoist/options.d.ts +2 -18
- package/build/types-ts3.8/types-hoist/span.d.ts +0 -27
- package/build/types-ts3.8/utils/applyScopeDataToEvent.d.ts +1 -1
- package/build/types-ts3.8/utils/should-ignore-span.d.ts +3 -3
- package/build/types-ts3.8/utils/spanUtils.d.ts +2 -26
- package/package.json +1 -1
- package/build/cjs/integrations/serverSpanStreaming.js +0 -51
- package/build/cjs/integrations/serverSpanStreaming.js.map +0 -1
- package/build/cjs/spans/captureSpan.js +0 -107
- package/build/cjs/spans/captureSpan.js.map +0 -1
- package/build/cjs/spans/spanBuffer.js +0 -117
- package/build/cjs/spans/spanBuffer.js.map +0 -1
- package/build/cjs/spans/spanFirstUtils.js +0 -187
- package/build/cjs/spans/spanFirstUtils.js.map +0 -1
- package/build/cjs/utils/beforeSendSpan.js +0 -36
- package/build/cjs/utils/beforeSendSpan.js.map +0 -1
- package/build/esm/integrations/serverSpanStreaming.js +0 -49
- package/build/esm/integrations/serverSpanStreaming.js.map +0 -1
- package/build/esm/spans/captureSpan.js +0 -105
- package/build/esm/spans/captureSpan.js.map +0 -1
- package/build/esm/spans/spanBuffer.js +0 -115
- package/build/esm/spans/spanBuffer.js.map +0 -1
- package/build/esm/spans/spanFirstUtils.js +0 -183
- package/build/esm/spans/spanFirstUtils.js.map +0 -1
- package/build/esm/utils/beforeSendSpan.js +0 -33
- package/build/esm/utils/beforeSendSpan.js.map +0 -1
- package/build/types/integrations/serverSpanStreaming.d.ts +0 -8
- package/build/types/integrations/serverSpanStreaming.d.ts.map +0 -1
- package/build/types/spans/captureSpan.d.ts +0 -10
- package/build/types/spans/captureSpan.d.ts.map +0 -1
- package/build/types/spans/spanBuffer.d.ts +0 -31
- package/build/types/spans/spanBuffer.d.ts.map +0 -1
- package/build/types/spans/spanFirstUtils.d.ts +0 -20
- package/build/types/spans/spanFirstUtils.d.ts.map +0 -1
- package/build/types/types-hoist/attributes.d.ts +0 -19
- package/build/types/types-hoist/attributes.d.ts.map +0 -1
- package/build/types/utils/beforeSendSpan.d.ts +0 -22
- package/build/types/utils/beforeSendSpan.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/serverSpanStreaming.d.ts +0 -8
- package/build/types-ts3.8/spans/captureSpan.d.ts +0 -10
- package/build/types-ts3.8/spans/spanBuffer.d.ts +0 -31
- package/build/types-ts3.8/spans/spanFirstUtils.d.ts +0 -20
- package/build/types-ts3.8/types-hoist/attributes.d.ts +0 -19
- package/build/types-ts3.8/utils/beforeSendSpan.d.ts +0 -22
package/build/cjs/attributes.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const debugBuild = require('./debug-build.js');
|
|
4
|
-
const debugLogger = require('./utils/debug-logger.js');
|
|
5
|
-
|
|
6
3
|
/**
|
|
7
4
|
* Type-guard: The attribute object has the shape the official attribute object (value, type, unit).
|
|
8
5
|
* https://develop.sentry.dev/sdk/telemetry/scopes/#setting-attributes
|
|
@@ -19,33 +16,88 @@ function isAttributeObject(maybeObj) {
|
|
|
19
16
|
/**
|
|
20
17
|
* Converts an attribute value to a typed attribute value.
|
|
21
18
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
19
|
+
* For now, we intentionally only support primitive values and attribute objects with primitive values.
|
|
20
|
+
* If @param useFallback is true, we stringify non-primitive values to a string attribute value. Otherwise
|
|
21
|
+
* we return `undefined` for unsupported values.
|
|
24
22
|
*
|
|
25
23
|
* @param value - The value of the passed attribute.
|
|
24
|
+
* @param useFallback - If true, unsupported values will be stringified to a string attribute value.
|
|
25
|
+
* Defaults to false. In this case, `undefined` is returned for unsupported values.
|
|
26
26
|
* @returns The typed attribute.
|
|
27
27
|
*/
|
|
28
|
-
function attributeValueToTypedAttributeValue(
|
|
28
|
+
function attributeValueToTypedAttributeValue(
|
|
29
|
+
rawValue,
|
|
30
|
+
useFallback,
|
|
31
|
+
) {
|
|
29
32
|
const { value, unit } = isAttributeObject(rawValue) ? rawValue : { value: rawValue, unit: undefined };
|
|
30
|
-
|
|
31
|
-
}
|
|
33
|
+
const attributeValue = getTypedAttributeValue(value);
|
|
34
|
+
const checkedUnit = unit && typeof unit === 'string' ? { unit } : {};
|
|
35
|
+
if (attributeValue) {
|
|
36
|
+
return { ...attributeValue, ...checkedUnit };
|
|
37
|
+
}
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
if (!useFallback) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
// Fallback: stringify the value
|
|
44
|
+
// TODO(v11): be smarter here and use String constructor if stringify fails
|
|
45
|
+
// (this is a breaking change for already existing attribute values)
|
|
46
|
+
let stringValue = '';
|
|
47
|
+
try {
|
|
48
|
+
stringValue = JSON.stringify(value) ?? '';
|
|
49
|
+
} catch {
|
|
50
|
+
// Do nothing
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
value: stringValue,
|
|
54
|
+
type: 'string',
|
|
55
|
+
...checkedUnit,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
46
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Serializes raw attributes to typed attributes as expected in our envelopes.
|
|
61
|
+
*
|
|
62
|
+
* @param attributes The raw attributes to serialize.
|
|
63
|
+
* @param fallback If true, unsupported values will be stringified to a string attribute value.
|
|
64
|
+
* Defaults to false. In this case, `undefined` is returned for unsupported values.
|
|
65
|
+
*
|
|
66
|
+
* @returns The serialized attributes.
|
|
67
|
+
*/
|
|
68
|
+
function serializeAttributes(attributes, fallback = false) {
|
|
69
|
+
const serializedAttributes = {};
|
|
70
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
71
|
+
const typedValue = attributeValueToTypedAttributeValue(value, fallback);
|
|
72
|
+
if (typedValue) {
|
|
73
|
+
serializedAttributes[key] = typedValue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return serializedAttributes;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* NOTE: We intentionally do not return anything for non-primitive values:
|
|
81
|
+
* - array support will come in the future but if we stringify arrays now,
|
|
82
|
+
* sending arrays (unstringified) later will be a subtle breaking change.
|
|
83
|
+
* - Objects are not supported yet and product support is still TBD.
|
|
84
|
+
* - We still keep the type signature for TypedAttributeValue wider to avoid a
|
|
85
|
+
* breaking change once we add support for non-primitive values.
|
|
86
|
+
* - Once we go back to supporting arrays and stringifying all other values,
|
|
87
|
+
* we already implemented the serialization logic here:
|
|
88
|
+
* https://github.com/getsentry/sentry-javascript/pull/18165
|
|
89
|
+
*/
|
|
47
90
|
function getTypedAttributeValue(value) {
|
|
48
|
-
const primitiveType =
|
|
91
|
+
const primitiveType =
|
|
92
|
+
typeof value === 'string'
|
|
93
|
+
? 'string'
|
|
94
|
+
: typeof value === 'boolean'
|
|
95
|
+
? 'boolean'
|
|
96
|
+
: typeof value === 'number' && !Number.isNaN(value)
|
|
97
|
+
? Number.isInteger(value)
|
|
98
|
+
? 'integer'
|
|
99
|
+
: 'double'
|
|
100
|
+
: null;
|
|
49
101
|
if (primitiveType) {
|
|
50
102
|
// @ts-expect-error - TS complains because {@link TypedAttributeValue} is strictly typed to
|
|
51
103
|
// avoid setting the wrong `type` on the attribute value.
|
|
@@ -55,44 +107,9 @@ function getTypedAttributeValue(value) {
|
|
|
55
107
|
// Therefore, we ignore it.
|
|
56
108
|
return { value, type: primitiveType };
|
|
57
109
|
}
|
|
58
|
-
|
|
59
|
-
if (Array.isArray(value)) {
|
|
60
|
-
const coherentArrayType = value.reduce((acc, item) => {
|
|
61
|
-
if (!acc || getPrimitiveType(item) !== acc) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return acc;
|
|
65
|
-
}, getPrimitiveType(value[0]));
|
|
66
|
-
|
|
67
|
-
if (coherentArrayType) {
|
|
68
|
-
return { value, type: `${coherentArrayType}[]` };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Fallback: stringify the passed value
|
|
73
|
-
let fallbackValue = '';
|
|
74
|
-
try {
|
|
75
|
-
fallbackValue = JSON.stringify(value) ?? String(value);
|
|
76
|
-
} catch {
|
|
77
|
-
try {
|
|
78
|
-
fallbackValue = String(value);
|
|
79
|
-
} catch {
|
|
80
|
-
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Failed to stringify attribute value', value);
|
|
81
|
-
// ignore
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// This is quite a low-quality message but we cannot safely log the original `value`
|
|
86
|
-
// here due to String() or JSON.stringify() potentially throwing.
|
|
87
|
-
debugBuild.DEBUG_BUILD &&
|
|
88
|
-
debugLogger.debug.log(`Stringified attribute value to ${fallbackValue} because it's not a supported attribute value type`);
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
value: fallbackValue,
|
|
92
|
-
type: 'string',
|
|
93
|
-
};
|
|
94
110
|
}
|
|
95
111
|
|
|
96
112
|
exports.attributeValueToTypedAttributeValue = attributeValueToTypedAttributeValue;
|
|
97
113
|
exports.isAttributeObject = isAttributeObject;
|
|
114
|
+
exports.serializeAttributes = serializeAttributes;
|
|
98
115
|
//# sourceMappingURL=attributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.js","sources":["../../src/attributes.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"attributes.js","sources":["../../src/attributes.ts"],"sourcesContent":["import type { DurationUnit, FractionUnit, InformationUnit } from './types-hoist/measurement';\n\nexport type RawAttributes<T> = T & ValidatedAttributes<T>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type RawAttribute<T> = T extends { value: any } | { unit: any } ? AttributeObject : T;\n\nexport type Attributes = Record<string, TypedAttributeValue>;\n\nexport type AttributeValueType = string | number | boolean | Array<string> | Array<number> | Array<boolean>;\n\ntype AttributeTypeMap = {\n string: string;\n integer: number;\n double: number;\n boolean: boolean;\n 'string[]': Array<string>;\n 'integer[]': Array<number>;\n 'double[]': Array<number>;\n 'boolean[]': Array<boolean>;\n};\n\n/* Generates a type from the AttributeTypeMap like:\n | { value: string; type: 'string' }\n | { value: number; type: 'integer' }\n | { value: number; type: 'double' }\n */\ntype AttributeUnion = {\n [K in keyof AttributeTypeMap]: {\n value: AttributeTypeMap[K];\n type: K;\n };\n}[keyof AttributeTypeMap];\n\nexport type TypedAttributeValue = AttributeUnion & { unit?: AttributeUnit };\n\nexport type AttributeObject = {\n value: unknown;\n unit?: AttributeUnit;\n};\n\n// Unfortunately, we loose type safety if we did something like Exclude<MeasurementUnit, string>\n// so therefore we unionize between the three supported unit categories.\ntype AttributeUnit = DurationUnit | InformationUnit | FractionUnit;\n\n/* If an attribute has either a 'value' or 'unit' property, we use the ValidAttributeObject type. */\nexport type ValidatedAttributes<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends { value: any } | { unit: any } ? AttributeObject : unknown;\n};\n\n/**\n * Type-guard: The attribute object has the shape the official attribute object (value, type, unit).\n * https://develop.sentry.dev/sdk/telemetry/scopes/#setting-attributes\n */\nexport function isAttributeObject(maybeObj: unknown): maybeObj is AttributeObject {\n return (\n typeof maybeObj === 'object' &&\n maybeObj != null &&\n !Array.isArray(maybeObj) &&\n Object.keys(maybeObj).includes('value')\n );\n}\n\n/**\n * Converts an attribute value to a typed attribute value.\n *\n * For now, we intentionally only support primitive values and attribute objects with primitive values.\n * If @param useFallback is true, we stringify non-primitive values to a string attribute value. Otherwise\n * we return `undefined` for unsupported values.\n *\n * @param value - The value of the passed attribute.\n * @param useFallback - If true, unsupported values will be stringified to a string attribute value.\n * Defaults to false. In this case, `undefined` is returned for unsupported values.\n * @returns The typed attribute.\n */\nexport function attributeValueToTypedAttributeValue(\n rawValue: unknown,\n useFallback?: boolean,\n): TypedAttributeValue | void {\n const { value, unit } = isAttributeObject(rawValue) ? rawValue : { value: rawValue, unit: undefined };\n const attributeValue = getTypedAttributeValue(value);\n const checkedUnit = unit && typeof unit === 'string' ? { unit } : {};\n if (attributeValue) {\n return { ...attributeValue, ...checkedUnit };\n }\n\n if (!useFallback) {\n return;\n }\n\n // Fallback: stringify the value\n // TODO(v11): be smarter here and use String constructor if stringify fails\n // (this is a breaking change for already existing attribute values)\n let stringValue = '';\n try {\n stringValue = JSON.stringify(value) ?? '';\n } catch {\n // Do nothing\n }\n return {\n value: stringValue,\n type: 'string',\n ...checkedUnit,\n };\n}\n\n/**\n * Serializes raw attributes to typed attributes as expected in our envelopes.\n *\n * @param attributes The raw attributes to serialize.\n * @param fallback If true, unsupported values will be stringified to a string attribute value.\n * Defaults to false. In this case, `undefined` is returned for unsupported values.\n *\n * @returns The serialized attributes.\n */\nexport function serializeAttributes<T>(attributes: RawAttributes<T>, fallback: boolean = false): Attributes {\n const serializedAttributes: Attributes = {};\n for (const [key, value] of Object.entries(attributes)) {\n const typedValue = attributeValueToTypedAttributeValue(value, fallback);\n if (typedValue) {\n serializedAttributes[key] = typedValue;\n }\n }\n return serializedAttributes;\n}\n\n/**\n * NOTE: We intentionally do not return anything for non-primitive values:\n * - array support will come in the future but if we stringify arrays now,\n * sending arrays (unstringified) later will be a subtle breaking change.\n * - Objects are not supported yet and product support is still TBD.\n * - We still keep the type signature for TypedAttributeValue wider to avoid a\n * breaking change once we add support for non-primitive values.\n * - Once we go back to supporting arrays and stringifying all other values,\n * we already implemented the serialization logic here:\n * https://github.com/getsentry/sentry-javascript/pull/18165\n */\nfunction getTypedAttributeValue(value: unknown): TypedAttributeValue | void {\n const primitiveType =\n typeof value === 'string'\n ? 'string'\n : typeof value === 'boolean'\n ? 'boolean'\n : typeof value === 'number' && !Number.isNaN(value)\n ? Number.isInteger(value)\n ? 'integer'\n : 'double'\n : null;\n if (primitiveType) {\n // @ts-expect-error - TS complains because {@link TypedAttributeValue} is strictly typed to\n // avoid setting the wrong `type` on the attribute value.\n // In this case, getPrimitiveType already does the check but TS doesn't know that.\n // The \"clean\" alternative is to return an object per `typeof value` case\n // but that would require more bundle size\n // Therefore, we ignore it.\n return { value, type: primitiveType };\n }\n}\n"],"names":[],"mappings":";;AAkDA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAAwC;AAClF,EAAE;AACF,IAAI,OAAO,QAAA,KAAa,QAAA;AACxB,IAAI,QAAA,IAAY,IAAA;AAChB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAA;AAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mCAAmC;AACnD,EAAE,QAAQ;AACV,EAAE,WAAW;AACb,EAA8B;AAC9B,EAAE,MAAM,EAAE,KAAK,EAAE,MAAK,GAAI,iBAAiB,CAAC,QAAQ,CAAA,GAAI,QAAA,GAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAA,EAAW;AACvG,EAAE,MAAM,cAAA,GAAiB,sBAAsB,CAAC,KAAK,CAAC;AACtD,EAAE,MAAM,WAAA,GAAc,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,GAAW,EAAE,IAAA,EAAK,GAAI,EAAE;AACtE,EAAE,IAAI,cAAc,EAAE;AACtB,IAAI,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,aAAa;AAChD,EAAE;;AAEF,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA,EAAE,IAAI,WAAA,GAAc,EAAE;AACtB,EAAE,IAAI;AACN,IAAI,WAAA,GAAc,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA,IAAK,EAAE;AAC7C,EAAE,EAAE,MAAM;AACV;AACA,EAAE;AACF,EAAE,OAAO;AACT,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,GAAG,WAAW;AAClB,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAI,UAAU,EAAoB,QAAQ,GAAY,KAAK,EAAc;AAC5G,EAAE,MAAM,oBAAoB,GAAe,EAAE;AAC7C,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAA,IAAK,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;AACzD,IAAI,MAAM,aAAa,mCAAmC,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC3E,IAAI,IAAI,UAAU,EAAE;AACpB,MAAM,oBAAoB,CAAC,GAAG,CAAA,GAAI,UAAU;AAC5C,IAAI;AACJ,EAAE;AACF,EAAE,OAAO,oBAAoB;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB,CAAC,KAAK,EAAuC;AAC5E,EAAE,MAAM,aAAA;AACR,IAAI,OAAO,UAAU;AACrB,QAAQ;AACR,QAAQ,OAAO,KAAA,KAAU;AACzB,UAAU;AACV,UAAU,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK;AAC1D,YAAY,MAAM,CAAC,SAAS,CAAC,KAAK;AAClC,cAAc;AACd,cAAc;AACd,YAAY,IAAI;AAChB,EAAE,IAAI,aAAa,EAAE;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe;AACzC,EAAE;AACF;;;;;;"}
|
package/build/cjs/client.js
CHANGED
|
@@ -11,7 +11,6 @@ const internal$1 = require('./metrics/internal.js');
|
|
|
11
11
|
const session = require('./session.js');
|
|
12
12
|
const dynamicSamplingContext = require('./tracing/dynamicSamplingContext.js');
|
|
13
13
|
const base = require('./transports/base.js');
|
|
14
|
-
const beforeSendSpan = require('./utils/beforeSendSpan.js');
|
|
15
14
|
const clientreport = require('./utils/clientreport.js');
|
|
16
15
|
const debugLogger = require('./utils/debug-logger.js');
|
|
17
16
|
const dsn = require('./utils/dsn.js');
|
|
@@ -981,17 +980,13 @@ function _validateBeforeSendResult(
|
|
|
981
980
|
/**
|
|
982
981
|
* Process the matching `beforeSendXXX` callback.
|
|
983
982
|
*/
|
|
984
|
-
|
|
985
983
|
function processBeforeSend(
|
|
986
984
|
client,
|
|
987
985
|
options,
|
|
988
986
|
event,
|
|
989
987
|
hint,
|
|
990
988
|
) {
|
|
991
|
-
const { beforeSend, beforeSendTransaction, ignoreSpans } = options;
|
|
992
|
-
|
|
993
|
-
const beforeSendSpan$1 = !beforeSendSpan.isV2BeforeSendSpanCallback(options.beforeSendSpan) && options.beforeSendSpan;
|
|
994
|
-
|
|
989
|
+
const { beforeSend, beforeSendTransaction, beforeSendSpan, ignoreSpans } = options;
|
|
995
990
|
let processedEvent = event;
|
|
996
991
|
|
|
997
992
|
if (isErrorEvent(processedEvent) && beforeSend) {
|
|
@@ -1000,7 +995,7 @@ function processBeforeSend(
|
|
|
1000
995
|
|
|
1001
996
|
if (isTransactionEvent(processedEvent)) {
|
|
1002
997
|
// Avoid processing if we don't have to
|
|
1003
|
-
if (beforeSendSpan
|
|
998
|
+
if (beforeSendSpan || ignoreSpans) {
|
|
1004
999
|
// 1. Process root span
|
|
1005
1000
|
const rootSpanJson = transactionEvent.convertTransactionEventToSpanJson(processedEvent);
|
|
1006
1001
|
|
|
@@ -1011,8 +1006,8 @@ function processBeforeSend(
|
|
|
1011
1006
|
}
|
|
1012
1007
|
|
|
1013
1008
|
// 1.2 If a `beforeSendSpan` callback is defined, process the root span
|
|
1014
|
-
if (beforeSendSpan
|
|
1015
|
-
const processedRootSpanJson = beforeSendSpan
|
|
1009
|
+
if (beforeSendSpan) {
|
|
1010
|
+
const processedRootSpanJson = beforeSendSpan(rootSpanJson);
|
|
1016
1011
|
if (!processedRootSpanJson) {
|
|
1017
1012
|
spanUtils.showSpanDropWarning();
|
|
1018
1013
|
} else {
|
|
@@ -1035,8 +1030,8 @@ function processBeforeSend(
|
|
|
1035
1030
|
}
|
|
1036
1031
|
|
|
1037
1032
|
// 2.b If a `beforeSendSpan` callback is defined, process the child span
|
|
1038
|
-
if (beforeSendSpan
|
|
1039
|
-
const processedSpan = beforeSendSpan
|
|
1033
|
+
if (beforeSendSpan) {
|
|
1034
|
+
const processedSpan = beforeSendSpan(span);
|
|
1040
1035
|
if (!processedSpan) {
|
|
1041
1036
|
spanUtils.showSpanDropWarning();
|
|
1042
1037
|
processedSpans.push(span);
|