This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
[QoS] live reload #2710
Merged
Merged
[QoS] live reload #2710
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,19 @@ | |
|
||
package com.palantir.atlasdb.qos.metrics; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.codahale.metrics.Meter; | ||
import com.palantir.atlasdb.qos.QueryWeight; | ||
import com.palantir.atlasdb.util.MetricsManager; | ||
import com.palantir.logsafe.SafeArg; | ||
|
||
// TODO(nziebart): needs tests | ||
public class QosMetrics { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(QosMetrics.class); | ||
|
||
private final MetricsManager metricsManager = new MetricsManager(); | ||
|
||
private final Meter readRequestCount; | ||
|
@@ -34,6 +41,8 @@ public class QosMetrics { | |
private final Meter writeTime; | ||
private final Meter rowsWritten; | ||
|
||
private final Meter backoffTime; | ||
private final Meter rateLimitedExceptions; | ||
|
||
public QosMetrics() { | ||
readRequestCount = metricsManager.registerMeter(QosMetrics.class, "numReadRequests"); | ||
|
@@ -45,6 +54,9 @@ public QosMetrics() { | |
bytesWritten = metricsManager.registerMeter(QosMetrics.class, "bytesWritten"); | ||
writeTime = metricsManager.registerMeter(QosMetrics.class, "writeTime"); | ||
rowsWritten = metricsManager.registerMeter(QosMetrics.class, "rowsWritten"); | ||
|
||
backoffTime = metricsManager.registerMeter(QosMetrics.class, "backoffTime"); | ||
rateLimitedExceptions = metricsManager.registerMeter(QosMetrics.class, "rateLimitedExceptions"); | ||
} | ||
|
||
public void recordRead(QueryWeight weight) { | ||
|
@@ -61,4 +73,17 @@ public void recordWrite(QueryWeight weight) { | |
rowsWritten.mark(weight.numDistinctRows()); | ||
} | ||
|
||
public void recordBackoffMicros(long backoffTimeMicros) { | ||
if (backoffTimeMicros > 0) { | ||
log.info("Backing off for {} micros", SafeArg.of("backoffTimeMicros", backoffTimeMicros)); | ||
backoffTime.mark(backoffTimeMicros); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could make strange graphs if we only mark when backing off. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'd look at the derivative or m1/m5 rates for this graph (it's basically a indicator of whether or not you're currently getting rate limited, and by how much) |
||
} | ||
} | ||
|
||
public void recordRateLimitedException() { | ||
log.info("Rate limit exceeded and backoff time would be more than the configured maximum. " | ||
+ "Throwing a throttling exception"); | ||
rateLimitedExceptions.mark(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should be "Backed off" since this gets logged after sleeping