@@ -47,6 +47,7 @@ const ServiceAnalyticsTab = ({ dateRange, setDateRange }) => {
4747 const [ uptimeData , setUptimeData ] = useState ( null ) ;
4848 const [ resourceData , setResourceData ] = useState ( null ) ;
4949 const [ responseTimeData , setResponseTimeData ] = useState ( null ) ;
50+ const [ servicesStatus , setServicesStatus ] = useState ( [ ] ) ;
5051
5152 useEffect ( ( ) => {
5253 fetchServiceAnalytics ( ) ;
@@ -55,15 +56,23 @@ const ServiceAnalyticsTab = ({ dateRange, setDateRange }) => {
5556 const fetchServiceAnalytics = async ( ) => {
5657 setLoading ( true ) ;
5758 try {
59+ // Fetch service health status
60+ const servicesResponse = await fetch ( '/api/v1/health/services' ) ;
61+ const servicesData = await servicesResponse . json ( ) ;
62+
63+ if ( servicesData . services ) {
64+ setServicesStatus ( servicesData . services ) ;
65+ }
66+
5867 const response = await fetch ( '/api/v1/services/analytics?range=' + dateRange ) ;
5968 const statusResponse = await fetch ( '/api/v1/system/status' ) ;
6069
6170 const data = await response . json ( ) ;
6271 const statusData = await statusResponse . json ( ) ;
6372
6473 setServiceMetrics ( {
65- servicesHealthy : statusData . services_healthy || 11 ,
66- servicesTotal : statusData . services_total || 12 ,
74+ servicesHealthy : servicesData . healthy_services || statusData . services_healthy || 11 ,
75+ servicesTotal : servicesData . total_services || statusData . services_total || 12 ,
6776 avgUptime : data . avg_uptime || 99.8 ,
6877 avgResponseTime : data . avg_response_time || 145 ,
6978 } ) ;
@@ -231,35 +240,36 @@ const ServiceAnalyticsTab = ({ dateRange, setDateRange }) => {
231240 </ tr >
232241 </ thead >
233242 < tbody >
234- { [
235- { name : 'Keycloak' , status : 'healthy' , uptime : 99.9 , requests : 15234 , errors : 12 , response : 125 } ,
236- { name : 'PostgreSQL' , status : 'healthy' , uptime : 100 , requests : 42156 , errors : 8 , response : 45 } ,
237- { name : 'Redis' , status : 'healthy' , uptime : 99.8 , requests : 98234 , errors : 156 , response : 12 } ,
238- { name : 'LiteLLM' , status : 'healthy' , uptime : 99.7 , requests : 8945 , errors : 24 , response : 342 } ,
239- { name : 'Ops-Center' , status : 'healthy' , uptime : 99.9 , requests : 5234 , errors : 3 , response : 98 } ,
240- { name : 'Claude Agents' , status : 'degraded' , uptime : 98.5 , requests : 1234 , errors : 45 , response : 456 } ,
241- ] . map ( ( service , index ) => (
242- < tr key = { index } className = "border-b border-gray-800 hover:bg-gray-800/30" >
243- < td className = { `py-3 px-4 ${ textClass } font-medium` } > { service . name } </ td >
244- < td className = "py-3 px-4 text-center" >
245- < span className = { `px-2 py-1 rounded-full text-xs font-semibold ${
246- service . status === 'healthy'
247- ? 'bg-green-500/20 text-green-400'
248- : service . status === 'degraded'
249- ? 'bg-yellow-500/20 text-yellow-400'
250- : 'bg-red-500/20 text-red-400'
251- } `} >
252- { service . status }
253- </ span >
243+ { servicesStatus . length > 0 ? (
244+ servicesStatus . map ( ( service , index ) => (
245+ < tr key = { index } className = "border-b border-gray-800 hover:bg-gray-800/30" >
246+ < td className = { `py-3 px-4 ${ textClass } font-medium` } > { service . name } </ td >
247+ < td className = "py-3 px-4 text-center" >
248+ < span className = { `px-2 py-1 rounded-full text-xs font-semibold ${
249+ service . status === 'healthy'
250+ ? 'bg-green-500/20 text-green-400'
251+ : service . status === 'degraded'
252+ ? 'bg-yellow-500/20 text-yellow-400'
253+ : 'bg-red-500/20 text-red-400'
254+ } `} >
255+ { service . status }
256+ </ span >
257+ </ td >
258+ < td className = { `py-3 px-4 text-right ${ textClass } ` } > { service . uptime } %</ td >
259+ < td className = { `py-3 px-4 text-right ${ textClass } ` } > { service . requests . toLocaleString ( ) } </ td >
260+ < td className = { `py-3 px-4 text-right ${ service . errors > 30 ? 'text-red-400' : textClass } ` } >
261+ { service . errors }
262+ </ td >
263+ < td className = { `py-3 px-4 text-right ${ textClass } ` } > { service . response } ms</ td >
264+ </ tr >
265+ ) )
266+ ) : (
267+ < tr >
268+ < td colSpan = "6" className = { `py-8 text-center ${ subtextClass } ` } >
269+ Loading service status...
254270 </ td >
255- < td className = { `py-3 px-4 text-right ${ textClass } ` } > { service . uptime } %</ td >
256- < td className = { `py-3 px-4 text-right ${ textClass } ` } > { service . requests . toLocaleString ( ) } </ td >
257- < td className = { `py-3 px-4 text-right ${ service . errors > 30 ? 'text-red-400' : textClass } ` } >
258- { service . errors }
259- </ td >
260- < td className = { `py-3 px-4 text-right ${ textClass } ` } > { service . response } ms</ td >
261271 </ tr >
262- ) ) }
272+ ) }
263273 </ tbody >
264274 </ table >
265275 </ div >
0 commit comments