Version 1.17.0 of the OpenTelemetry Java SDK was released a few days ago, and this release includes a fix for the performance bug identified in https://github.com/elastic/elasticsearch/issues/89107. We should upgrade to the latest version and revert the workaround introduced in https://github.com/elastic/elasticsearch/pull/89135.
modules/apm/src/main/java/org/elasticsearch/tracing/apm/APMTracer.java
public void setAttribute(String spanId, String key, boolean value) {
        final var span = spanFromContextOrNullWithoutLogging(spans.get(spanId));
        if (span != null) {
            span.setAttribute(key, value);
        }
    }
    @Override
    public void setAttribute(String spanId, String key, double value) {
        final var span = spanFromContextOrNullWithoutLogging(spans.get(spanId));
        if (span != null) {
            span.setAttribute(key, value);
        }
    }
    @Override
    public void setAttribute(String spanId, String key, long value) {
        final var span = spanFromContextOrNullWithoutLogging(spans.get(spanId));
        if (span != null) {
            span.setAttribute(key, value);
        }
    }
    @Override
    public void setAttribute(String spanId, String key, String value) {
        final var span = spanFromContextOrNullWithoutLogging(spans.get(spanId));
        if (span != null) {
            span.setAttribute(key, value);
        }
    }
    @Override
    public void stopTrace(String spanId) {
        final var span = spanFromContextOrNullWithoutLogging(spans.remove(spanId));