Skip to content

Commit ff25097

Browse files
Merge pull request DataDog#4449 from DataDog/bbujon/serial-failed-metrics
Add metric for serialization failure
2 parents efd84a2 + d5a1548 commit ff25097

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dd-trace-core/src/main/java/datadog/trace/core/monitor/HealthMetrics.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public class HealthMetrics implements AutoCloseable {
6161
CountersFactory.createFixedSizeStripedCounter(8);
6262
private final FixedSizeStripedLongCounter samplerKeepDroppedTraces =
6363
CountersFactory.createFixedSizeStripedCounter(8);
64+
private final FixedSizeStripedLongCounter serialFailedDroppedTraces =
65+
CountersFactory.createFixedSizeStripedCounter(8);
6466
private final FixedSizeStripedLongCounter unsetPriorityDroppedTraces =
6567
CountersFactory.createFixedSizeStripedCounter(8);
6668

@@ -174,8 +176,7 @@ public void onSerialize(final int serializedSizeInBytes) {
174176
}
175177

176178
public void onFailedSerialize(final List<DDSpan> trace, final Throwable optionalCause) {
177-
// TODO - DQH - make a new stat for serialization failure -- or maybe count this towards
178-
// api.errors???
179+
serialFailedDroppedTraces.inc();
179180
}
180181

181182
public void onCreateSpan() {
@@ -239,6 +240,7 @@ private static class Flush implements AgentTaskScheduler.Task<HealthMetrics> {
239240
private static final String[] USER_KEEP_TAG = new String[] {"priority:user_keep"};
240241
private static final String[] SAMPLER_DROP_TAG = new String[] {"priority:sampler_drop"};
241242
private static final String[] SAMPLER_KEEP_TAG = new String[] {"priority:sampler_keep"};
243+
private static final String[] SERIAL_FAILED_TAG = new String[] {"failure:serial"};
242244
private static final String[] UNSET_TAG = new String[] {"priority:unset"};
243245

244246
@Override
@@ -267,6 +269,11 @@ public void run(HealthMetrics target) {
267269
target.statsd, "queue.dropped.traces", target.samplerDropDroppedTraces, SAMPLER_DROP_TAG);
268270
reportIfChanged(
269271
target.statsd, "queue.dropped.traces", target.samplerKeepDroppedTraces, SAMPLER_KEEP_TAG);
272+
reportIfChanged(
273+
target.statsd,
274+
"queue.dropped.traces",
275+
target.serialFailedDroppedTraces,
276+
SERIAL_FAILED_TAG);
270277
reportIfChanged(
271278
target.statsd, "queue.dropped.traces", target.unsetPriorityDroppedTraces, UNSET_TAG);
272279
reportIfChanged(target.statsd, "queue.enqueued.spans", target.enqueuedSpans, NO_TAGS);

0 commit comments

Comments
 (0)