# Using both NuGet package and auto instrumentation?

**URL:** <https://discuss.elastic.co/t/using-both-nuget-package-and-auto-instrumentation/336188>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [June 16, 2023, 5:03am UTC](https://discuss.elastic.co/t/using-both-nuget-package-and-auto-instrumentation/336188 "2023-06-16T05:03:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [June 16, 2023, 5:03am UTC](https://discuss.elastic.co/t/using-both-nuget-package-and-auto-instrumentation/336188/1 "2023-06-16T05:03:56Z")

</div>

Hi all,

We are currently testing Elastic APM with .NET microservices (already using it in the Java environment) and we are a bit confused about the different integration options:

We started with the NuGet approach because we wanted to use the MongoDB instrumentation, which is available as NuGet package. Now, we want to also add the Kafka instrumentation which is - according to [this documentation](https://www.elastic.co/guide/en/apm/agent/dotnet/1.x/supported-technologies.html) - only available as profiler auto instrumentation. But switching to this technique is not possible because MongoDB does not support it.

So, my question is: Is it possible to use the "best of both worlds" and use MongoDB NuGet package together with auto instrumentation for Kafka or what would you recommend?

Best regards  
Wolfram

**Kibana version** : 8.7.0

**Elasticsearch version** : 8.7.0

**APM Server version** : 8.7.0

**APM Agent language and version** : .NET 1.22.0

---

<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:** [July 14, 2023, 5:04am UTC](https://discuss.elastic.co/t/using-both-nuget-package-and-auto-instrumentation/336188/2 "2023-07-14T05:04:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [July 14, 2023, 2:29pm UTC](https://discuss.elastic.co/t/using-both-nuget-package-and-auto-instrumentation/336188/3 "2023-07-14T14:29:34Z")

</div>

Hey, sorry for the late reply.

Yes, that is supported. You can just add the [`Elastic.Apm.MongoDb`](https://www.nuget.org/packages/Elastic.Apm.MongoDb) package and configure it - but only do the config for MondoDb and do not enable the agent as a whole.

And then you can inject the agent via environment variables as described in the profiler related doc.
