feat(targets): add check_mysql_server_available probe function (#2884)

Signed-off-by: JaySon-Huang <tshent@qq.com>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
JaySon
2026-05-10 19:53:45 +08:00
committed by GitHub
parent 53ec1b95d8
commit bafff6d207
12 changed files with 131 additions and 58 deletions
+15 -1
View File
@@ -23,7 +23,7 @@ use std::fmt::Formatter;
use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
use tracing::warn;
use tracing::{debug, warn};
pub mod amqp;
pub mod kafka;
@@ -440,6 +440,20 @@ pub(crate) fn delete_stored_payload(
}
}
/// Ensures a rustls crypto provider is installed before any TLS operation.
///
/// Multiple target modules (MySQL, Redis, Postgres, MQTT) need this because
/// each may be the first to perform a TLS handshake. Idempotent: if a
/// provider is already registered, returns immediately.
pub(crate) fn ensure_rustls_provider_installed() {
if rustls::crypto::CryptoProvider::get_default().is_some() {
return;
}
if let Err(err) = rustls::crypto::aws_lc_rs::default_provider().install_default() {
debug!("rustls provider already installed or unavailable: {err:?}");
}
}
#[cfg(test)]
mod tests {
use super::*;