Capture method arguments and return value in Java

Hello all,

we are trying to evaluate the elastic apm solution. I want to understand whether i can capture any method arguments or return value (of selected methods) without touching the source code?

A similar question was asked over 2 years ago - I wonder if anything has changed? I can't find any references in the documentation.

Regards
Krystian

Hi @kkensy , nothing have changed here and we don't have plans to implement that.

If you could modify the application code the simplest way to do that would be to use the Public API.
Here you state that you can't, so simply using the public API is not an option.

The biggest advantage here is that the code modifications are really simple and straightforward (also easy to revert if needed).

On the other end, the Java agent supports external plugins, which allow you to write a custom plugin for your application that will enable you to modify/add values to the existing spans and transactions that are created by the agent. There is no limitation on what the agent can capture: arguments, return values, even private class attributes could be read and modified.

The major downside here is that the complexity is way higher than a trivial code modification in the application, and will require you to be able to maintain this external plugin over time.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.