Skip to content

Conversation

@gggritso
Copy link
Member

Until EAP supports array storage, we are storing array attributes as JSON-encoded strings. Since we can't know all array attribute names ahead of time, scan through the attributes and look for any value that seems like it'll be a JSON array, and render it using the JSON renderer if appropriate.

Closes OPE-51.

e.g.,
Screenshot 2025-07-15 at 10 11 53 AM

@linear
Copy link

linear bot commented Jul 15, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 15, 2025
Comment on lines +197 to +208
// Some attributes (semantic or otherwise) look like they contain JSON-encoded
// arrays. Use a JSON renderer for any value that looks suspiciously like it's
// a JSON-encoded array. NOTE: This happens a lot because EAP doesn't support
// array values, so SDKs often store array values as JSON-encoded strings.
sortedAndFilteredAttributes.forEach(attribute => {
if (Object.hasOwn(customRenderers, attribute.name)) return;
if (attribute.type !== 'str') return;
if (!looksLikeAJSONArray(attribute.value)) return;

customRenderers[attribute.name] = jsonRenderer;
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArthurKnaus most of the AI semantic attributes fall under this category, but I'm not confident which ones and when. If you like, it'd be good to remove any known array attributes from the JSON_ATTRIBUTES list.

@gggritso gggritso marked this pull request as ready for review July 15, 2025 14:26
@gggritso gggritso requested a review from a team July 15, 2025 14:26
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Custom Renderers Overwritten by Truncation Loop

The TRUNCATED_TEXT_ATTRIBUTES loop unconditionally overwrites custom renderers, unlike the dynamic JSON detection which checks for existing renderers. This results in attributes that are both auto-detected as JSON arrays and listed in TRUNCATED_TEXT_ATTRIBUTES being incorrectly rendered as truncated text instead of parsed JSON.

static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/attributes.tsx#L200-L211

// array values, so SDKs often store array values as JSON-encoded strings.
sortedAndFilteredAttributes.forEach(attribute => {
if (Object.hasOwn(customRenderers, attribute.name)) return;
if (attribute.type !== 'str') return;
if (!looksLikeAJSONArray(attribute.value)) return;
customRenderers[attribute.name] = jsonRenderer;
});
for (const attribute of TRUNCATED_TEXT_ATTRIBUTES) {
customRenderers[attribute] = truncatedTextRenderer;
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Contributor

@Abdkhan14 Abdkhan14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, we custom render the string value as an array, and should be able to search by the string value in explore (through cell actions). We keep assuming that everything in trace-item -> attributes is searchable in explore.

@gggritso gggritso merged commit 36ecbdc into master Jul 15, 2025
47 checks passed
@gggritso gggritso deleted the georgegritsouk/ope-51-render-array-values-nicely-for-real branch July 15, 2025 16:05
andrewshie-sentry pushed a commit that referenced this pull request Jul 21, 2025
…95544)

Until EAP supports array storage, we are storing array attributes as
JSON-encoded strings. Since we can't know all array attribute names
ahead of time, scan through the attributes and look for any value that
_seems_ like it'll be a JSON array, and render it using the JSON
renderer if appropriate.

Closes OPE-51.

**e.g.,**
<img width="849" height="214" alt="Screenshot 2025-07-15 at 10 11 53 AM"
src="https://github.com/user-attachments/assets/0cf9eae3-e7c5-4c96-873e-c0e8a074cf96"
/>
@github-actions github-actions bot locked and limited conversation to collaborators Jul 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants