Skip to content

Commit f4f45db

Browse files
authored
Update lading toolchain to 1.89 (#1450)
### What does this PR do? This commit updates the lading toolchain to latest stable. Churn here is mechanical in nature.
1 parent d6a5d04 commit f4f45db

File tree

29 files changed

+352
-790
lines changed

29 files changed

+352
-790
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## Added
99
- Added configuration surface area to the OTel logs payload generator, in a
1010
manner similar to OTel metrics.
11+
## Changed
12+
- Lading toolchain is now 1.89.0
1113

1214
## [0.27.0]
1315
## Added

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Update the rust version in-sync with the version in rust-toolchain.toml
2-
FROM docker.io/rust:1.85.0-bookworm AS builder
2+
FROM docker.io/rust:1.89.0-bookworm AS builder
33

44
RUN apt-get update && apt-get install -y \
55
protobuf-compiler fuse3 libfuse3-dev \

lading/src/bin/lading.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,12 @@ async fn inner_main(
463463
//
464464
// INSPECTOR
465465
//
466-
if let Some(inspector_conf) = config.inspector {
467-
if !disable_inspector {
468-
let tgt_rcv = tgt_snd.subscribe();
469-
let inspector_server =
470-
inspector::Server::new(inspector_conf, shutdown_watcher.clone())?;
471-
let _isrv = tokio::spawn(inspector_server.run(tgt_rcv));
472-
}
466+
if let Some(inspector_conf) = config.inspector
467+
&& !disable_inspector
468+
{
469+
let tgt_rcv = tgt_snd.subscribe();
470+
let inspector_server = inspector::Server::new(inspector_conf, shutdown_watcher.clone())?;
471+
let _isrv = tokio::spawn(inspector_server.run(tgt_rcv));
473472
}
474473

475474
//

lading/src/blackhole/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async fn srv(
141141
counter!("bytes_received", &metric_labels).increment(body.len() as u64);
142142

143143
match crate::codec::decode(parts.headers.get(hyper::header::CONTENT_ENCODING), body) {
144-
Err(response) => Ok(response),
144+
Err(response) => Ok(*response),
145145
Ok(body) => {
146146
counter!("decoded_bytes_received", &metric_labels).increment(body.len() as u64);
147147

lading/src/blackhole/otlp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl Otlp {
8989
// Ensure at least one protocol is enabled
9090
if config.grpc_addr.is_none() && config.http_addr.is_none() {
9191
return Err(Error::NoProtocolEnabled);
92-
};
92+
}
9393

9494
let mut labels = vec![
9595
("component".to_string(), "blackhole".to_string()),

lading/src/blackhole/otlp/http.rs

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -191,44 +191,42 @@ impl OtlpHttpHandler {
191191
);
192192

193193
// Check for empty bodies using Content-Length when available
194-
if let Some(content_length) = req.headers().get(hyper::header::CONTENT_LENGTH) {
195-
if let Ok(length) = content_length.to_str() {
196-
if let Ok(length) = length.parse::<u64>() {
197-
if length == 0 {
198-
counter!("bytes_received", &self.labels).increment(0);
199-
200-
let (response_bytes, content_type) = match (path_ref, response_format) {
201-
("/v1/metrics", ResponseFormat::Json) => (
202-
self.empty_metrics_response_json.clone(),
203-
&self.content_type_json,
204-
),
205-
("/v1/metrics", ResponseFormat::Proto) => (
206-
self.empty_metrics_response_proto.clone(),
207-
&self.content_type_proto,
208-
),
209-
("/v1/traces", ResponseFormat::Json) => (
210-
self.empty_traces_response_json.clone(),
211-
&self.content_type_json,
212-
),
213-
("/v1/traces", ResponseFormat::Proto) => (
214-
self.empty_traces_response_proto.clone(),
215-
&self.content_type_proto,
216-
),
217-
("/v1/logs", ResponseFormat::Json) => (
218-
self.empty_logs_response_json.clone(),
219-
&self.content_type_json,
220-
),
221-
("/v1/logs", ResponseFormat::Proto) => (
222-
self.empty_logs_response_proto.clone(),
223-
&self.content_type_proto,
224-
),
225-
_ => unreachable!(), // path already validated
226-
};
227-
228-
return self.build_response(response_bytes, content_type).await;
229-
}
230-
}
231-
}
194+
if let Some(content_length) = req.headers().get(hyper::header::CONTENT_LENGTH)
195+
&& let Ok(length) = content_length.to_str()
196+
&& let Ok(length) = length.parse::<u64>()
197+
&& length == 0
198+
{
199+
counter!("bytes_received", &self.labels).increment(0);
200+
201+
let (response_bytes, content_type) = match (path_ref, response_format) {
202+
("/v1/metrics", ResponseFormat::Json) => (
203+
self.empty_metrics_response_json.clone(),
204+
&self.content_type_json,
205+
),
206+
("/v1/metrics", ResponseFormat::Proto) => (
207+
self.empty_metrics_response_proto.clone(),
208+
&self.content_type_proto,
209+
),
210+
("/v1/traces", ResponseFormat::Json) => (
211+
self.empty_traces_response_json.clone(),
212+
&self.content_type_json,
213+
),
214+
("/v1/traces", ResponseFormat::Proto) => (
215+
self.empty_traces_response_proto.clone(),
216+
&self.content_type_proto,
217+
),
218+
("/v1/logs", ResponseFormat::Json) => (
219+
self.empty_logs_response_json.clone(),
220+
&self.content_type_json,
221+
),
222+
("/v1/logs", ResponseFormat::Proto) => (
223+
self.empty_logs_response_proto.clone(),
224+
&self.content_type_proto,
225+
),
226+
_ => unreachable!(), // path already validated
227+
};
228+
229+
return self.build_response(response_bytes, content_type).await;
232230
}
233231

234232
// Non-empty body, implies a little more CPU work
@@ -257,7 +255,7 @@ impl OtlpHttpHandler {
257255
_ => unreachable!("path already validated"),
258256
}
259257
}
260-
Err(response) => return Ok(response),
258+
Err(response) => return Ok(*response),
261259
};
262260

263261
let content_type = match response_format {

lading/src/blackhole/splunk_hec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async fn srv(
9595
counter!("bytes_received", &*labels).increment(bytes.len() as u64);
9696

9797
match crate::codec::decode(parts.headers.get(hyper::header::CONTENT_ENCODING), bytes) {
98-
Err(response) => Ok(response),
98+
Err(response) => Ok(*response),
9999
Ok(body) => {
100100
counter!("decoded_bytes_received", &*labels).increment(body.len() as u64);
101101

lading/src/codec.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use hyper::StatusCode;
2525
pub(crate) fn decode(
2626
content_encoding: Option<&hyper::header::HeaderValue>,
2727
mut body: Bytes,
28-
) -> Result<Bytes, hyper::Response<BoxBody<Bytes, hyper::Error>>> {
28+
) -> Result<Bytes, Box<hyper::Response<BoxBody<Bytes, hyper::Error>>>> {
2929
if let Some(content_encoding) = content_encoding {
3030
let content_encoding = String::from_utf8_lossy(content_encoding.as_bytes());
3131

@@ -40,32 +40,34 @@ pub(crate) fn decode(
4040
let mut decoded = Vec::new();
4141
MultiGzDecoder::new(body.reader())
4242
.read_to_end(&mut decoded)
43-
.map_err(|error| encoding_error_to_response(&encoding, error))?;
43+
.map_err(|error| Box::new(encoding_error_to_response(&encoding, error)))?;
4444
decoded.into()
4545
}
4646
"deflate" => {
4747
let mut decoded = Vec::new();
4848
ZlibDecoder::new(body.reader())
4949
.read_to_end(&mut decoded)
50-
.map_err(|error| encoding_error_to_response(&encoding, error))?;
50+
.map_err(|error| Box::new(encoding_error_to_response(&encoding, error)))?;
5151
decoded.into()
5252
}
5353
"zstd" => {
5454
let mut decoded = Vec::new();
5555
zstd::Decoder::new(body.reader())
5656
.map_err(|error| encoding_error_to_response(&encoding, error))?
5757
.read_to_end(&mut decoded)
58-
.map_err(|error| encoding_error_to_response(&encoding, error))?;
58+
.map_err(|error| Box::new(encoding_error_to_response(&encoding, error)))?;
5959

6060
decoded.into()
6161
}
6262
encoding => {
63-
return Err(hyper::Response::builder()
64-
.status(StatusCode::UNSUPPORTED_MEDIA_TYPE)
65-
.body(crate::full(format!(
66-
"Unsupported encoding type: {encoding}"
67-
)))
68-
.expect("failed to build response"));
63+
return Err(Box::new(
64+
hyper::Response::builder()
65+
.status(StatusCode::UNSUPPORTED_MEDIA_TYPE)
66+
.body(crate::full(format!(
67+
"Unsupported encoding type: {encoding}"
68+
)))
69+
.expect("failed to build response"),
70+
));
6971
}
7072
}
7173
}

lading/src/generator.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ impl Server {
187187
Inner::FileTree(conf) => Self::FileTree(file_tree::FileTree::new(&conf, shutdown)?),
188188
Inner::Grpc(conf) => Self::Grpc(grpc::Grpc::new(config.general, conf, shutdown)?),
189189
Inner::UnixStream(conf) => {
190-
if let lading_payload::Config::DogStatsD(variant) = conf.variant {
191-
if !variant.length_prefix_framed {
192-
warn!(
193-
"Dogstatsd stream requires length prefix framing. You likely want to add `length_prefix_framed: true` to your payload config."
194-
);
195-
}
190+
if let lading_payload::Config::DogStatsD(variant) = conf.variant
191+
&& !variant.length_prefix_framed
192+
{
193+
warn!(
194+
"Dogstatsd stream requires length prefix framing. You likely want to add `length_prefix_framed: true` to your payload config."
195+
);
196196
}
197197

198198
Self::UnixStream(unix_stream::UnixStream::new(
@@ -252,7 +252,7 @@ impl Server {
252252
Server::ProcessTree(inner) => inner.spin().await?,
253253
Server::ProcFs(inner) => inner.spin().await?,
254254
Server::Container(inner) => inner.spin().await?,
255-
};
255+
}
256256

257257
Ok(())
258258
}

lading/src/generator/container.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,13 @@ impl Container {
179179
_ = liveness_interval.tick() => {
180180
for container in &containers {
181181
let inspect_options = InspectContainerOptionsBuilder::default().build();
182-
if let Some(state) = docker.inspect_container(&container.id, Some(inspect_options)).await?.state {
183-
if !state.running.unwrap_or(false) {
182+
if let Some(state) = docker.inspect_container(&container.id, Some(inspect_options)).await?.state
183+
&& !state.running.unwrap_or(false) {
184184
return Err(Error::Generic(format!(
185185
"Container {id} is not running anymore",
186186
id = container.id
187187
)));
188188
}
189-
}
190189
}
191190
}
192191

0 commit comments

Comments
 (0)