@@ -47,7 +47,7 @@ interface MetricsGraphSectionProps {
4747 data : UtilizationMetricsType [ ] ;
4848 } > ;
4949 utilizationMetricsLoading ?: boolean ;
50- onUtilizationSeriesSelect ?: ( seriesIndex : number ) => void ;
50+ onUtilizationSeriesSelect ?: ( name : string , seriesIndex : number ) => void ;
5151}
5252
5353export function MetricsGraphSection ( {
@@ -161,6 +161,12 @@ export function MetricsGraphSection({
161161 metric . name === 'gpu_pcie_throughput_transmit_bytes' ||
162162 metric . name === 'gpu_pcie_throughput_receive_bytes'
163163 ) ;
164+ const transmitData =
165+ throughputMetrics . find ( metric => metric . name === 'gpu_pcie_throughput_transmit_bytes' )
166+ ?. data ?? [ ] ;
167+ const receiveData =
168+ throughputMetrics . find ( metric => metric . name === 'gpu_pcie_throughput_receive_bytes' ) ?. data ??
169+ [ ] ;
164170
165171 if ( utilizationMetrics . length === 0 ) {
166172 return < > </ > ;
@@ -187,7 +193,7 @@ export function MetricsGraphSection({
187193 onSeriesClick = { seriesIndex => {
188194 // For generic UtilizationMetrics, just pass the series index
189195 if ( onUtilizationSeriesSelect != null ) {
190- onUtilizationSeriesSelect ( seriesIndex ) ;
196+ onUtilizationSeriesSelect ( name , seriesIndex ) ;
191197 }
192198 } }
193199 />
@@ -197,14 +203,8 @@ export function MetricsGraphSection({
197203 } ) }
198204 { throughputMetrics . length > 0 && (
199205 < AreaChart
200- transmitData = {
201- throughputMetrics . find ( metric => metric . name === 'gpu_pcie_throughput_transmit_bytes' )
202- ?. data ?? [ ]
203- }
204- receiveData = {
205- throughputMetrics . find ( metric => metric . name === 'gpu_pcie_throughput_receive_bytes' )
206- ?. data ?? [ ]
207- }
206+ transmitData = { transmitData }
207+ receiveData = { receiveData }
208208 addLabelMatcher = { addLabelMatcher }
209209 setTimeRange = { handleTimeRangeChange }
210210 name = { throughputMetrics [ 0 ] . name }
@@ -213,7 +213,17 @@ export function MetricsGraphSection({
213213 to = { querySelection . to }
214214 utilizationMetricsLoading = { utilizationMetricsLoading }
215215 selectedSeries = { undefined }
216- onSeriesClick = { onUtilizationSeriesSelect }
216+ onSeriesClick = { ( name , seriesIndex ) => {
217+ // For throughput metrics, just pass the series index
218+ if ( onUtilizationSeriesSelect != null ) {
219+ let name = 'gpu_pcie_throughput_transmit_bytes' ;
220+ if ( seriesIndex > transmitData . length - 1 ) {
221+ name = 'gpu_pcie_throughput_receive_bytes' ;
222+ seriesIndex -= transmitData . length ;
223+ }
224+ onUtilizationSeriesSelect ( name , seriesIndex ) ;
225+ }
226+ } }
217227 />
218228 ) }
219229 </ div >
0 commit comments