Skip to content

Commit 041ea17

Browse files
authored
Merge pull request #157 from influxdata/crepererum/logging
feat: logging
2 parents 53a7944 + 5d02fcf commit 041ea17

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ datafusion-udf-wasm-query = { path = "query", version = "0.1.0" }
3131
http = { version = "1.3.1", default-features = false }
3232
hyper = { version = "1.8", default-features = false }
3333
insta = { version = "1.43.2", "default-features" = false }
34+
log = { version = "0.4.28", default-features = false }
3435
pyo3 = { version = "0.27.1", default-features = false, features = ["macros"] }
3536
sqlparser = { version = "0.55.0", default-features = false, features = [
3637
"std",

host/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ datafusion-expr.workspace = true
1212
datafusion-udf-wasm-arrow2bytes.workspace = true
1313
http.workspace = true
1414
hyper.workspace = true
15+
log.workspace = true
1516
rand = { version = "0.9" }
1617
siphasher = { version = "1", default-features = false }
1718
tar.workspace = true

host/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ impl WasiHttpView for WasmStateImpl {
143143
.validate(&request, config.use_tls)
144144
.map_err(|_| HttpErrorCode::HttpRequestDenied)?;
145145

146+
log::debug!(
147+
"UDF HTTP request: {} {}",
148+
request.method().as_str(),
149+
request.uri(),
150+
);
146151
default_send_request_handler(request, config).await
147152
};
148153

@@ -203,6 +208,12 @@ impl WasmComponentPrecompiled {
203208
.precompile_component(&wasm_binary)
204209
.context("pre-compile component", None)?;
205210

211+
log::debug!(
212+
"Pre-compiled {} bytes of WASM bytecode into {} bytes",
213+
wasm_binary.len(),
214+
compiled_component.len()
215+
);
216+
206217
// SAFETY: the compiled version was produced by us with the same engine. This is NOT external/untrusted input.
207218
let component_res = unsafe { Component::deserialize(&engine, compiled_component) };
208219
let component = component_res.context("create WASM component", None)?;

host/src/vfs.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ impl Allocation {
214214
}
215215
}
216216

217+
/// Get current allocation size.
218+
fn get(&self) -> u64 {
219+
self.n.load(Ordering::SeqCst)
220+
}
221+
217222
/// Increase allocation by given amount.
218223
fn inc(&self, n: u64) -> Result<(), FailedAllocation> {
219224
self.n
@@ -404,6 +409,13 @@ impl VfsState {
404409
}
405410
}
406411

412+
log::info!(
413+
"unpacked WASM guest root filesystem from {} bytes TAR, consuming {} bytes and {} inodes",
414+
tar_data.len(),
415+
self.allocation.bytes.get(),
416+
self.allocation.inodes.get()
417+
);
418+
407419
Ok(())
408420
}
409421
}

0 commit comments

Comments
 (0)