diff --git a/src/phoenix/inclusion_monitor/mod.rs b/src/phoenix/inclusion_monitor/mod.rs index 245f5dc..ee0d07f 100644 --- a/src/phoenix/inclusion_monitor/mod.rs +++ b/src/phoenix/inclusion_monitor/mod.rs @@ -156,12 +156,15 @@ async fn report_missing_payload( delivered block not found beaconcha\\.in: [slot/{slot}]({explorer_url}/slot/{slot}) - slot: `{slot}` - payload\\_block\\_hash: `{payload_block_hash}` - on\\_chain\\_block\\_hash: `{on_chain_block_hash}` + slot: {slot} + payload\\_block\\_hash: {payload_block_hash} + on\\_chain\\_block\\_hash: {on_chain_block_hash} " ); + let is_adjustment_hash = check_is_adjustment_hash(relay_pool, &payload.block_hash).await?; + message.push_str(&format!("is\\_missed\\_adjustment: {}", is_adjustment_hash)); + // Check if a publish was attempted, if yes, add publish stats. match loki_client.published_stats(payload.slot).await? { Some(payload_stats) => { @@ -173,12 +176,11 @@ async fn report_missing_payload( } = payload_stats; let published_stats_message = formatdoc!( " - publish was attempted - - decoded\\_at\\_slot\\_age\\_ms: `{decoded_at_slot_age_ms}` - pre\\_publish\\_duration\\_ms: `{pre_publish_duration_ms}` - publish\\_duration\\_ms: `{publish_duration_ms}` - request\\_download\\_duration\\_ms: `{request_download_duration_ms}` + publish was attempted, publish stats + decoded\\_at\\_slot\\_age\\_ms: {decoded_at_slot_age_ms} + pre\\_publish\\_duration\\_ms: {pre_publish_duration_ms} + publish\\_duration\\_ms: {publish_duration_ms} + request\\_download\\_duration\\_ms: {request_download_duration_ms} ", ); message.push_str("\n\n"); @@ -228,22 +230,17 @@ async fn report_missing_payload( let proposer_meta_message = formatdoc!( " proposer meta - - proposer\\_city: `{proposer_city}` - proposer\\_country: `{proposer_country}` - proposer\\_grafitti: `{grafitti}` - proposer\\_ip: `{proposer_ip}` - proposer\\_label: `{operator}` - proposer\\_lido\\_operator: `{lido_operator}` + proposer\\_city: {proposer_city} + proposer\\_country: {proposer_country} + proposer\\_grafitti: {grafitti} + proposer\\_ip: {proposer_ip} + proposer\\_label: {operator} + proposer\\_lido\\_operator: {lido_operator} ", ); message.push_str("\n\n"); message.push_str(&proposer_meta_message); - let is_adjustment_hash = check_is_adjustment_hash(relay_pool, &payload.block_hash).await?; - message.push_str("\n\n"); - message.push_str(&format!("is_missed_adjustment: `{}`", is_adjustment_hash)); - let publish_errors = loki_client.error_messages(slot).await?; if !publish_errors.is_empty() { message.push_str("\n\n"); @@ -262,6 +259,9 @@ async fn report_missing_payload( }; message.push_str(&error_message); } + } else { + message.push_str("\n\n"); + message.push_str("no publish errors found"); } let late_call_stats = loki_client.late_call_stats(slot).await?; @@ -272,10 +272,9 @@ async fn report_missing_payload( } = late_call_stats; let late_call_message = formatdoc!( " - found late call warnings - - decoded\\_at\\_slot\\_age\\_ms: `{decoded_at_slot_age_ms}` - request\\_download\\_duration\\_ms: `{request_download_duration_ms}` + found late call warnings, first warning stats + decoded\\_at\\_slot\\_age\\_ms: {decoded_at_slot_age_ms} + request\\_download\\_duration\\_ms: {request_download_duration_ms} " ); message.push_str("\n\n"); @@ -283,7 +282,7 @@ async fn report_missing_payload( } if publish_errors.is_empty() && late_call_stats.is_some() { - send_telegram_warning(&message, "MarkdownV2").await?; + send_telegram_warning(&message).await?; } else { send_telegram_alert(&message).await?; } diff --git a/src/phoenix/telegram.rs b/src/phoenix/telegram.rs index 75397c8..e5e914c 100644 --- a/src/phoenix/telegram.rs +++ b/src/phoenix/telegram.rs @@ -38,7 +38,7 @@ pub fn escape_code_block(input: &str) -> String { /// Sends a message to the Telegram warnings channel. /// Make sure the message is escaped. -pub async fn send_telegram_warning(message: &str, parse_mode: &str) -> anyhow::Result<()> { +pub async fn send_telegram_warning(message: &str) -> anyhow::Result<()> { let url = format!( "https://api.telegram.org/bot{}/sendMessage", &APP_CONFIG.telegram_api_key @@ -49,7 +49,7 @@ pub async fn send_telegram_warning(message: &str, parse_mode: &str) -> anyhow::R .query(&[ ("chat_id", APP_CONFIG.telegram_warnings_channel_id.as_str()), ("text", message), - ("parse_mode", parse_mode), + ("parse_mode", "MarkdownV2"), ("disable_web_page_preview", "true"), ]) .send()