apollographql / federation-rs

Contains source code for Apollo Federation's Rust<--> JavaScript interop
Other
35 stars 23 forks source link

get heap statistics from deno #558

Closed Geal closed 1 month ago

Geal commented 1 month ago

This adds a planner event to request V8 heap statistics.

This data is gathered from the JS side because the related methods from the rust side require a &mut access to the runtime, which is impossible since it already runs in an infinite loop. Since we elected to not run the prelude parts of deno which register functions like Deno.memory_usage, we intern the op_runtime_memory_usage function and import it directly as a host function, as we've done already with op_crypto_get_random_values. To avoid hosting too much code, the rss field is not filled (it needs platform specific functions), since that info can generally be obtained by other means.