Skip to content

Commit 8fea172

Browse files
dougqhclaude
andcommitted
Address bric3 final review: errorLatencies + resetHandlers doc wording
- AggregateEntry.errorLatencies: note it is not thread-safe (bric3 suggestion) - PeerTagSchema.resetHandlers: adopt bric3's clearer javadoc wording Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2ba6c5d commit 8fea172

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

dd-trace-core/src/main/java/datadog/trace/common/metrics/AggregateEntry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public final class AggregateEntry extends Hashtable.Entry {
5050
// into the entry.
5151
private final Histogram okLatencies;
5252

53-
// Null until first error; SerializingMetricWriter writes empty histogram form when null.
53+
// Null until first error; SerializingMetricWriter writes empty histogram form when null. Not
54+
// thread-safe as well.
5455
@Nullable private Histogram errorLatencies;
5556

5657
private int errorCount;

dd-trace-core/src/main/java/datadog/trace/common/metrics/PeerTagSchema.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,15 @@ UTF8BytesString register(int i, String value) {
119119
}
120120

121121
/**
122-
* Resets every {@link TagCardinalityHandler}'s working set and flushes this cycle's per-tag block
123-
* counts to both {@link HealthMetrics} (as a per-cycle count) and {@code reporter} (accumulated
124-
* by tag name for the rate-limited summary). Flushing by name here is what lets a peer-tag schema
125-
* rebuild discard these handlers without losing counts. Must be called on the aggregator thread;
126-
* handlers are not thread-safe.
122+
* Resets cardinality tracking for each peer tag and reports how many values were blocked since
123+
* the previous reset.
124+
*
125+
* <p>The counts are sent to {@link HealthMetrics} for the current reporting cycle. They are also
126+
* added to {@code reporter}, which groups them by tag name for a rate-limited warning. Grouping
127+
* counts by name ensures they are not lost when a schema rebuild replaces the handlers.
128+
*
129+
* <p>This method must be called only from the aggregator thread because the handlers are not
130+
* thread-safe.
127131
*/
128132
void resetHandlers(HealthMetrics healthMetrics, CardinalityLimitReporter reporter) {
129133
long totalCollapsed = 0;

0 commit comments

Comments
 (0)