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
} else if (value instanceof Double) {
                    spanBuilder.setAttribute(key, (Double) value);
                } else if (value instanceof Boolean) {
                    spanBuilder.setAttribute(key, (Boolean) value);
                } else {
                    throw new IllegalArgumentException(
                        "span attributes do not support value type of [" + value.getClass().getCanonicalName() + "]"
                    );
                }
            }
            final boolean isHttpSpan = spanAttributes.keySet().stream().anyMatch(key -> key.startsWith("http."));
            spanBuilder.setSpanKind(isHttpSpan ? SpanKind.SERVER : SpanKind.INTERNAL);
        } else {
            spanBuilder.setSpanKind(SpanKind.INTERNAL);
        }
        spanBuilder.setAttribute(org.elasticsearch.tracing.Tracer.AttributeKeys.NODE_NAME, nodeName);
        spanBuilder.setAttribute(org.elasticsearch.tracing.Tracer.AttributeKeys.CLUSTER_NAME, clusterName);
        final String xOpaqueId = threadContext.getHeader(Task.X_OPAQUE_ID_HTTP_HEADER);
        if (xOpaqueId != null) {
            spanBuilder.setAttribute("es.x-opaque-id", xOpaqueId);
        }
    }
    @Override
    public void addError(String spanId, Throwable throwable) {
        final var span = spanFromContextOrNullWithoutLogging(spans.get(spanId));
        if (span != null) {
            span.recordException(throwable);
        }
    }
    @Override