-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add metrics to express data cache #1146
Conversation
if result.is_err() { | ||
Err(parse_get_object_error(result).map(ObjectClientError::ServiceError)) | ||
let err = parse_get_object_error(result); |
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.
} | ||
} | ||
|
||
fn emit_failure_metric(&self, reason: &'static str, type_: MetricsType) { |
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.
I'd suggest inlining the metrics calls. This function makes it less clear what you are tracking.
@@ -113,11 +137,15 @@ where | |||
block_offset: u64, | |||
object_size: usize, | |||
) -> DataCacheResult<Option<ChecksummedBytes>> { |
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.
Too many points of failure.
Shall we factor out the logic into an inner method and only handle the metrics here?
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.
Hopefully, we won't need handle_get_object_err
anymore.
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.
I'm not planning on refactoring into an inner method, as that makes the reasons harder to propagate. Did remove the handle_get_object_err
function though
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.
An alternative could be to still split into an inner function which records the failure (and reason), but move the hit/miss metric to the wrapper.
Happy to review the approach later, though.
.get_object_metadata() | ||
.await | ||
.map_err(|err| DataCacheError::IoFailure(err.into()))?; | ||
let object_metadata = match result.get_object_metadata().await { |
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.
As a workaround for the get_object
errors above, why not get the data first here? That will guarantee to return the correct error before trying to get metadata or checksums.
339d2ce
to
31877fb
Compare
31877fb
to
e6efbf1
Compare
Signed-off-by: Simon Beal <[email protected]>
e6efbf1
to
95eb91b
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.
Left a few comments, but completely optional.
} | ||
|
||
#[inline] | ||
fn emit_failure_metric_write(reason: &'static str) { |
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.
nit, non-blocking: we could just inline
@@ -113,11 +137,15 @@ where | |||
block_offset: u64, | |||
object_size: usize, | |||
) -> DataCacheResult<Option<ChecksummedBytes>> { |
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.
An alternative could be to still split into an inner function which records the failure (and reason), but move the hit/miss metric to the wrapper.
Happy to review the approach later, though.
Description of change
Adds metrics to express data cache
Fixes a bug where getting a cache miss would be reported as an error rather than a cache miss
Relevant issues: N/A
Does this change impact existing behavior?
Adds metrics, no user facing functionality changes.
Does this change need a changelog entry in any of the crates?
No
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).