-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Write makeSnapshot telemetry to slog #6188
Conversation
d514ce5
to
2718bdb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly stylistic nits, but I'd like to measure the hashing time since it's sequential, and we should stay consistent regarding time formatting in the slog.
@mhofman I've taken all your suggestions. PTAL. |
@@ -231,12 +237,13 @@ export function makeSnapStore( | |||
if (fileStat) { | |||
return freeze(info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we stat
ed the file, should we include the compressedByteCount
with a 0
or undefined
compressSeconds
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point... I think we do want to emit fields consistently, including data types. I've opted to read compressedByteCount
from stat info, use 0 for compressSeconds
, and introduce a boolean newFile
to support exclusion of those values for accurate statistics.
async function atomicWrite(destFilePath, writeContents) { | ||
// Atomicity requires remaining on the same filesystem, | ||
// so we perform all operations in the destination directory. | ||
const dir = resolve(destFilePath, '..'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use dirname
?
const dir = resolve(destFilePath, '..'); | |
const dir = path.dirname(destFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve
is an endowment to makeSnapStore
, and I didn't want to require another one or risk conflict between it and the built-in path module (however unlikely that may be). But I've restored root-relative behavior to avoid that, and this should be refactored in the performance-improving followup anyway.
48e7fd5
to
fd1b27d
Compare
@mhofman Back to you. And should I start work on the performance improvements, or did you plan to take that on? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…e vs. existing-file
It was missing a valid export in a dependency package. Ref 000f738
3188a60
to
45bc40d
Compare
closes: #6164
Description
Endow SnapStore instances with a now function so
save
can return duration and size telemetry all the way up to VatKeepersaveSnapshot
where it is written into the slog.Security Considerations
Filesystem access is generally more powerful than a timer, so this should be acceptable.
Documentation Considerations
n/a
Testing Considerations
I'm not actually testing slog contents, is that something we do?