0
votes

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();
1

1 Answers

0
votes

Looks like it can be done using drop_event processor in api-server.yml.

processors:
 - drop_event:
     when:
       equals:
         transaction.custom.transactions_sampled: false

and in code set custom context:

Transaction elasticTransaction = ElasticApm.currentTransaction();
elasticTransaction.addCustomContext("transactions.sampled", false);