Elastic APM java agent ignore specific gRPC function

Hello guys,
I'm using Elastic APM Java agent to instrument my application, which is a gRPC server. My server implement gRPC healthcheck protocol and the healthcheck function is called every 10 seconds. I don't want to record this transaction. How to exclude specific gRPC function from being instrumented by APM agent? I know an option is ELASTIC_APM_TRANSACTION_IGNORE_URLS but it's for HTTP server only.
Any help is appreciate. Thank you.

You could try excluding the health check class from the instrumentation

Thank you for your reply.
I've tried the options (through setting environment variable ELASTIC_APM_CLASSES_EXCLUDED_FROM_INSTRUMENTATION and restart service) but not luck.
For this specific case, I've used gRPC Health Checking Protocol, which has already implemented by the gRPC library. I've tried set the env with following values:


The request still reported by APM agent:

@Eyal_Koren, do you know what can be done here? @duclm2609 tried to use the classes_excluded_from_instrumentation property using a fully qualified class, but maybe the property expects a matching wildcard?


It looks to me like there is no simple way to do this. I'd say it's a feature request similar to HTTP configuration options | APM Java Agent Reference [1.x] | Elastic . Looks like it wouldn't be hard to add (make an exclude requests method in the GrpcHelper class similar to the HttpHandlerAdvice.isExcluded() method, and apply that the helper methods to not activate the transaction if the request matches. I'd use the transaction.getNameAsString() to match against whatever set of regexes are excluded. We don't have time to do this right now, but feel free to raise the feature request