Skip to content

Commit 28e4265

Browse files
committed
Debug file
1 parent bacfe33 commit 28e4265

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

datadog-crashtracker/src/crash_info/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ impl CrashInfo {
131131
primary_endpoint: &Option<Endpoint>,
132132
secondary_endpoint: &Option<Endpoint>,
133133
) -> anyhow::Result<()> {
134+
let debug_msg = format!(
135+
"DEBUG: async_upload_to_endpoints called with primary: {:?}, secondary: {:?}\n",
136+
primary_endpoint.as_ref().map(|e| e.url.to_string()),
137+
secondary_endpoint.as_ref().map(|e| e.url.to_string())
138+
);
139+
let _ = std::fs::OpenOptions::new()
140+
.create(true)
141+
.append(true)
142+
.open("/tmp/crashtracker_debug.log")
143+
.and_then(|mut f| std::io::Write::write_all(&mut f, debug_msg.as_bytes()));
134144
// If we're debugging to a file, dump the actual crashinfo into a json
135145
if let Some(endpoint) = primary_endpoint {
136146
if Some("file") == endpoint.url.scheme_str() {

datadog-crashtracker/src/shared/configuration.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,25 @@ impl<'de> serde::Deserialize<'de> for CrashtrackerConfiguration {
246246

247247
// Apply secondary endpoint derivation logic during deserialization
248248
let secondary_endpoint = helper.secondary_endpoint.or_else(|| {
249-
helper
249+
let derived = helper
250250
.endpoint
251251
.as_ref()
252-
.and_then(derive_default_secondary_endpoint)
252+
.and_then(derive_default_secondary_endpoint);
253+
if let Some(ref endpoint) = derived {
254+
let _ = std::fs::write(
255+
"/tmp/crashtracker_debug.log",
256+
format!(
257+
"DEBUG: Derived secondary endpoint during deserialization: {}\n",
258+
endpoint.url
259+
),
260+
);
261+
} else {
262+
let _ = std::fs::write(
263+
"/tmp/crashtracker_debug.log",
264+
"DEBUG: No secondary endpoint derived during deserialization\n",
265+
);
266+
}
267+
derived
253268
});
254269

255270
Ok(CrashtrackerConfiguration {

0 commit comments

Comments
 (0)