Skip to content

Commit dfc86d6

Browse files
committed
cleanup on reviewing PR
1 parent 7adc28c commit dfc86d6

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

libdd-profiling/src/exporter/profile_exporter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl ProfileExporter {
8686
let output_path = libdd_common::decode_uri_path_in_authority(&endpoint.url)
8787
.context("Failed to decode file path from URI")?;
8888
let pipe_path = spawn_dump_server(output_path)?;
89-
builder = builder.named_pipe(pipe_path);
89+
builder = builder.windows_named_pipe(pipe_path);
9090
"http://localhost/v1/input".to_string()
9191
}
9292

@@ -108,7 +108,7 @@ impl ProfileExporter {
108108
Some("windows") => {
109109
use libdd_common::connector::named_pipe::named_pipe_path_from_uri;
110110
let pipe_path = named_pipe_path_from_uri(&endpoint.url)?;
111-
builder = builder.named_pipe(pipe_path);
111+
builder = builder.windows_named_pipe(pipe_path);
112112
format!("http://localhost{}", endpoint.url.path())
113113
}
114114
#[cfg(unix)]

libdd-profiling/src/exporter/utils.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//!
66
//! These utilities are primarily useful for testing and debugging profiling exports.
77
8+
use anyhow::Context as _;
89
use std::collections::HashMap;
910

1011
/// Represents a parsed HTTP request
@@ -47,7 +48,7 @@ pub fn parse_http_request(data: &[u8]) -> anyhow::Result<HttpRequest> {
4748
let split_pos = data
4849
.windows(separator.len())
4950
.position(|window| window == separator)
50-
.ok_or_else(|| anyhow::anyhow!("No header/body separator found"))?;
51+
.context("No header/body separator found")?;
5152

5253
let header_section = &data[..split_pos];
5354
let body = &data[split_pos + separator.len()..];
@@ -59,7 +60,7 @@ pub fn parse_http_request(data: &[u8]) -> anyhow::Result<HttpRequest> {
5960
// Parse request line
6061
let request_line = lines
6162
.next()
62-
.ok_or_else(|| anyhow::anyhow!("No request line found"))?;
63+
.context("No request line found")?;
6364
let parts: Vec<&str> = request_line.split_whitespace().collect();
6465
if parts.len() < 2 {
6566
anyhow::bail!("Invalid request line");
@@ -111,7 +112,7 @@ pub fn extract_boundary(content_type: &str) -> anyhow::Result<String> {
111112
part.strip_prefix(boundary_prefix)
112113
.map(|s| s.trim().to_string())
113114
})
114-
.ok_or_else(|| anyhow::anyhow!("No boundary found in Content-Type"))?;
115+
.context("No boundary found in Content-Type")?;
115116
Ok(boundary)
116117
}
117118

@@ -160,7 +161,7 @@ pub fn parse_multipart(body: &[u8], boundary: &str) -> anyhow::Result<Vec<Multip
160161

161162
// Find the next boundary or end
162163
let next_delimiter_pos = find_subsequence(&body[pos..], delimiter_bytes)
163-
.ok_or_else(|| anyhow::anyhow!("Expected delimiter not found"))?;
164+
.context("Expected delimiter not found")?;
164165

165166
// Extract this part's data (remove trailing CRLF before delimiter)
166167
let part_end = pos + next_delimiter_pos;
@@ -201,7 +202,7 @@ pub fn parse_multipart_part(data: &[u8]) -> anyhow::Result<MultipartPart> {
201202
let split_pos = data
202203
.windows(separator.len())
203204
.position(|window| window == separator)
204-
.ok_or_else(|| anyhow::anyhow!("No part header/body separator"))?;
205+
.context("No part header/body separator")?;
205206

206207
let header_section = &data[..split_pos];
207208
let mut content = data[split_pos + separator.len()..].to_vec();

libdd-profiling/tests/exporter_e2e.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ async fn test_agentless_with_transport(transport: Transport) -> anyhow::Result<(
466466

467467
// Verify API key header is present
468468
assert!(
469-
req.headers.get("dd-api-key").is_some(),
469+
req.headers.contains_key("dd-api-key"),
470470
"DD-API-KEY header should be present for agentless"
471471
);
472472

0 commit comments

Comments
 (0)