mfyuce commented on code in PR #3523:
URL: https://github.com/apache/iggy/pull/3523#discussion_r3710487140
##########
core/connectors/sinks/quickwit_sink/src/lib.rs:
##########
@@ -16,158 +16,325 @@
// under the License.
use async_trait::async_trait;
+use base64::{Engine as _, engine::general_purpose};
+use iggy_connector_sdk::retry::{
+ ConnectivityConfig, build_retry_client, check_connectivity_with_retry,
parse_duration,
+};
use iggy_connector_sdk::{
- ConsumedMessage, Error, MessagesMetadata, Payload, Sink, TopicMetadata,
sink_connector,
+ ConsumedMessage, Error, MessagesMetadata, Payload, Schema, Sink,
TopicMetadata, sink_connector,
};
+use reqwest::StatusCode;
+use reqwest::Url;
+use reqwest_middleware::ClientWithMiddleware;
use serde::{Deserialize, Serialize};
-use tracing::{error, info, warn};
+use simd_json::OwnedValue;
+use tracing::{debug, error, info, warn};
sink_connector!(QuickwitSink);
+const DEFAULT_MAX_RETRIES: u32 = 3;
+const DEFAULT_RETRY_DELAY: &str = "200ms";
+const DEFAULT_MAX_RETRY_DELAY: &str = "5s";
+const DEFAULT_MAX_OPEN_RETRIES: u32 = 5;
+const DEFAULT_OPEN_RETRY_MAX_DELAY: &str = "30s";
+const DEFAULT_REQUEST_TIMEOUT: &str = "30s";
+
#[derive(Debug)]
pub struct QuickwitSink {
id: u32,
config: QuickwitSinkConfig,
- client: reqwest::Client,
+ client: Option<ClientWithMiddleware>,
+ verbose: bool,
index_id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct QuickwitSinkConfig {
- url: String,
- index: String,
+ pub url: String,
+ /// Full Quickwit index config YAML, passed to `POST /api/v1/indexes` on
first open.
+ /// `index_id` is extracted from this YAML to build ingest URLs.
+ pub index: String,
+ pub verbose_logging: Option<bool>,
+ pub max_retries: Option<u32>,
+ pub retry_delay: Option<String>,
+ pub max_retry_delay: Option<String>,
+ pub max_open_retries: Option<u32>,
+ pub open_retry_max_delay: Option<String>,
+ pub request_timeout: Option<String>,
Review Comment:
Renamed the field to `timeout` and the const to `DEFAULT_TIMEOUT`.
--
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]