Skip to content

Commit eaebbc9

Browse files
authored
feat: Flush timeouts (#480)
1 parent 5a1ee9d commit eaebbc9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

bottlecap/src/config/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub struct Config {
7878
pub logs_config_processing_rules: Option<Vec<ProcessingRule>>,
7979
pub serverless_flush_strategy: FlushStrategy,
8080
pub enhanced_metrics: bool,
81+
pub flush_timeout: u64,
8182
pub https_proxy: Option<String>,
8283
pub capture_lambda_payload: bool,
8384
pub capture_lambda_payload_max_depth: u32,
@@ -102,6 +103,7 @@ impl Default for Config {
102103
api_key_secret_arn: String::default(),
103104
kms_api_key: String::default(),
104105
serverless_flush_strategy: FlushStrategy::Default,
106+
flush_timeout: 5,
105107
// Unified Tagging
106108
env: None,
107109
service: None,

bottlecap/src/http_client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::config;
2+
use core::time::Duration;
23
use std::sync::Arc;
34
use tracing::error;
45

@@ -16,7 +17,7 @@ pub fn get_client(config: Arc<config::Config>) -> reqwest::Client {
1617
}
1718

1819
fn build_client(config: Arc<config::Config>) -> Result<reqwest::Client, reqwest::Error> {
19-
let client = reqwest::Client::builder();
20+
let client = reqwest::Client::builder().timeout(Duration::from_secs(config.flush_timeout));
2021
// This covers DD_PROXY_HTTPS and HTTPS_PROXY
2122
if let Some(https_uri) = &config.https_proxy {
2223
let proxy = reqwest::Proxy::https(https_uri.clone())?;

0 commit comments

Comments
 (0)