Skip to content

Commit

Permalink
fix(studio): Quick fix for trace rendering bug (#9120)
Browse files Browse the repository at this point in the history
Not designed to be permanent. Studio is being ported to a redwood
project instead.
  • Loading branch information
Josh-Walker-GM authored and jtoar committed Sep 2, 2023
1 parent cd5036b commit 95c3a11
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/studio/web/src/Pages/Explore/TraceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ function TraceListComponent({ traces }: { traces: any[] }) {
)
}

const bigIntMin = (...args: bigint[]) => args.reduce((m, e) => (e < m ? e : m))

export default function TraceList() {
const [{ tracesFilter: searchFilter }] = useContext(SearchFilterContext)

Expand All @@ -134,10 +136,8 @@ export default function TraceList() {
},
})

const sortedTraces = data?.rows?.sort((a: any, b: any) => {
const bigIntMin = (...args: bigint[]) =>
args.reduce((m, e) => (e < m ? e : m))

const traces: any[] = data?.rows !== undefined ? [...data.rows] : []
traces.sort((a: any, b: any) => {
const aStart = bigIntMin(...a.spans.map((span: any) => span.startNano))
const bStart = bigIntMin(...b.spans.map((span: any) => span.startNano))
return aStart > bStart ? -1 : bStart > aStart ? 1 : 0
Expand All @@ -150,7 +150,7 @@ export default function TraceList() {
<div className="sm:flex-auto">
<div className="text-base font-semibold leading-6 text-slate-100 px-4 pt-2 pb-2 bg-rich-black rounded-md flex justify-between">
<div>OpenTelemetry Traces</div>
<div>{data?.rows?.length && `(${data.rows.length})`}</div>
<div>{traces.length && `(${traces.length})`}</div>
</div>
</div>
</div>
Expand All @@ -164,7 +164,7 @@ export default function TraceList() {
<LoadingSpinner />
</div>
) : (
<TraceListComponent traces={sortedTraces} />
<TraceListComponent traces={traces} />
)}
</div>
</div>
Expand Down

0 comments on commit 95c3a11

Please sign in to comment.