Skip to content

BSP benchmark aux counters (exportedSpans/droppedSpans) always report zero #8538

Description

@EvgeniiR

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions