-
Notifications
You must be signed in to change notification settings - Fork 458
fix: show spans referencing the current span (#2828) #2868
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
Changes from 5 commits
f26a422
dda5e20
14ad9bc
04e4ea9
966c165
853ce7c
6a73354
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@hyperdx/app": patch | ||
| --- | ||
|
|
||
| feat: show spans referencing the current span in the trace span detail panel ("Referenced By" section) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,17 +21,11 @@ import { ExceptionSubpanel } from './ExceptionSubpanel'; | |||||||||||||||||||||||||||||||||
| import { NetworkPropertySubpanel } from './NetworkPropertyPanel'; | ||||||||||||||||||||||||||||||||||
| import { SpanEventsSubpanel } from './SpanEventsSubpanel'; | ||||||||||||||||||||||||||||||||||
| import { getValidSpanLinks, SpanLinksSubpanel } from './SpanLinksSubpanel'; | ||||||||||||||||||||||||||||||||||
| import { SpansReverseLinksSubpanel } from './SpansReverseLinksSubpanel'; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const EMPTY_OBJ = {}; | ||||||||||||||||||||||||||||||||||
| export function RowOverviewPanel({ | ||||||||||||||||||||||||||||||||||
| source, | ||||||||||||||||||||||||||||||||||
| rowId, | ||||||||||||||||||||||||||||||||||
| aliasWith, | ||||||||||||||||||||||||||||||||||
| dateRange, | ||||||||||||||||||||||||||||||||||
| hideHeader = false, | ||||||||||||||||||||||||||||||||||
| flush = false, | ||||||||||||||||||||||||||||||||||
| 'data-testid': dataTestId, | ||||||||||||||||||||||||||||||||||
| }: { | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| interface DBRowOverviewPanelProps { | ||||||||||||||||||||||||||||||||||
| source: TSource; | ||||||||||||||||||||||||||||||||||
| rowId: string | undefined | null; | ||||||||||||||||||||||||||||||||||
| aliasWith?: WithClause[]; | ||||||||||||||||||||||||||||||||||
|
|
@@ -41,7 +35,22 @@ export function RowOverviewPanel({ | |||||||||||||||||||||||||||||||||
| // surrounding chrome (e.g. the tab bar in the trace span detail panel). | ||||||||||||||||||||||||||||||||||
| flush?: boolean; | ||||||||||||||||||||||||||||||||||
| 'data-testid'?: string; | ||||||||||||||||||||||||||||||||||
| }) { | ||||||||||||||||||||||||||||||||||
| // All spans belonging to the current trace, used to find spans that | ||||||||||||||||||||||||||||||||||
| // reference the currently selected span (reverse span links). This must | ||||||||||||||||||||||||||||||||||
| // be the full trace's span list, NOT just the single selected row. | ||||||||||||||||||||||||||||||||||
| allTraceRows?: Array<Record<string, any>>; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export function RowOverviewPanel({ | ||||||||||||||||||||||||||||||||||
| source, | ||||||||||||||||||||||||||||||||||
| rowId, | ||||||||||||||||||||||||||||||||||
| aliasWith, | ||||||||||||||||||||||||||||||||||
| dateRange, | ||||||||||||||||||||||||||||||||||
| hideHeader = false, | ||||||||||||||||||||||||||||||||||
| flush = false, | ||||||||||||||||||||||||||||||||||
| 'data-testid': dataTestId, | ||||||||||||||||||||||||||||||||||
| allTraceRows, | ||||||||||||||||||||||||||||||||||
| }: DBRowOverviewPanelProps) { | ||||||||||||||||||||||||||||||||||
| const contentPx = flush ? 0 : 'md'; | ||||||||||||||||||||||||||||||||||
| const { data } = useRowData({ source, rowId, aliasWith, dateRange }); | ||||||||||||||||||||||||||||||||||
| const { onPropertyAddClick, generateSearchUrl, onOpenLinkedTrace } = | ||||||||||||||||||||||||||||||||||
|
|
@@ -50,7 +59,7 @@ export function RowOverviewPanel({ | |||||||||||||||||||||||||||||||||
| const highlightedAttributeValues = useMemo(() => { | ||||||||||||||||||||||||||||||||||
| const attributeExpressions = | ||||||||||||||||||||||||||||||||||
| source.kind === SourceKind.Trace || source.kind === SourceKind.Log | ||||||||||||||||||||||||||||||||||
| ? (source.highlightedRowAttributeExpressions ?? []) | ||||||||||||||||||||||||||||||||||
| ? source.highlightedRowAttributeExpressions ?? [] | ||||||||||||||||||||||||||||||||||
| : []; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return data | ||||||||||||||||||||||||||||||||||
|
|
@@ -195,6 +204,31 @@ export function RowOverviewPanel({ | |||||||||||||||||||||||||||||||||
| return getValidSpanLinks(firstRow?.__hdx_span_links).length > 0; | ||||||||||||||||||||||||||||||||||
| }, [firstRow?.__hdx_span_links]); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // P1 fix: scan the FULL trace's spans (allTraceRows), not data.data, | ||||||||||||||||||||||||||||||||||
| // which only ever contains the single selected row from useRowData. | ||||||||||||||||||||||||||||||||||
| const hasReverseSpanLinks = useMemo(() => { | ||||||||||||||||||||||||||||||||||
| if (!firstRow?.SpanId || !Array.isArray(allTraceRows)) { | ||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| const currentSpanId = String(firstRow.SpanId); | ||||||||||||||||||||||||||||||||||
| for (const row of allTraceRows) { | ||||||||||||||||||||||||||||||||||
| if (!row || typeof row !== 'object') continue; | ||||||||||||||||||||||||||||||||||
| const sl = row.__hdx_span_links; | ||||||||||||||||||||||||||||||||||
| if (!Array.isArray(sl)) continue; | ||||||||||||||||||||||||||||||||||
| for (const link of sl) { | ||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||
| link && | ||||||||||||||||||||||||||||||||||
| typeof link === 'object' && | ||||||||||||||||||||||||||||||||||
| 'SpanId' in link && | ||||||||||||||||||||||||||||||||||
| link.SpanId === currentSpanId | ||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+216
to
+227
Contributor
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.
When a trace row has the selected
Suggested change
Knowledge Base Used: App Components and Charts |
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||
| }, [allTraceRows, firstRow?.SpanId]); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const mainContentColumn = getEventBody(source); | ||||||||||||||||||||||||||||||||||
| const mainContent = isString(firstRow?.['__hdx_body']) | ||||||||||||||||||||||||||||||||||
| ? firstRow['__hdx_body'] | ||||||||||||||||||||||||||||||||||
|
|
@@ -226,6 +260,7 @@ export function RowOverviewPanel({ | |||||||||||||||||||||||||||||||||
| 'exception', | ||||||||||||||||||||||||||||||||||
| 'spanEvents', | ||||||||||||||||||||||||||||||||||
| 'spanLinks', | ||||||||||||||||||||||||||||||||||
| 'reverseSpanLinks', | ||||||||||||||||||||||||||||||||||
| 'network', | ||||||||||||||||||||||||||||||||||
| 'resourceAttributes', | ||||||||||||||||||||||||||||||||||
| 'eventAttributes', | ||||||||||||||||||||||||||||||||||
|
|
@@ -342,6 +377,24 @@ export function RowOverviewPanel({ | |||||||||||||||||||||||||||||||||
| </Accordion.Panel> | ||||||||||||||||||||||||||||||||||
| </Accordion.Item> | ||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||
| {hasReverseSpanLinks && ( | ||||||||||||||||||||||||||||||||||
| <Accordion.Item value="reverseSpanLinks"> | ||||||||||||||||||||||||||||||||||
| <Accordion.Control> | ||||||||||||||||||||||||||||||||||
| <Text size="sm" ps="md"> | ||||||||||||||||||||||||||||||||||
| Referenced By | ||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||
| </Accordion.Control> | ||||||||||||||||||||||||||||||||||
| <Accordion.Panel> | ||||||||||||||||||||||||||||||||||
| <Box px="md"> | ||||||||||||||||||||||||||||||||||
| <SpansReverseLinksSubpanel | ||||||||||||||||||||||||||||||||||
| rows={allTraceRows} | ||||||||||||||||||||||||||||||||||
| currentSpanId={firstRow?.SpanId as string | undefined} | ||||||||||||||||||||||||||||||||||
|
greptile-apps[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||
| onOpenTrace={onOpenLinkedTrace} | ||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||
| </Box> | ||||||||||||||||||||||||||||||||||
|
Comment on lines
377
to
+394
Contributor
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 adds the user-visible Referenced By panel to the published application package without a corresponding Context Used: CLAUDE.md (source) Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||||||||||||||||||||||
| </Accordion.Panel> | ||||||||||||||||||||||||||||||||||
| </Accordion.Item> | ||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| {Object.keys(resourceAttributes).length > 0 && ( | ||||||||||||||||||||||||||||||||||
| <Accordion.Item value="resourceAttributes"> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.