#  How to Instrument Custom Methods in .NET with Elastic APM (Like New Relic XML Configuration)

**URL:** <https://discuss.elastic.co/t/how-to-instrument-custom-methods-in-net-with-elastic-apm-like-new-relic-xml-configuration/374883>\
**Category:** APM\
**Tags:** elastic-stack-monitoring, dotnet, open-telemetry\
**Created:** [February 22, 2025, 2:44pm UTC](https://discuss.elastic.co/t/how-to-instrument-custom-methods-in-net-with-elastic-apm-like-new-relic-xml-configuration/374883 "2025-02-22T14:44:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevOps\_OSL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devops_osl/32/141553_2.png) [@DevOps\_OSL](https://discuss.elastic.co/u/DevOps_OSL)\
**Post date:** [February 22, 2025, 2:44pm UTC](https://discuss.elastic.co/t/how-to-instrument-custom-methods-in-net-with-elastic-apm-like-new-relic-xml-configuration/374883/1 "2025-02-22T14:44:41Z")

</div>

Hi everyone,

We are migrating to Elastic APM and trying to achieve custom **method instrumentation** for our **.NET** application. In **New Relic** , we used **XML configuration** to declare specific methods for instrumentation (as described ([https://docs.newrelic.com/docs/apm/agents/net-agent/custom-instrumentation/add-detail-transactions-xml-net/](https://link))).

We followed the Elastic APM .NET agent auto-instrumentation guide ([https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup-auto-instrumentation.html](https://link))), but the results only show **HTTP requests, database queries, and Redis calls** — our custom code methods don’t appear in the traces.

Is there a way to manually configure or declare custom methods for instrumentation that are similar to **New Relic’s XML** approach? Or is there an alternative solution to achieve this with Elastic APM without changing my existing code?

We’d really appreciate any guidance or best practices to get this working!

Thanks in advance!
