@@ -61,7 +61,11 @@ use crate::{
6161pub async fn get_summary ( org_id : & str ) ->OrgSummary {
6262let streams =get_streams ( org_id, None , false , None ) . await ;
6363let mut stream_summary =StreamSummary :: default ( ) ;
64+ let mut has_trigger_stream =false ;
6465for streamin streams. iter ( ) {
66+ if stream. name == usage:: TRIGGERS_USAGE_STREAM {
67+ has_trigger_stream =true ;
68+ }
6569if !stream. stream_type . eq ( & StreamType :: Index )
6670 && !stream. stream_type . eq ( & StreamType :: Metadata )
6771{
@@ -73,19 +77,23 @@ pub async fn get_summary(org_id: &str) -> OrgSummary {
7377}
7478}
7579
76- let sql =format ! (
77- "SELECT module, status FROM {} WHERE org = '{}' GROUP BY module, status, key" ,
78- usage:: TRIGGERS_USAGE_STREAM ,
79- org_id
80- ) ;
81- let end_time = time:: now_micros ( ) ;
82- let start_time = end_time - time:: second_micros ( 900 ) ; // 15 mins
83- let trigger_status_results = self_reporting:: search:: get_usage ( sql, start_time, end_time)
84- . await
85- . unwrap_or_default ( )
86- . into_iter ( )
87- . filter_map ( |v| json:: from_value :: < TriggerStatusSearchResult > ( v) . ok ( ) )
88- . collect :: < Vec < _ > > ( ) ;
80+ let trigger_status_results =if !has_trigger_stream{
81+ vec ! [ ]
82+ } else {
83+ let sql =format ! (
84+ "SELECT module, status FROM {} WHERE org = '{}' GROUP BY module, status, key" ,
85+ usage:: TRIGGERS_USAGE_STREAM ,
86+ org_id
87+ ) ;
88+ let end_time = time:: now_micros ( ) ;
89+ let start_time = end_time - time:: second_micros ( 900 ) ; // 15 mins
90+ self_reporting:: search:: get_usage ( sql, start_time, end_time)
91+ . await
92+ . unwrap_or_default ( )
93+ . into_iter ( )
94+ . filter_map ( |v| json:: from_value :: < TriggerStatusSearchResult > ( v) . ok ( ) )
95+ . collect :: < Vec < _ > > ( )
96+ } ;
8997
9098let pipelines = db:: pipeline:: list_by_org ( org_id) . await . unwrap_or_default ( ) ;
9199let pipeline_summary =PipelineSummary {