generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add request time ruler. refactor calculations (#3356)
![Screenshot 2024-11-07 at 10 59 26 AM](https://github.com/user-attachments/assets/308ecfe4-003c-4c64-b1db-3e631c886919)
- Loading branch information
1 parent
b31c96f
commit f2c318c
Showing
9 changed files
with
95 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,18 @@ | ||
export const TraceGraphRuler = ({ duration }: { duration: number }) => { | ||
const tickInterval = duration / 4 | ||
const ticks = Array.from({ length: 5 }, (_, i) => ({ | ||
value: Math.round(i * tickInterval), | ||
position: `${(i * 100) / 4}%`, | ||
})) | ||
|
||
return ( | ||
<div className='relative border-b border-gray-200 dark:border-gray-600 w-full h-6'> | ||
{ticks.map((tick, index) => ( | ||
<div key={index} className='absolute bottom-0 transform -translate-x-1/2' style={{ left: tick.position }}> | ||
<span className='absolute bottom-2 text-xs font-roboto-mono text-gray-500 dark:text-gray-400 -translate-x-1/2 whitespace-nowrap'>{tick.value}ms</span> | ||
<span className='block h-2 w-[1px] bg-gray-200 dark:bg-gray-600' /> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} |
This file contains 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,13 @@ | ||
import { TraceGraphRuler } from './TraceGraphRuler' | ||
|
||
export const TraceRulerItem = ({ duration }: { duration: number }) => { | ||
return ( | ||
<li key='trace-ruler-item' className='flex items-center justify-between px-2'> | ||
<span className='flex items-center w-1/2 text-sm gap-x-2 font-medium' /> | ||
<div className='relative w-2/3 h-full flex-grow'> | ||
<TraceGraphRuler duration={duration} /> | ||
</div> | ||
<span className='text-xs font-medium ml-4 w-20 text-right' /> | ||
</li> | ||
) | ||
} |
This file contains 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 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 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