Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6c4c10c
datapipeline - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
2f22ed1
datapipeline-ffi - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
aef67d2
ddcommon - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
63ccf31
ddcommon - replace use of lazy_static with OnceLock
ekump Mar 10, 2025
29b8d90
ddtelemetry-ffi - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
f3acfaa
ddcommon-ffi - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
f058631
ddtelemetry - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
8cba794
ddsketch - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
4314559
alloc - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
89d2c7b
crashtracker - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
b33b5a1
crashtracker-ffi - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
a5df00c
dogstatsd - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
211c5fc
dogstatsd_client - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
40e2481
dynamic-configuration - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
502f25b
ipc - add clippy warnings and allows for panic macros
ekump Mar 10, 2025
06e559c
ddtelemetry - replace use of lazy_static with OnceLock
ekump Mar 11, 2025
420233d
live-debugger - replace lazy_static with OnceLock
ekump Mar 11, 2025
e896f45
LICENSE file update
ekump Mar 11, 2025
37c39be
tools - replace lazy_static with OnceLock
ekump Mar 11, 2025
361d87d
sidecar replace lazy_static with OnceLock
ekump Mar 11, 2025
d3d2cee
live-debugger - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
fdb1258
live-debugger-ffi - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
95819f0
profiling - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
9422cae
profiling-ffi - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
8cfe3d9
profiling-replayer - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
c8ae07e
serverless - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
f081e32
tinybytes - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
adb9a4f
trace-mini-agent - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
7c63b04
trace-normalization - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
4db711b
trace-obfuscation - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
01c36be
trace-utils - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
ef6c4b3
add a helper function to unwrap mutexes
ekump Mar 11, 2025
3aa655c
remote-config - add clippy warnings and allows for panic macros
ekump Mar 11, 2025
ec5d1d4
sidecar - add clippy warnings and allows for panic macros
ekump Mar 12, 2025
3088f53
sidecar-ffi - add clippy warnings and allows for panic macros
ekump Mar 12, 2025
76ea608
PR feedback - switch lock_or_panic() to extension trait
ekump Mar 12, 2025
dcede22
PR feedback removing redundant checks on OnceLocks
ekump Mar 12, 2025
f6c762c
Fix windows compile errors
ekump Mar 12, 2025
60433a7
fix post-rebase clippy warning in trace-utils
ekump Mar 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

243 changes: 6 additions & 237 deletions LICENSE-3rdparty.yml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
// SPDX-License-Identifier: Apache-2.0

#![cfg_attr(not(test), no_std)]
#![cfg_attr(not(test), deny(clippy::panic))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::todo))]
#![cfg_attr(not(test), deny(clippy::unimplemented))]

mod chain;
mod linear;
Expand Down
6 changes: 6 additions & 0 deletions crashtracker-ffi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

#![cfg_attr(not(test), deny(clippy::panic))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::todo))]
#![cfg_attr(not(test), deny(clippy::unimplemented))]

