@@ -34,19 +34,22 @@ type LatencyFilterState = {
3434 value : number ;
3535} ;
3636
37- type MaxLatencyFilterProps = {
37+ type LatencyFilterProps = {
3838 performanceArtifacts : CatalogPerformanceMetricsArtifact [ ] ;
3939} ;
4040
41- const METRIC_OPTIONS : { value : LatencyMetric ; label : LatencyMetric } [ ] = Object . values (
42- LatencyMetric ,
43- ) . map ( ( metric ) => ( { value : metric , label : metric } ) ) ;
41+ // TPS is excluded from filter options for now (will be renamed/reworked in a future ticket)
42+ const METRIC_OPTIONS : { value : LatencyMetric ; label : LatencyMetric } [ ] = [
43+ LatencyMetric . E2E ,
44+ LatencyMetric . TTFT ,
45+ LatencyMetric . ITL ,
46+ ] . map ( ( metric ) => ( { value : metric , label : metric } ) ) ;
4447
4548const PERCENTILE_OPTIONS : { value : LatencyPercentile ; label : LatencyPercentile } [ ] = Object . values (
4649 LatencyPercentile ,
4750) . map ( ( percentile ) => ( { value : percentile , label : percentile } ) ) ;
4851
49- const MaxLatencyFilter : React . FC < MaxLatencyFilterProps > = ( { performanceArtifacts } ) => {
52+ const LatencyFilter : React . FC < LatencyFilterProps > = ( { performanceArtifacts } ) => {
5053 const { filterData, setFilterData } = React . useContext ( ModelCatalogContext ) ;
5154 const [ isOpen , setIsOpen ] = React . useState ( false ) ;
5255 const [ isMetricOpen , setIsMetricOpen ] = React . useState ( false ) ;
@@ -126,12 +129,12 @@ const MaxLatencyFilter: React.FC<MaxLatencyFilterProps> = ({ performanceArtifact
126129 // When there's an active filter, show the full specification with actual selected values
127130 return (
128131 < >
129- < strong > Max latency :</ strong > { currentActiveFilter . metric } |{ ' ' }
130- { currentActiveFilter . percentile } | { currentActiveFilter . value } ms
132+ < strong > Latency :</ strong > { currentActiveFilter . metric } | { currentActiveFilter . percentile } { ' ' }
133+ | { currentActiveFilter . value } ms
131134 </ >
132135 ) ;
133136 }
134- return 'Max latency ' ;
137+ return 'Latency ' ;
135138 } ;
136139
137140 const handleApplyFilter = ( ) => {
@@ -174,25 +177,6 @@ const MaxLatencyFilter: React.FC<MaxLatencyFilterProps> = ({ performanceArtifact
174177 flexWrap = { { default : 'wrap' } }
175178 style = { { width : '550px' , padding : '16px' } }
176179 >
177- < FlexItem >
178- < Flex alignItems = { { default : 'alignItemsCenter' } } spaceItems = { { default : 'spaceItemsXs' } } >
179- < FlexItem > Max latency</ FlexItem >
180- < FlexItem >
181- < Popover
182- bodyContent = "Set your maximum acceptable latency. Hardware configurations that respond slower than this value will be hidden."
183- appendTo = { ( ) => document . body }
184- >
185- < Button
186- variant = "plain"
187- aria-label = "More info for max latency"
188- className = "pf-v6-u-p-xs"
189- icon = { < HelpIcon /> }
190- />
191- </ Popover >
192- </ FlexItem >
193- </ Flex >
194- </ FlexItem >
195-
196180 { /* Metric and Percentile on the same line */ }
197181 < FlexItem >
198182 < Flex spaceItems = { { default : 'spaceItemsMd' } } >
@@ -243,53 +227,86 @@ const MaxLatencyFilter: React.FC<MaxLatencyFilterProps> = ({ performanceArtifact
243227 </ FormGroup >
244228 </ FlexItem >
245229
246- < FlexItem flex = { { default : 'flex_1' } } >
247- < FormGroup >
248- < Select
249- isOpen = { isPercentileOpen }
250- selected = { localFilter . percentile }
251- onClick = { ( e ) => e . stopPropagation ( ) }
252- onSelect = { ( _ , value ) => {
253- if (
254- typeof value === 'string' &&
255- PERCENTILE_OPTIONS . some ( ( opt ) => opt . value === value )
256- ) {
257- const selectedPercentile = PERCENTILE_OPTIONS . find (
258- ( opt ) => opt . value === value ,
259- ) ;
260- if ( selectedPercentile ) {
261- setLocalFilter ( { ...localFilter , percentile : selectedPercentile . value } ) ;
262- }
263- }
264- setIsPercentileOpen ( false ) ;
265- } }
266- onOpenChange = { ( isSelectOpen ) => {
267- setIsPercentileOpen ( isSelectOpen ) ;
268- // Prevent parent dropdown from closing when this select opens/closes
269- if ( isSelectOpen ) {
270- setIsOpen ( true ) ;
271- }
272- } }
273- toggle = { ( toggleRef ) => (
274- < MenuToggle
275- ref = { toggleRef }
276- onClick = { ( ) => setIsPercentileOpen ( ! isPercentileOpen ) }
277- isExpanded = { isPercentileOpen }
278- className = "pf-v6-u-w-100"
230+ < FlexItem >
231+ < Flex
232+ alignItems = { { default : 'alignItemsCenter' } }
233+ spaceItems = { { default : 'spaceItemsXs' } }
234+ >
235+ < FlexItem flex = { { default : 'flex_1' } } >
236+ < FormGroup >
237+ < Select
238+ isOpen = { isPercentileOpen }
239+ selected = { localFilter . percentile }
240+ onClick = { ( e ) => e . stopPropagation ( ) }
241+ onSelect = { ( _ , value ) => {
242+ if (
243+ typeof value === 'string' &&
244+ PERCENTILE_OPTIONS . some ( ( opt ) => opt . value === value )
245+ ) {
246+ const selectedPercentile = PERCENTILE_OPTIONS . find (
247+ ( opt ) => opt . value === value ,
248+ ) ;
249+ if ( selectedPercentile ) {
250+ setLocalFilter ( { ...localFilter , percentile : selectedPercentile . value } ) ;
251+ }
252+ }
253+ setIsPercentileOpen ( false ) ;
254+ } }
255+ onOpenChange = { ( isSelectOpen ) => {
256+ setIsPercentileOpen ( isSelectOpen ) ;
257+ // Prevent parent dropdown from closing when this select opens/closes
258+ if ( isSelectOpen ) {
259+ setIsOpen ( true ) ;
260+ }
261+ } }
262+ toggle = { ( toggleRef ) => (
263+ < MenuToggle
264+ ref = { toggleRef }
265+ onClick = { ( ) => setIsPercentileOpen ( ! isPercentileOpen ) }
266+ isExpanded = { isPercentileOpen }
267+ className = "pf-v6-u-w-100"
268+ >
269+ < span > Percentile: { localFilter . percentile } </ span >
270+ </ MenuToggle >
271+ ) }
279272 >
280- < span > Percentile: { localFilter . percentile } </ span >
281- </ MenuToggle >
282- ) }
283- >
284- < SelectList >
285- { getAvailablePercentiles ( ) . map ( ( option ) => (
286- < SelectOption key = { option . value } value = { option . value } >
287- { option . label }
288- </ SelectOption >
289- ) ) }
290- </ SelectList >
291- </ Select >
292- </ FormGroup >
273+ < SelectList >
274+ { getAvailablePercentiles ( ) . map ( ( option ) => (
275+ < SelectOption key = { option . value } value = { option . value } >
276+ { option . label }
277+ </ SelectOption >
278+ ) ) }
279+ </ SelectList >
280+ </ Select >
281+ </ FormGroup >
282+ </ FlexItem >
283+ < FlexItem >
284+ < Popover
285+ bodyContent = {
286+ < >
287+ Select the latency measure used for benchmarking - percentile or mean.
288+ < ul style = { { marginTop : '8px' } } >
289+ < li >
290+ < strong > P90, P95, P99:</ strong > The selected percentage of requests must
291+ meet the latency threshold.
292+ </ li >
293+ < li >
294+ < strong > Mean:</ strong > The average latency across all requests.
295+ </ li >
296+ </ ul >
297+ </ >
298+ }
299+ appendTo = { ( ) => document . body }
300+ >
301+ < Button
302+ variant = "plain"
303+ aria-label = "More info for Percentile"
304+ className = "pf-v6-u-p-xs"
305+ icon = { < HelpIcon /> }
306+ />
307+ </ Popover >
308+ </ FlexItem >
309+ </ Flex >
293310 </ FlexItem >
294311 </ Flex >
295312 </ FlexItem >
@@ -344,4 +361,4 @@ const MaxLatencyFilter: React.FC<MaxLatencyFilterProps> = ({ performanceArtifact
344361 ) ;
345362} ;
346363
347- export default MaxLatencyFilter ;
364+ export default LatencyFilter ;
0 commit comments