-
Notifications
You must be signed in to change notification settings - Fork 7
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
[TEX] Report transaction level metrics #6595
Conversation
Generate changelog in
|
static void reportExpectationsCollectedData( | ||
ExpectationsAwareTransaction transaction, ExpectationsMetrics metrics, boolean isStillRunning) { | ||
if (isStillRunning) { | ||
log.error("reportExpectationsCollectedData is called on an in-progress transaction"); |
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.
The only meh thing here is that we won't log state
here. I had added it in the old old PR because this code path was hit. Now that that's fixed, it's not needed (we could always RC if it comes up) as the conditional logic was fixed!
@@ -571,6 +575,25 @@ private Iterator<Map.Entry<Cell, byte[]>> getSortedColumnsLocalWrites( | |||
cellComparator); | |||
} | |||
|
|||
@VisibleForTesting | |||
static void reportExpectationsCollectedData( | |||
ExpectationsAwareTransaction transaction, ExpectationsMetrics metrics, boolean isStillRunning) { |
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.
Some remarks,
- This does not have to live here. We could put it elsewhere but I haven't thought of a good place
- This can't be in
ExpectationsAwareTransaction
(as a default method or static) becauseExpectationsMetrics
is not accessible from there (otherwise, circular dep & moving metrics definition to the api package is kind of yuck) - This is a static because I wanted an instance of
ExpectationsAwareTransaction
because that's all what I need. It's also much easier to test since I don't have to do the dance of constructingSnapshotTransaction
.
...sdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java
Show resolved
Hide resolved
...sdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java
Outdated
Show resolved
Hide resolved
...ared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManagerTest.java
Outdated
Show resolved
Hide resolved
…sdb into aalouane/tex/reportMetrics
|
||
@VisibleForTesting | ||
static void reportExpectationsCollectedData( | ||
ExpectationsAwareTransaction transaction, ExpectationsMetrics metrics, boolean isStillRunning) { |
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.
discussed offline: boolean param is probably unnecessary, I think it's ok to not have coverage for log.error(...); return;
} | ||
|
||
@VisibleForTesting | ||
static void reportExpectationsCollectedData(ExpectationsAwareTransaction transaction, ExpectationsMetrics metrics) { |
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.
discussed offline: this is good, but let's just pass in the age and 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.
👍
General
#6340 adapted to be more testable.
Before this PR:
We collect bytes read data by intercepting the kvsService (and also the transaction age) and don't do anything with it
After this PR:
We report metrics
==COMMIT_MSG==
==COMMIT_MSG==
Priority:
P2
Concerns / possible downsides (what feedback would you like?):
I twisted this around from the original implementation for easier testing. Is it wonky? yes
Is documentation needed?:
No
Compatibility
Does this PR create any API breaks (e.g. at the Java or HTTP layers) - if so, do we have compatibility?:
No
Does this PR change the persisted format of any data - if so, do we have forward and backward compatibility?:
No
The code in this PR may be part of a blue-green deploy. Can upgrades from previous versions safely coexist? (Consider restarts of blue or green nodes.):
Yes
Does this PR rely on statements being true about other products at a deployment - if so, do we have correct product dependencies on these products (or other ways of verifying that these statements are true)?:
No
Does this PR need a schema migration?
No
Testing and Correctness
What, if any, assumptions are made about the current state of the world? If they change over time, how will we find out?:
N/A
What was existing testing like? What have you done to improve it?:
Added some (though not 100%) coverage to the new metrics reporting
If this PR contains complex concurrent or asynchronous code, is it correct? The onus is on the PR writer to demonstrate this.:
N/A
If this PR involves acquiring locks or other shared resources, how do we ensure that these are always released?:
N/A
Execution
How would I tell this PR works in production? (Metrics, logs, etc.):
Metrics show up
Has the safety of all log arguments been decided correctly?:
No log args
Will this change significantly affect our spending on metrics or logs?:
Very marginally
How would I tell that this PR does not work in production? (monitors, etc.):
Metrics do not show up, we see logs indicating report being called on in-progress transactions
If this PR does not work as expected, how do I fix that state? Would rollback be straightforward?:
recall and rollback
If the above plan is more complex than “recall and rollback”, please tag the support PoC here (if it is the end of the week, tag both the current and next PoC):
@jeremyk-91
Scale
Would this PR be expected to pose a risk at scale? Think of the shopping product at our largest stack.:
No
Would this PR be expected to perform a large number of database calls, and/or expensive database calls (e.g., row range scans, concurrent CAS)?:
No
Would this PR ever, with time and scale, become the wrong thing to do - and if so, how would we know that we need to do something differently?:
No, unless we start tagging these metrics with custom names. In that case, care must be put into limiting the max distinct names allowed
Development Process
Where should we start reviewing?:
SnapshotTransaction
If this PR is in excess of 500 lines excluding versions lock-files, why does it not make sense to split it?:
N/A
Please tag any other people who should be aware of this PR:
@jeremyk-91
@sverma30
@raiju