mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 08:09:27 +00:00
fix(alerts): save recovery destinations on Postgres by keeping the column TEXT (#15574)
Co-authored-by: hengfeiyang <hengfei.yang@gmail.com>
This commit is contained in:
@@ -80,8 +80,13 @@ impl TryFrom<alerts::Model> for MetaAlert {
|
||||
let destinations: Vec<String> = serde_json::from_value(value.destinations)?;
|
||||
let recovery_destinations: Vec<String> = value
|
||||
.recovery_destinations
|
||||
.map(serde_json::from_value)
|
||||
.transpose()?
|
||||
.map(|raw| serde_json::from_str(&raw))
|
||||
.transpose()
|
||||
.map_err(|e| {
|
||||
errors::Error::Message(format!(
|
||||
"alert {id} has an invalid recovery_destinations value: {e}"
|
||||
))
|
||||
})?
|
||||
.unwrap_or_default();
|
||||
let context_attributes: Option<HashMap<String, String>> = value
|
||||
.context_attributes
|
||||
@@ -961,7 +966,7 @@ fn update_mutable_fields(
|
||||
let recovery_destinations = if alert.recovery_destinations.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(serde_json::to_value(alert.recovery_destinations)?)
|
||||
Some(serde_json::to_string(&alert.recovery_destinations)?)
|
||||
};
|
||||
let keep_firing_for_seconds = alert.keep_firing_for;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ pub struct Model {
|
||||
/// the alert predates the feature, which is the same as `false`.
|
||||
pub notify_on_recovery: Option<bool>,
|
||||
/// JSON array of destination names. NULL = the recovery follows the firing's own destinations.
|
||||
pub recovery_destinations: Option<Json>,
|
||||
pub recovery_destinations: Option<String>,
|
||||
/// How long the condition must stay clear before the episode recovers.
|
||||
/// NULL or 0 recovers on the first clear evaluation.
|
||||
pub keep_firing_for_seconds: Option<i64>,
|
||||
|
||||
Reference in New Issue
Block a user