use std::fmt::Debug;
use metrics::counter;
use rumqttc::ConnectionError;
use vector_lib::internal_event::InternalEvent;
use vector_lib::internal_event::{error_stage, error_type};
#[derive(Debug)]
pub struct MqttConnectionError {
pub error: ConnectionError,
}
impl InternalEvent for MqttConnectionError {
fn emit(self) {
error!(
message = "MQTT connection error.",
error = %self.error,
error_code = "mqtt_connection_error",
error_type = error_type::WRITER_FAILED,
stage = error_stage::SENDING,
internal_log_rate_limit = true,
);
counter!(
"component_errors_total",
"error_code" => "mqtt_connection_error",
"error_type" => error_type::WRITER_FAILED,
"stage" => error_stage::SENDING,
)
.increment(1);
}
fn name(&self) -> Option<&'static str> {
Some("MqttConnectionError")
}
}