@@ -39,7 +39,7 @@ use crate::{
3939} ;
4040
4141/// Field in a dashboard's tile that should contain the logstream name
42- const TILE_FIELD_REFERRING_TO_STREAM : & str = "chartQuery " ;
42+ const TILE_FIELD_REFERRING_TO_STREAM : & str = "dbName " ;
4343
4444#[ derive( Debug , Default ) ]
4545pub struct PutStreamHeaders {
@@ -186,21 +186,28 @@ impl LogstreamAffectedResources {
186186 continue ;
187187 } ;
188188
189- if let Some ( chart_query) = tile_value. as_str ( ) {
190- if chart_query. contains ( stream_name) && !affected_tile_ids. contains ( & tile. tile_id ) {
189+ if let Some ( db_names) = tile_value. as_array ( ) {
190+ let dbs_have_stream = db_names
191+ . iter ( )
192+ . any ( |db| {
193+ if let Some ( db_str) = db. as_str ( ) {
194+ return db_str == stream_name
195+ } else { false }
196+ } ) ;
197+
198+ if dbs_have_stream && !affected_tile_ids. contains ( & tile. tile_id ) {
191199 affected_tile_ids. push ( tile. tile_id ) ;
192200 }
193201 }
194202 }
195203
196- if !affected_tile_ids. is_empty ( ) {
204+ if !affected_tile_ids. is_empty ( ) && dashboard . dashboard_id . is_some ( ) {
197205 affected_dashboards. push ( LogstreamAffectedDashboard {
198- dashboard_id : dashboard. dashboard_id . unwrap_or_else ( || {
199- tracing:: warn!( "dashboard {}: [id] is missing -- for logstream {}" , dash_i, stream_name) ;
200- Ulid :: new ( ) // default to a new ULID if missing -- what else?
201- } ) ,
206+ dashboard_id : dashboard. dashboard_id . unwrap ( ) ,
202207 affected_tile_ids
203208 } ) ;
209+ } else if !affected_tile_ids. is_empty ( ) {
210+ tracing:: warn!( "dashboard {}: [id] is missing, skipping -- for logstream {}" , dash_i, stream_name) ;
204211 }
205212 }
206213
0 commit comments