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
Capture document size, RU usage, retry stats for get and put in CosmosDB #4652
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4652 +/- ##
==========================================
- Coverage 84.46% 78.42% -6.04%
==========================================
Files 183 184 +1
Lines 8377 8433 +56
Branches 566 604 +38
==========================================
- Hits 7076 6614 -462
- Misses 1301 1819 +518
Continue to review full report at Codecov.
|
@@ -476,10 +488,11 @@ class CosmosDBArtifactStore[DocumentAbstraction <: DocumentSerializer](protected | |||
(clusterId, clusterIdValue)) | |||
val fieldsToRemove = Seq(_id, _rev) | |||
val mapped = transform(json, fieldsToAdd, fieldsToRemove) | |||
val jsonString = mapped.compactPrint | |||
val doc = new Document(mapped.compactPrint) |
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.
maybe should avoid calling mapped.compactPrint
twice?
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.
Missed that while refactoring. Reused existing computed json
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 - one minor suggestion
…sDB (apache#4652) * Enable collection of retry stats * Log document size and RU used for get and put operation * Include extra logs for transaction with debug mode enabled * Histogram metric for document size * Add custom histogram buckets for retry stats
This PR enables capturing stats related to document size and RU used for get and put operation.
Description
Document Size Stats
With this PR the
get
andput
operation would include the document size and RU usedFurther the PR also add a histogram for document size.
Client Diagnostic Stats
If the
TransactionId
has debug mode enabled (extension of support added in #4275) then it would also include some client side diagnostic info generated by CosmosDB when usingDirect
modeRetry stats
The PR also enabled to capture the internal retry done by SDK upon throttling. Currently there is no direct support to capture such stats (Azure/azure-cosmosdb-java#262). So this PR makes use of Logback to capture the stats by intercepting the warning log message generated upon a 429 response
A typical log message looks like above which has info related to
Prometheus metrics for retry
Prometheus histogram for retry attempt
Related issue and scope
My changes affect the following components
Types of changes
Checklist: