-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(otlp): Parse JSON-looking attributes in span attributes panel #95544
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
feat(otlp): Parse JSON-looking attributes in span attributes panel #95544
Conversation
| // 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; | ||
| }); | ||
|
|
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.
@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.
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.
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
Lines 200 to 211 in 1afea82
| // 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; | |
| } |
Was this report helpful? Give feedback by reacting with 👍 or 👎
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.
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.
…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" />
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.,
