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
destroyApmServices();
    }
    @Override
    protected void doClose() {}
    private APMServices createApmServices() {
        assert this.enabled;
        assert this.services == null;
        return AccessController.doPrivileged((PrivilegedAction<APMServices>) () -> {
            var openTelemetry = GlobalOpenTelemetry.get();
            var tracer = openTelemetry.getTracer("elasticsearch", Version.CURRENT.toString());
            return new APMServices(tracer, openTelemetry);
        });
    }
    private void destroyApmServices() {
        this.services = null;
        this.spans.clear();
    }
    @Override
    public void startTrace(ThreadContext threadContext, String spanId, String spanName, @Nullable Map<String, Object> attributes) {
        assert threadContext != null;
        assert spanId != null;
        assert spanName != null;
        
        var services = this.services;
        if (services == null) {
            return;
        }
        if (filterAutomaton.run(spanName) == false) {
            logger.trace("Skipping tracing [{}] [{}] as it has been filtered out", spanId, spanName);
            return;