forked from NationTech/harmony
		
	fix: made targets plural and changed scrape targets to option in AlertingInterpret
This commit is contained in:
		
							parent
							
								
									a815f6ac9c
								
							
						
					
					
						commit
						cb66b7592e
					
				| @ -21,7 +21,7 @@ pub struct AlertingInterpret<S: AlertSender> { | |||||||
|     pub sender: S, |     pub sender: S, | ||||||
|     pub receivers: Vec<Box<dyn AlertReceiver<S>>>, |     pub receivers: Vec<Box<dyn AlertReceiver<S>>>, | ||||||
|     pub rules: Vec<Box<dyn AlertRule<S>>>, |     pub rules: Vec<Box<dyn AlertRule<S>>>, | ||||||
|     pub scrape_target: Vec<Box<dyn ScrapeTarget<S>>>, |     pub scrape_targets: Option<Vec<Box<dyn ScrapeTarget<S>>>>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[async_trait] | #[async_trait] | ||||||
| @ -39,10 +39,12 @@ impl<S: AlertSender + Installable<T>, T: Topology> Interpret<T> for AlertingInte | |||||||
|             debug!("installing rule: {:#?}", rule); |             debug!("installing rule: {:#?}", rule); | ||||||
|             rule.install(&self.sender).await?; |             rule.install(&self.sender).await?; | ||||||
|         } |         } | ||||||
|         for target in self.scrape_target.iter() { |         if let Some(targets) = &self.scrape_targets { | ||||||
|  |             for target in targets.iter() { | ||||||
|                 debug!("installing scrape_target: {:#?}", target); |                 debug!("installing scrape_target: {:#?}", target); | ||||||
|                 target.install(&self.sender).await?; |                 target.install(&self.sender).await?; | ||||||
|             } |             } | ||||||
|  |         } | ||||||
|         self.sender.ensure_installed(inventory, topology).await?; |         self.sender.ensure_installed(inventory, topology).await?; | ||||||
|         Ok(Outcome::success(format!( |         Ok(Outcome::success(format!( | ||||||
|             "successfully installed alert sender {}", |             "successfully installed alert sender {}", | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ impl<T: Topology + HelmCommand + TenantManager> Score<T> for HelmPrometheusAlert | |||||||
|             sender: KubePrometheus { config }, |             sender: KubePrometheus { config }, | ||||||
|             receivers: self.receivers.clone(), |             receivers: self.receivers.clone(), | ||||||
|             rules: self.rules.clone(), |             rules: self.rules.clone(), | ||||||
|             scrape_target: vec![], |             scrape_targets: None, | ||||||
|         }) |         }) | ||||||
|     } |     } | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user