# Can you record parameters from a function call during tracing?

**URL:** <https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438>\
**Category:** APM\
**Tags:** java\
**Created:** [September 29, 2021, 6:49am UTC](https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438 "2021-09-29T06:49:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![c64zottel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/c64zottel/32/95230_2.png) [@c64zottel](https://discuss.elastic.co/u/c64zottel)\
**Post date:** [September 29, 2021, 6:49am UTC](https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438/1 "2021-09-29T06:49:47Z")

</div>

We can define functions to be measured during there call with: trace\_methods. If I have a function:  
`String doStuff(int bankID);`  
Is it possible to record bankID in tracing information?  
AppDynamics offers Information Points for this functionality. But AppDynamics is pretty unstable.

We do not want to add anything to our source code.

---

<div class="post-metadata">

**Author:** ![nugusbayevkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nugusbayevkk/32/126683_2.png) [@nugusbayevkk](https://discuss.elastic.co/u/nugusbayevkk)\
**Post date:** [September 29, 2021, 6:58am UTC](https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438/2 "2021-09-29T06:58:20Z")

</div>

Hi @c64zottel ,  
you can use [Public API | APM Java Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#public-api) .  
And in your method `String doStiff(int bankID)` you can access to [current active span](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-current-span) and call `setLabel` [method](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-span-add-tag).

---

<div class="post-metadata">

**Author:** ![c64zottel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/c64zottel/32/95230_2.png) [@c64zottel](https://discuss.elastic.co/u/c64zottel)\
**Post date:** [September 29, 2021, 7:07am UTC](https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438/3 "2021-09-29T07:07:25Z")

</div>

Thanks @nugusbayevkk.  
We are actually trying to get the parameters without adding source code.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [September 29, 2021, 11:42am UTC](https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438/4 "2021-09-29T11:42:32Z")

</div>

Currently there is no way to achieve that without code changes, nor it is planned to be supported soon.

If you are worried about adding vendor-specific stuff to your source code, you may use OpenTracing API (e.g. `io.opentracing.Span#setTag()`) and use our [OpenTracing bridge](https://www.elastic.co/guide/en/apm/agent/java/current/opentracing-bridge.html) instead.

We are already working on supporting the OpenTelemetry API as well, so achieving vendor-agnostic code changes through this API will be available in the future as well.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 20, 2021, 7:43am UTC](https://discuss.elastic.co/t/can-you-record-parameters-from-a-function-call-during-tracing/285438/5 "2021-10-20T07:43:02Z")

</div>

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