ryerraguntla commented on code in PR #2933:
URL: https://github.com/apache/iggy/pull/2933#discussion_r2943403793


##########
core/connectors/sinks/influxdb_sink/src/lib.rs:
##########
@@ -0,0 +1,774 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use async_trait::async_trait;
+use base64::{Engine as _, engine::general_purpose};
+use humantime::Duration as HumanDuration;
+use iggy_connector_sdk::{
+    ConsumedMessage, Error, MessagesMetadata, Sink, TopicMetadata, 
sink_connector,
+};
+use rand::RngExt;
+use reqwest::{Client, StatusCode, Url};
+use serde::{Deserialize, Serialize};
+use std::str::FromStr;
+use std::sync::Arc;
+use std::sync::atomic::{AtomicU32, Ordering};
+use std::time::Duration;
+use std::time::SystemTime;
+use std::time::UNIX_EPOCH;
+use tokio::sync::Mutex;
+use tracing::{debug, error, info, warn};
+
+sink_connector!(InfluxDbSink);
+
+const DEFAULT_MAX_RETRIES: u32 = 3;
+const DEFAULT_RETRY_DELAY: &str = "1s";
+const DEFAULT_TIMEOUT: &str = "30s";
+const DEFAULT_PRECISION: &str = "us";
+// Maximum attempts for open() connectivity retries
+const DEFAULT_MAX_OPEN_RETRIES: u32 = 10;
+// Cap for exponential backoff in open() — never wait longer than this
+const DEFAULT_OPEN_RETRY_MAX_DELAY: &str = "60s";
+// How many consecutive batch failures open the circuit breaker
+const DEFAULT_CIRCUIT_BREAKER_THRESHOLD: u32 = 5;
+// How long the circuit stays open before allowing a probe attempt
+const DEFAULT_CIRCUIT_COOL_DOWN: &str = "30s";
+
+// ---------------------------------------------------------------------------
+// Simple consecutive-failure circuit breaker
+// ---------------------------------------------------------------------------
+#[derive(Debug)]
+struct CircuitBreaker {

Review Comment:
   will do the refactor in iteration 2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to