Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(core): Support array attributes for spans, logs and metrics#20427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
74ee2fe2d84168fa70b75aa3b2b1a71058e467dfcc5f62ad74b05596e8521207cd226a735bbe8d9a8974a26bdc050bdc74cb94756fa0dbdec711703ad724e201a685120adc34f896f3af76bca21538b0df24852d516cb6a15ebfc16f10a4f6ecadb5068b6f8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,10 +15,7 @@ type AttributeTypeMap = { | ||
| integer: number; | ||
| double: number; | ||
| boolean: boolean; | ||
| 'string[]': Array<string>; | ||
| 'integer[]': Array<number>; | ||
| 'double[]': Array<number>; | ||
| 'boolean[]': Array<boolean>; | ||
| array: Array<string> | Array<number> | Array<boolean>; | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: Would be MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mhm not sure. I assume relay enforces some number maximum but no idea what that is. | ||
| }; | ||
| /* Generates a type from the AttributeTypeMap like: | ||
| @@ -66,9 +63,9 @@ export function isAttributeObject(maybeObj: unknown): maybeObj is AttributeObjec | ||
| /** | ||
| * Converts an attribute value to a typed attribute value. | ||
| * | ||
| * For now, we intentionally only support primitive values and attribute objects with primitive values. | ||
| * If @param useFallback is true, we stringify non-primitive values to a string attribute value. Otherwise | ||
| * we return `undefined` for unsupported values. | ||
| * For now, we support primitive values and arrays, either raw or inside attribute objects. | ||
| * If @param useFallback is true, we stringify other non-primitive values to a string attribute | ||
| * value. Otherwise we return `undefined` for unsupported values. | ||
| * | ||
| * @param value - The value of the passed attribute. | ||
| * @param useFallback - If true, unsupported values will be stringified to a string attribute value. | ||
| @@ -170,17 +167,15 @@ function estimatePrimitiveSizeInBytes(value: Primitive): number { | ||
| } | ||
| /** | ||
| * NOTE: We intentionally do not return anything for non-primitive values: | ||
| * - array support will come in the future but if we stringify arrays now, | ||
| * sending arrays (unstringified) later will be a subtle breaking change. | ||
| * NOTE: We return typed attributes for primitives and arrays: | ||
| * - Relay currently only supports arrays consisting of primitive values. Attributes with non-conforming arrays are dropped by Relay, so runtime type validation in the SDK is unnecessary. | ||
| * - Objects are not supported yet and product support is still TBD. | ||
| * - We still keep the type signature for TypedAttributeValue wider to avoid a | ||
| * breaking change once we add support for non-primitive values. | ||
| * - Once we go back to supporting arrays and stringifying all other values, | ||
| * we already implemented the serialization logic here: | ||
| * https://github.com/getsentry/sentry-javascript/pull/18165 | ||
| */ | ||
| function getTypedAttributeValue(value: unknown): TypedAttributeValue | void { | ||
| if (Array.isArray(value)) { | ||
| return { value, type: 'array' }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixed-type array console parameters silently dropped by RelayMedium Severity The Reviewed by Cursor Bugbot for commit f896f3a. Configure here. MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is basically what I described in the PR description, we can discuss it but I think this is a tradeoff we have to make. don't think we can really solve this unless we do runtime inspection of the types of elements in arrays | ||
| } | ||
| const primitiveType = | ||
| typeof value === 'string' | ||
| ? 'string' | ||
Uh oh!
There was an error while loading. Please reload this page.


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pulling this one in.