Skip to content

Commit 3e23441

Browse files
committed
Drop rare sampling support on CSS
1 parent 316ea27 commit 3e23441

File tree

2 files changed

+2
-44
lines changed

2 files changed

+2
-44
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,9 @@ private boolean publish(CoreSpan<?> span, boolean isTopLevel) {
319319
SPAN_KINDS.computeIfAbsent(
320320
spanKind, UTF8BytesString::create), // save repeated utf8 conversions
321321
getPeerTags(span, spanKind.toString()));
322-
boolean isNewKey = false;
323322
MetricKey key = keys.putIfAbsent(newKey, newKey);
324323
if (null == key) {
325324
key = newKey;
326-
isNewKey = true;
327325
}
328326
long tag = (span.getError() > 0 ? ERROR_TAG : 0L) | (isTopLevel ? TOP_LEVEL_TAG : 0L);
329327
long durationNanos = span.getDurationNano();
@@ -340,7 +338,6 @@ private boolean publish(CoreSpan<?> span, boolean isTopLevel) {
340338
}
341339
// recycle the older key
342340
key = batch.getKey();
343-
isNewKey = false;
344341
}
345342
batch = newBatch(key);
346343
batch.add(tag, durationNanos);
@@ -349,8 +346,8 @@ private boolean publish(CoreSpan<?> span, boolean isTopLevel) {
349346
pending.put(key, batch);
350347
// must offer to the queue after adding to pending
351348
inbox.offer(batch);
352-
// force keep keys we haven't seen before or errors
353-
return isNewKey || span.getError() > 0;
349+
// force keep keys there are errors
350+
return span.getError() > 0;
354351
}
355352

356353
private List<UTF8BytesString> getPeerTags(CoreSpan<?> span, String spanKind) {

dd-trace-core/src/test/groovy/datadog/trace/common/metrics/ConflatingMetricAggregatorTest.groovy

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -661,45 +661,6 @@ class ConflatingMetricAggregatorTest extends DDSpecification {
661661
aggregator.close()
662662
}
663663

664-
def "aggregator should force keep the first of each key it sees"() {
665-
setup:
666-
int maxAggregates = 10
667-
MetricWriter writer = Mock(MetricWriter)
668-
Sink sink = Stub(Sink)
669-
DDAgentFeaturesDiscovery features = Mock(DDAgentFeaturesDiscovery)
670-
features.supportsMetrics() >> true
671-
features.peerTags() >> []
672-
ConflatingMetricsAggregator aggregator = new ConflatingMetricsAggregator(empty,
673-
features, HealthMetrics.NO_OP, sink, writer, maxAggregates, queueSize, 1, SECONDS)
674-
long duration = 100
675-
aggregator.start()
676-
677-
when:
678-
def overrides = new boolean[10]
679-
for (int i = 0; i < 5; ++i) {
680-
overrides[i] = aggregator.publish([
681-
new SimpleSpan("service" + i, "operation", "resource", "type", false, true, false, 0, duration, HTTP_OK)
682-
])
683-
}
684-
for (int i = 0; i < 5; ++i) {
685-
overrides[i + 5] = aggregator.publish([
686-
new SimpleSpan("service" + i, "operation", "resource", "type", false, true, false, 0, duration, HTTP_OK)
687-
])
688-
}
689-
690-
then: "override only the first of each point in the interval"
691-
for (int i = 0; i < 5; ++i) {
692-
assert overrides[i]
693-
}
694-
// these were all repeats, so should be ignored
695-
for (int i = 5; i < 10; ++i) {
696-
assert !overrides[i]
697-
}
698-
699-
cleanup:
700-
aggregator.close()
701-
}
702-
703664
def "should be resilient to serialization errors"() {
704665
setup:
705666
int maxAggregates = 10

0 commit comments

Comments
 (0)