Repository navigation
feat: Add custom trace-level attributes above trace waterfall #1356
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
744024c
feat: Add custom trace-level attributes above trace waterfall
pulpdrew 617bd16
fix: Clear filter state when URL filters param is removed
pulpdrew d895a3a
test: Fix tests
pulpdrew ad3fdf3
feat: Improvements to the custom trace attributes
pulpdrew f6e12c8
test: Add additional tests for getAttributesFromData
pulpdrew 2f5d71f
refactor: Rename highlightedTraceAttributeExpressions
pulpdrew c1f6abd
refactor: Create DBHighlightedAttributesList and related utils
pulpdrew 9dd50a7
review: Fix style
pulpdrew 31cb5e9
Merge branch 'main' into drew/trace-attribute-tags
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@hyperdx/common-utils": patch | ||
| "@hyperdx/api": patch | ||
| "@hyperdx/app": patch | ||
| --- | ||
|
|
||
| feat: Add custom trace-level attributes above trace waterfall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
packages/app/src/components/DBHighlightedAttributesList.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { useContext, useMemo } from 'react'; | ||
| import { TSource } from '@hyperdx/common-utils/dist/types'; | ||
| import { Flex } from '@mantine/core'; | ||
|
|
||
| import { RowSidePanelContext } from './DBRowSidePanel'; | ||
| import EventTag from './EventTag'; | ||
|
|
||
| export type HighlightedAttribute = { | ||
| source: TSource; | ||
| displayedKey: string; | ||
| value: string; | ||
| sql: string; | ||
| lucene?: string; | ||
| }; | ||
|
|
||
| export function DBHighlightedAttributesList({ | ||
| attributes = [], | ||
| }: { | ||
| attributes: HighlightedAttribute[]; | ||
| }) { | ||
| const { | ||
| onPropertyAddClick, | ||
| generateSearchUrl, | ||
| source: contextSource, | ||
| } = useContext(RowSidePanelContext); | ||
|
|
||
| const sortedAttributes = useMemo(() => { | ||
| return attributes.sort( | ||
| (a, b) => | ||
| a.displayedKey.localeCompare(b.displayedKey) || | ||
| a.value.localeCompare(b.value), | ||
| ); | ||
| }, [attributes]); | ||
|
|
||
| return ( | ||
| <Flex wrap="wrap" gap="2px" mb="md"> | ||
| {sortedAttributes.map(({ displayedKey, value, sql, lucene, source }) => ( | ||
| <EventTag | ||
| displayedKey={displayedKey} | ||
| name={lucene ? lucene : sql} | ||
| nameLanguage={lucene ? 'lucene' : 'sql'} | ||
| value={value as string} | ||
| key={`${displayedKey}-${value}-${source.id}`} | ||
| {...(onPropertyAddClick && contextSource?.id === source.id | ||
| ? { | ||
| onPropertyAddClick, | ||
| sqlExpression: sql, | ||
| } | ||
| : { | ||
| onPropertyAddClick: undefined, | ||
| sqlExpression: undefined, | ||
| })} | ||
| generateSearchUrl={ | ||
| generateSearchUrl | ||
| ? (query, queryLanguage) => | ||
| generateSearchUrl({ | ||
| where: query || '', | ||
| whereLanguage: queryLanguage ?? 'lucene', | ||
| source, | ||
| }) | ||
| : undefined | ||
| } | ||
| /> | ||
| ))} | ||
| </Flex> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
does the ordering matter here?
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.
The ordering of elements in this array? No I don't think it matters - the Event Tags are sorted before they're displayed client-side. Why?
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.
since it's an array type, it makes sense to sort them before deploying, or we can sort them during query time
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.
The way we end up sorting them on the UI can depend on the values that are queried for each attribute and for each trace. There also should not be very many attributes (dozens at most, I would guess) so I don't think it should be any issue with sorting them on the client side when used.