Skip to content

Commit ed99f5f

Browse files
GeorgeHahnclaude
andauthored
release: v0.31.2 (#1806)
Fix tight error loop when a generated block exceeds the throttle's maximum capacity. Oversized blocks are now skipped instead of retried indefinitely, and the log level is downgraded from ERROR to DEBUG. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent baf7dbf commit ed99f5f

File tree

13 files changed

+39
-30
lines changed

13 files changed

+39
-30
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
## [0.31.2]
10+
## Changed
11+
- Work around tight error loop when a generated block exceeds the throttle's
12+
maximum capacity. Oversized blocks are now skipped instead of retried
13+
indefinitely, and the log is downgraded from ERROR to DEBUG.
14+
## Removed
15+
- Reverted HTTP blackhole histogram distribution tracking (`bytes_received_distr`,
16+
`decoded_bytes_received_distr`) that was reapplied after 0.31.1.
17+
918
## [0.31.1]
1019
## Removed
1120
- Reverted HTTP blackhole histogram distribution tracking (`bytes_received_distr`,
@@ -23,8 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2332
- Observer config now supports `enable_smaps` and `enable_smaps_rollup` options
2433
to toggle `/proc/{pid}/smaps` and `/proc/{pid}/smaps_rollup` collection.
2534
- Lading now supports histogram approximations in its capture files.
26-
- HTTP blackhole now tracks distribution of bytes received, both decoded and
27-
compressed.
2835
- New "Static Chunks" generator that divides static files by lines into blocks
2936
(as opposed to static which turns each file into a block).
3037
- Fingerprint mechanism now calculates Shannon entropy.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lading/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lading"
3-
version = "0.31.1"
3+
version = "0.31.2"
44
authors = [
55
"Brian L. Troutwine <brian.troutwine@datadoghq.com>",
66
"George Hahn <george.hahn@datadoghq.com>",

lading/src/blackhole/http.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
//!
55
//! `bytes_received`: Total bytes received
66
//! `total_bytes_received`: Aggregated bytes received across all blackhole types
7-
//! `bytes_received_distr`: Distribution of compressed bytes per request (with `path` label)
87
//! `decoded_bytes_received`: Total decoded bytes received
9-
//! `decoded_bytes_received_distr`: Distribution of decompressed bytes per request (with `path` label)
108
//! `requests_received`: Total requests received
119
//!
1210
1311
use bytes::Bytes;
1412
use http::{HeaderMap, header::InvalidHeaderValue, status::InvalidStatusCode};
1513
use http_body_util::{BodyExt, combinators::BoxBody};
1614
use hyper::{Request, Response, StatusCode, header};
17-
use metrics::{counter, histogram};
15+
use metrics::counter;
1816
use serde::{Deserialize, Serialize};
1917
use std::{net::SocketAddr, time::Duration};
2018
use tracing::error;
@@ -155,25 +153,20 @@ async fn srv(
155153
) -> Result<hyper::Response<BoxBody<Bytes, hyper::Error>>, hyper::Error> {
156154
counter!("requests_received", &metric_labels).increment(1);
157155

158-
let path = req.uri().path().to_string();
159-
156+
// Split into parts
160157
let (parts, body) = req.into_parts();
161158

159+
// Convert the `Body` into `Bytes`
162160
let body: Bytes = body.boxed().collect().await?.to_bytes();
163161

164162
let body_len = body.len() as u64;
165163
counter!("bytes_received", &metric_labels).increment(body_len);
166164
counter!("total_bytes_received").increment(body_len);
167165

168-
let mut labels_with_path = metric_labels.clone();
169-
labels_with_path.push(("path".to_string(), path));
170-
histogram!("bytes_received_distr", &labels_with_path).record(body.len() as f64);
171-
172166
match crate::codec::decode(parts.headers.get(hyper::header::CONTENT_ENCODING), body) {
173167
Err(response) => Ok(*response),
174168
Ok(body) => {
175169
counter!("decoded_bytes_received", &metric_labels).increment(body.len() as u64);
176-
histogram!("decoded_bytes_received_distr", &labels_with_path).record(body.len() as f64);
177170

178171
tokio::time::sleep(response_delay).await;
179172

lading/src/generator/file_gen/logrotate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use tokio::{
3030
io::{AsyncWriteExt, BufWriter},
3131
task::{JoinError, JoinHandle},
3232
};
33-
use tracing::{error, info};
33+
use tracing::{debug, error, info};
3434

3535
use lading_payload::block;
3636

@@ -385,7 +385,8 @@ impl Child {
385385
&self.labels).await?;
386386
}
387387
Err(err) => {
388-
error!("Discarding block due to throttle error: {err}");
388+
debug!("Discarding block due to throttle error: {err}");
389+
self.block_cache.advance(&mut handle);
389390
}
390391
}
391392
}

lading/src/generator/file_gen/traditional.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use tokio::{
3131
io::{AsyncWriteExt, BufWriter},
3232
task::{JoinError, JoinSet},
3333
};
34-
use tracing::{error, info};
34+
use tracing::{debug, error, info};
3535

3636
use lading_payload::{self, block};
3737

@@ -358,7 +358,8 @@ impl Child {
358358
}
359359
}
360360
Err(err) => {
361-
error!("Discarding block due to throttle error: {err}");
361+
debug!("Discarding block due to throttle error: {err}");
362+
self.block_cache.advance(&mut handle);
362363
}
363364
}
364365
}