#[cfg(all(unix, feature = "collector"))]
mod collector;
mod crash_info;
Expand Down
4 changes: 4 additions & 0 deletions crashtracker/src/collector/crash_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ struct PreparedExecve {
impl PreparedExecve {
fn new(config: &CrashtrackerReceiverConfig) -> Self {
// Allocate and store binary path
#[allow(clippy::expect_used)]
let binary_path = CString::new(config.path_to_receiver_binary.as_str())
.expect("Failed to convert binary path to CString");

// Allocate and store arguments
#[allow(clippy::expect_used)]
let args_cstrings: Vec<CString> = config
.args
.iter()
Expand All @@ -97,6 +99,7 @@ impl PreparedExecve {
.iter()
.map(|(key, value)| {
let env_str = format!("{key}={value}");
#[allow(clippy::expect_used)]
CString::new(env_str).expect("Failed to convert environment variable to CString")
})
.collect();
Expand Down Expand Up @@ -188,6 +191,7 @@ fn run_receiver_child(uds_parent: RawFd, uds_child: RawFd, stderr: RawFd, stdout
// allocations in the signal handler.
let receiver_args = RECEIVER_ARGS.load(SeqCst);
let (binary_path, args_ptrs, env_vars_ptrs) = unsafe {
#[allow(clippy::expect_used)]
let receiver_args = receiver_args.as_ref().expect("No receiver arguments");
(
&receiver_args.binary_path,
Expand Down
5 changes: 5 additions & 0 deletions crashtracker/src/collector/emitters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ unsafe fn emit_backtrace_by_frames(
if resolve_frames == StacktraceCollection::EnabledWithInprocessSymbols {
backtrace::resolve_frame_unsynchronized(frame, |symbol| {
write!(w, "{{").unwrap();
#[allow(clippy::unwrap_used)]
emit_absolute_addresses(w, frame).unwrap();
if let Some(column) = symbol.colno() {
write!(w, ", \"column\": {column}").unwrap();
Expand All @@ -64,17 +65,21 @@ unsafe fn emit_backtrace_by_frames(
}
writeln!(w, "}}").unwrap();
// Flush eagerly to ensure that each frame gets emitted even if the next one fails
#[allow(clippy::unwrap_used)]
w.flush().unwrap();
});
} else {
write!(w, "{{").unwrap();
#[allow(clippy::unwrap_used)]
emit_absolute_addresses(w, frame).unwrap();
writeln!(w, "}}").unwrap();
// Flush eagerly to ensure that each frame gets emitted even if the next one fails
#[allow(clippy::unwrap_used)]
w.flush().unwrap();
}
true // keep going to the next frame
});
#[allow(clippy::unwrap_used)]
writeln!(w, "{DD_CRASHTRACK_END_STACKTRACE}").unwrap();
w.flush()?;
Ok(())
Expand Down
6 changes: 6 additions & 0 deletions crashtracker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
//! Handling of forks
//! Safety issues

#![cfg_attr(not(test), deny(clippy::panic))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::todo))]
#![cfg_attr(not(test), deny(clippy::unimplemented))]

#[cfg(all(unix, feature = "collector"))]
mod collector;
mod crash_info;
Expand Down
5 changes: 5 additions & 0 deletions data-pipeline-ffi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(not(test), deny(clippy::panic))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::todo))]
#![cfg_attr(not(test), deny(clippy::unimplemented))]

mod error;
mod response;
Expand Down
6 changes: 5 additions & 1 deletion data-pipeline/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![cfg_attr(not(test), deny(clippy::panic))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::todo))]
#![cfg_attr(not(test), deny(clippy::unimplemented))]

//! TraceExporter provides a minimum viable product (MVP) to send traces to agents. The aim of the
//! project at this state is to provide a basic API in order to test its viability and integration
Expand Down
1 change: 1 addition & 0 deletions data-pipeline/src/stats_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl StatsExporter {
encode_stats_payload(
self.meta.borrow(),
sequence,
#[allow(clippy::unwrap_used)]
self.concentrator
.lock()
.unwrap()
Expand Down
1 change: 1 addition & 0 deletions data-pipeline/src/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ impl TelemetryClientBuilder {

/// Builds the telemetry client.
pub async fn build(self) -> Result<TelemetryClient, TelemetryError> {
#[allow(clippy::unwrap_used)]
let mut builder = TelemetryWorkerBuilder::new_fetch_host(
self.service_name.unwrap(),
self.language.unwrap(),
Expand Down
1 change: 1 addition & 0 deletions data-pipeline/src/trace_exporter/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl NetworkError {

impl Display for NetworkError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
#[allow(clippy::unwrap_used)]
std::fmt::Display::fmt(self.source().unwrap(), f)
}
}
Expand Down
14 changes: 14 additions & 0 deletions data-pipeline/src/trace_exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ impl TraceExporterOutputFormat {
fn add_query(&self, url: &Uri, query: &str) -> Uri {
let url = format!("{}?{}", url, query);

// TODO: Properly handle non-OK states to prevent possible panics (APMSP-18190).
#[allow(clippy::expect_used)]
Uri::from_str(&url).expect("Failed to create Uri from string")
}
}
Expand All @@ -96,6 +98,8 @@ impl TraceExporterOutputFormat {
/// * `path` - The path to be added to the URL.
fn add_path(url: &Uri, path: &str) -> Uri {
let p_and_q = url.path_and_query();

#[allow(clippy::unwrap_used)]
let new_p_and_q = match p_and_q {
Some(pq) => {
let p = pq.path();
Expand All @@ -111,6 +115,7 @@ fn add_path(url: &Uri, path: &str) -> Uri {
let mut parts = url.clone().into_parts();
parts.path_and_query = Some(new_p_and_q);
// TODO: Properly handle non-OK states to prevent possible panics (APMSP-18190).
#[allow(clippy::unwrap_used)]
Uri::from_parts(parts).unwrap()
}

Expand Down Expand Up @@ -356,7 +361,9 @@ impl TraceExporter {
self.runtime.block_on(async {
cancellation_token.cancel();
});
#[allow(clippy::unwrap_used)]
let bucket_size = stats_concentrator.lock().unwrap().get_bucket_size();

self.client_side_stats
.store(Arc::new(StatsComputationStatus::DisabledByAgent {
bucket_size,
Expand Down Expand Up @@ -403,7 +410,9 @@ impl TraceExporter {
exporter_handle: _,
} => {
if agent_info.info.client_drop_p0s.is_some_and(|v| v) {
#[allow(clippy::unwrap_used)]
let mut concentrator = stats_concentrator.lock().unwrap();

concentrator.set_span_kinds(
agent_info
.info
Expand Down Expand Up @@ -459,6 +468,8 @@ impl TraceExporter {
req_builder = req_builder
.header("Content-type", "application/msgpack")
.header("X-Datadog-Trace-Count", trace_count.to_string().as_str());

#[allow(clippy::unwrap_used)]
let req = req_builder
.body(Body::from(Bytes::copy_from_slice(data)))
// TODO: Properly handle non-OK states to prevent possible panics (APMSP-18190).
Expand All @@ -474,6 +485,7 @@ impl TraceExporter {
if !response_status.is_success() {
// TODO: Properly handle non-OK states to prevent possible panics
// (APMSP-18190).
#[allow(clippy::unwrap_used)]
let body_bytes = response.into_body().collect().await.unwrap().to_bytes();
let response_body =
String::from_utf8(body_bytes.to_vec()).unwrap_or_default();
Expand Down Expand Up @@ -555,7 +567,9 @@ impl TraceExporter {
exporter_handle: _,
} = &**self.client_side_stats.load()
{
#[allow(clippy::unwrap_used)]
let mut stats_concentrator = stats_concentrator.lock().unwrap();

match collection {
TraceCollection::TraceChunk(traces) => {
let spans = traces.iter().flat_map(|trace| trace.iter());
Expand Down
2 changes: 2 additions & 0 deletions ddcommon-ffi/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub extern "C" fn ddog_endpoint_from_filename(filename: crate::CharSlice) -> Opt
pub extern "C" fn ddog_endpoint_from_api_key(api_key: crate::CharSlice) -> Box<Endpoint> {
let mut parts = Parts::default();
parts.authority = Some(Authority::from_static("datadoghq.com"));
#[allow(clippy::unwrap_used)]
Box::new(Endpoint {
url: hyper::Uri::from_parts(parts).unwrap(),
api_key: Some(api_key.to_utf8_lossy().to_string().into()),
Expand All @@ -52,6 +53,7 @@ pub extern "C" fn ddog_endpoint_from_api_key_and_site(
Err(e) => return Some(Box::new(Error::from(e.to_string()))),
});
*endpoint = Box::into_raw(Box::new(Endpoint {
#[allow(clippy::unwrap_used)]
url: hyper::Uri::from_parts(parts).unwrap(),
api_key: Some(api_key.to_utf8_lossy().to_string().into()),
..Default::default()
Expand Down
5 changes: 5 additions & 0 deletions ddcommon-ffi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(not(test), deny(clippy::panic))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::todo))]
#![cfg_attr(not(test), deny(clippy::unimplemented))]

mod error;

Expand Down
1 change: 1 addition & 0 deletions ddcommon-ffi/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ impl<T> Option<T> {

pub fn unwrap_none(self) {
match self {
#[allow(clippy::panic)]
Option::Some(_) => panic!("Called ffi::Option::unwrap_none but option was Some(_)"),
Option::None => {}
}
Expand Down
1 change: 1 addition & 0 deletions ddcommon-ffi/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl<T> Result<T> {
pub fn unwrap(self) -> T {
match self {
Self::Ok(v) => v,
#[allow(clippy::panic)]
Self::Err(err) => panic!("{err}"),
}
}
Expand Down
2 changes: 2 additions & 0 deletions ddcommon-ffi/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ impl From<String> for StringWrapper {
impl From<StringWrapper> for String {
fn from(mut value: StringWrapper) -> Self {
let msg = std::mem::take(&mut value.message);
#[allow(clippy::unwrap_used)]
String::from_utf8(msg.into()).unwrap()
}
}
Expand Down Expand Up @@ -86,6 +87,7 @@ impl StringWrapperResult {
pub fn unwrap(self) -> StringWrapper {
match self {
StringWrapperResult::Ok(s) => s,
#[allow(clippy::panic)]
StringWrapperResult::Err(e) => panic!("{e}"),
}
}
Expand Down
1 change: 0 additions & 1 deletion ddcommon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ hyper = { version = "0.14", features = [
], default-features = false }
cc = "1.1.31"
hyper-util = "0.1.3"
lazy_static = "1.4"
log = { version = "0.4" }
pin-project = "1"
rand = "0.8.3"
Expand Down
Loading
Loading