I am using elastic-apm with spring application to monitor API requests and track all SQL's executed for given endpoint. The problem is give the amount of traffic elastic search is collecting huge magnitude of data and I would like to enable capturing span only for specific endpoints. I tried using public api of elastic-apm https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html I can customize a transaction and span but I couldn't find a way to enable/disable to specific endpoints. I have tried this but no luck -
ElasticApm.currentSpan().startSpan();
ElasticApm.currentSpan().end();