lading/src/generator/http.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use once_cell::sync::OnceCell;
2424
use rand::{SeedableRng, prelude::StdRng};
2525
use serde::{Deserialize, Serialize};
2626
use tokio::sync::Semaphore;
27-
use tracing::{error, info};
27+
use tracing::{debug, error, info};
2828

2929
use lading_payload::block;
3030

@@ -284,7 +284,8 @@ impl Http {
284284

285285
}
286286
Err(err) => {
287-
error!("Discarding block due to throttle error: {err}");
287+
debug!("Discarding block due to throttle error: {err}");
288+
self.block_cache.advance(&mut handle);
288289
}
289290
}
290291
},

lading/src/generator/splunk_hec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use tokio::{
3838
sync::{Semaphore, SemaphorePermit},
3939
time::timeout,
4040
};
41-
use tracing::{error, info};
41+
use tracing::{debug, error, info};
4242

4343
use crate::generator::splunk_hec::acknowledgements::Channel;
4444
use lading_payload::block;
@@ -318,7 +318,8 @@ impl SplunkHec {
318318
tokio::spawn(send_hec_request(permit, block_length, labels, channel, client, request, request_shutdown.clone(), uri_clone));
319319
}
320320
Err(err) => {
321-
error!("Discarding block due to throttle error: {err}");
321+
debug!("Discarding block due to throttle error: {err}");
322+
self.block_cache.advance(&mut handle);
322323
}
323324
}
324325
}

lading/src/generator/tcp.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use tokio::{
2626
task::{JoinError, JoinSet},
2727
time::Duration,
2828
};
29-
use tracing::{error, info, trace};
29+
use tracing::{debug, info, trace};
3030

3131
use lading_payload::block;
3232

@@ -271,7 +271,8 @@ impl TcpWorker {
271271
}
272272
}
273273
Err(err) => {
274-
error!("Discarding block due to throttle error: {err}");
274+
debug!("Discarding block due to throttle error: {err}");
275+
self.block_cache.advance(&mut handle);
275276
}
276277
}
277278
}

lading/src/generator/trace_agent.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use std::{
3838
time::Duration,
3939
};
4040
use tokio::sync::Semaphore;
41-
use tracing::{error, info, warn};
41+
use tracing::{debug, error, info, warn};
4242

4343
const MAX_RETRY_MILLIS: u16 = 6_400;
4444

@@ -380,7 +380,8 @@ impl TraceAgent {
380380
});
381381
}
382382
Err(err) => {
383-
error!("Discarding block due to throttle error: {err}");
383+
debug!("Discarding block due to throttle error: {err}");
384+
self.block_cache.advance(&mut handle);
384385
}
385386
}
386387
},

0 commit comments

Comments
 (0)