Describe the bug
BatchSpanProcessorDroppedSpansBenchmark, BatchSpanProcessorCpuBenchmark, and
BatchSpanProcessorMultiThreadBenchmark are shipping exportedSpans and droppedSpans aux
counters that silently report 0
Root cause is in BatchSpanProcessorMetrics.getMetric(). The BSP records the dropped
attribute with booleanKey("dropped"), but the filter compared it against a String derived
from the boolean argument:
// before fix — labelValue is "true"/"false", the attribute is Boolean
String labelValue = String.valueOf(dropped);
...
.filter(point -> labelValue.equals(point.getAttributes().get(stringKey("dropped"))))
stringKey("dropped") returns null for a point whose attribute is stored under
booleanKey("dropped"), so labelValue.equals(null) is always false, the filter never
matches, and getMetric() always returns 0.
This was also discussed in #8178 (comment)
Benchmark output example:
Running BatchSpanProcessorDroppedSpansBenchmark on main produces (measured with
-PjmhIterations=1 -PjmhTime=5; the benchmark default is 20s):
Benchmark Mode Score
BatchSpanProcessorDroppedSpansBenchmark.export thrpt 10 054 842 ops/s
exportedSpans: ≈ 0 ops/s ← always zero, bug
droppedSpans: ≈ 0 ops/s ← always zero, bug
dropRatio: n/a ← does not exist on main
More examples are attached to the PR description: #8539
Environment
OpenJDK 21.0.11 (Ubuntu 22.04)
OS: Linux 6.8.0 x86_64
Describe the bug
BatchSpanProcessorDroppedSpansBenchmark,BatchSpanProcessorCpuBenchmark, andBatchSpanProcessorMultiThreadBenchmarkare shippingexportedSpansanddroppedSpansauxcounters that silently report
0Root cause is in
BatchSpanProcessorMetrics.getMetric(). The BSP records thedroppedattribute with
booleanKey("dropped"), but the filter compared it against aStringderivedfrom the boolean argument:
stringKey("dropped")returnsnullfor a point whose attribute is stored underbooleanKey("dropped"), solabelValue.equals(null)is alwaysfalse, the filter nevermatches, and
getMetric()always returns0.This was also discussed in #8178 (comment)
Benchmark output example:
Running
BatchSpanProcessorDroppedSpansBenchmarkon main produces (measured with-PjmhIterations=1 -PjmhTime=5; the benchmark default is 20s):More examples are attached to the PR description: #8539
Environment
OpenJDK 21.0.11 (Ubuntu 22.04)
OS: Linux 6.8.0 x86_64