Skip to content

Commit

Permalink
Fall back to stderr if the log path contains colons (#3044)
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi authored Jan 17, 2025
1 parent dfce9d8 commit 51e8314
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
11 changes: 10 additions & 1 deletion components-rs/crashtracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,16 @@ void ddog_crasht_StackTrace_drop(struct ddog_crasht_Handle_StackTrace *trace);
*/
DDOG_CHECK_RETURN
struct ddog_VoidResult ddog_crasht_StackTrace_push_frame(struct ddog_crasht_Handle_StackTrace *trace,
struct ddog_crasht_Handle_StackFrame *frame);
struct ddog_crasht_Handle_StackFrame *frame,
bool incomplete);

/**
* # Safety
* The `stacktrace` can be null, but if non-null it must point to a StackTrace made by this module,
* which has not previously been dropped.
*/
DDOG_CHECK_RETURN
struct ddog_VoidResult ddog_crasht_StackTrace_set_complete(struct ddog_crasht_Handle_StackTrace *trace);

/**
* Demangles the string "name".
Expand Down
11 changes: 10 additions & 1 deletion components-rs/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,16 @@ pub extern "C" fn ddog_sidecar_connect_php(
cfg.log_method = LogMethod::File(str.into());
}
#[cfg(not(windows))]
{ cfg.log_method = LogMethod::File(OsStr::from_bytes(error_path).into()); }
{
// Paths containing a colon generally are some magic - just log to stderr directly
// E.g. "/var/www/html/host:[3]" on a serverless platform
// In general, stdio is the only way for having magic paths here.
if error_path.contains(&b':') {
cfg.log_method = LogMethod::Stderr;
} else {
cfg.log_method = LogMethod::File(OsStr::from_bytes(error_path).into());
}
}
}
#[cfg(windows)]
let log_level = log_level.to_utf8_lossy().as_ref().into();
Expand Down
2 changes: 1 addition & 1 deletion libdatadog
Submodule libdatadog updated 53 files
+1 −1 .github/workflows/test.yml
+65 −1 Cargo.lock
+4 −2 Cargo.toml
+416 −10 LICENSE-3rdparty.yml
+5 −1 bin_tests/src/lib.rs
+148 −0 build-config-ffi.sh
+3 −1 build-profiling-ffi.sh
+1 −0 builder/Cargo.toml
+2 −0 builder/src/bin/release.rs
+2 −0 builder/src/profiling.rs
+19 −2 crashtracker-ffi/src/crash_info/stacktrace.rs
+8 −0 crashtracker/src/crash_info/telemetry.rs
+137 −0 crashtracker/src/receiver/entry_points.rs
+102 −0 crashtracker/src/receiver/mod.rs
+5 −215 crashtracker/src/receiver/receive_report.rs
+37 −4 crashtracker/src/rfc5_crash_info/builder.rs
+50 −10 crashtracker/src/rfc5_crash_info/stacktrace.rs
+8 −0 crashtracker/src/rfc5_crash_info/telemetry.rs
+6 −1 data-pipeline-ffi/src/error.rs
+15 −0 data-pipeline/src/trace_exporter/error.rs
+47 −0 data-pipeline/src/trace_exporter/mod.rs
+102 −0 ddcommon-ffi/src/cstr.rs
+2 −0 ddcommon-ffi/src/lib.rs
+19 −9 ddcommon-ffi/src/vec.rs
+45 −0 docs/RFCs/0006-crashtraker-incomplete-stacktraces.md
+452 −0 docs/RFCs/artifacts/0006-crashtracker-schema.json
+1 −0 dogstatsd/Cargo.toml
+182 −5 dogstatsd/src/datadog.rs
+18 −4 dogstatsd/src/dogstatsd.rs
+4 −2 dogstatsd/src/errors.rs
+19 −14 dogstatsd/src/flusher.rs
+31 −17 dogstatsd/src/metric.rs
+16 −8 dogstatsd/tests/integration_test.rs
+4 −0 examples/ffi/CMakeLists.txt
+6 −3 examples/ffi/crashinfo.cpp
+54 −0 examples/ffi/library_config.c
+27 −0 library-config-ffi/Cargo.toml
+10 −0 library-config-ffi/build.rs
+39 −0 library-config-ffi/cbindgen.toml
+132 −0 library-config-ffi/src/lib.rs
+19 −0 library-config/Cargo.toml
+584 −0 library-config/src/lib.rs
+2 −0 profiling-ffi/Cargo.toml
+4 −0 profiling-ffi/src/lib.rs
+1 −1 serverless/Cargo.toml
+12 −7 serverless/src/main.rs
+17 −2 spawn_worker/src/trampoline.c
+3 −1 tools/docker/Dockerfile.build
+32 −0 trace-obfuscation/benches/benchmarks/ip_address_bench.rs
+1 −0 trace-obfuscation/benches/benchmarks/mod.rs
+1 −0 trace-obfuscation/benches/trace_obfuscation.rs
+281 −0 trace-obfuscation/src/ip_address.rs
+1 −0 trace-obfuscation/src/lib.rs

0 comments on commit 51e8314

Please sign in to comment.