# In the dotnet profiler auto-instrument agent, can I configure it to only send trace data while not sending metric and log data?

**URL:** <https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [November 21, 2024, 8:03am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875 "2024-11-21T08:03:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ysj2018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ysj2018/32/139318_2.png) [@ysj2018](https://discuss.elastic.co/u/ysj2018)\
**Post date:** [November 21, 2024, 8:03am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/1 "2024-11-21T08:03:11Z")

</div>

I'm using the profiler auto-instrument 1.30 to monitor a dotnet application, and it's working fine. However, I only want to send trace data to the backend, without sending metrics and logs. Can I achieve this capability through configuration?

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [November 21, 2024, 8:24am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/2 "2024-11-21T08:24:50Z")

</div>

The .NET agent only sends traces and metrics, not logs. You can disable metrics entirely by setting the [MetricsInterval](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-reporter.html#config-metrics-interval) configuration to 0. Using the profiler, you can set this via the `ELASTIC_APM_DISABLE_METRICS` environment variable.

---

<div class="post-metadata">

**Author:** ![ysj2018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ysj2018/32/139318_2.png) [@ysj2018](https://discuss.elastic.co/u/ysj2018)\
**Post date:** [November 21, 2024, 8:41am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/3 "2024-11-21T08:41:14Z")

</div>

Thank you for your previous question. Regarding the configurations supported by the profiler's auto-instrumentation, do you have a list of all the configurations it supports? I would like to see them all.

---

<div class="post-metadata">

**Author:** ![ysj2018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ysj2018/32/139318_2.png) [@ysj2018](https://discuss.elastic.co/u/ysj2018)\
**Post date:** [November 21, 2024, 9:03am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/4 "2024-11-21T09:03:25Z")

</div>

I used the following script to configure environment variables for the application pool, but disabling metrics didn't work. I still see metric data being sent to the backend.

```auto
$appcmd = "$($env:systemroot)\system32\inetsrv\AppCmd.exe"
$appPool = "disablemetrictest" 
$profilerHomeDir = "D:\agent" 
$environment = @{
  CORECLR_ENABLE_PROFILING = "1"
  CORECLR_PROFILER = "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
  CORECLR_PROFILER_PATH = "$profilerHomeDir\elastic_apm_profiler.dll"
  ELASTIC_APM_PROFILER_HOME = "$profilerHomeDir"
  ELASTIC_APM_PROFILER_INTEGRATIONS = "$profilerHomeDir\integrations.yml"
  ELASTIC_APM_SERVER_URL = "http://localhost:8200" 
  ELASTIC_APM_SERVICE_NAME = "dotnettestdisablemetric"
  ELASTIC_APM_DISABLE_METRICS = "true"
}

$environment.Keys | ForEach-Object {
  & $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}

```

---

<div class="post-metadata">

**Author:** ![ysj2018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ysj2018/32/139318_2.png) [@ysj2018](https://discuss.elastic.co/u/ysj2018)\
**Post date:** [November 21, 2024, 9:05am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/5 "2024-11-21T09:05:52Z")

</div>

And in the script above, I also tested setting the value of `ELASTIC_APM_DISABLE_METRICS` to `1` , but it didn't work as well.

---

<div class="post-metadata">

**Author:** ![ysj2018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ysj2018/32/139318_2.png) [@ysj2018](https://discuss.elastic.co/u/ysj2018)\
**Post date:** [November 21, 2024, 11:15am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/6 "2024-11-21T11:15:31Z")

</div>

I have tried setting `ELASTIC_APM_METRICS_INTERVAL` to `0` , but I am still seeing data with `"metricset": { "period": 60000 }` being received by the APM server. I am sure that the environment variable is successfully set, as I have found the correct configuration in the IIS configuration file `applicationHost.config` . However, it seems that the setting is not taking effect based on the results.

---

<div class="post-metadata">

**Author:** ![ysj2018](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ysj2018/32/139318_2.png) [@ysj2018](https://discuss.elastic.co/u/ysj2018)\
**Post date:** [November 21, 2024, 11:17am UTC](https://discuss.elastic.co/t/in-the-dotnet-profiler-auto-instrument-agent-can-i-configure-it-to-only-send-trace-data-while-not-sending-metric-and-log-data/370875/7 "2024-11-21T11:17:14Z")

</div>

The script for setting the environment variable is as follows:

```auto
$appcmd = "$($env:systemroot)\system32\inetsrv\AppCmd.exe"
$appPool = "metrics0" 
$profilerHomeDir = "D:\agent" 
$environment = @{
  CORECLR_ENABLE_PROFILING = "1"
  CORECLR_PROFILER = "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
  CORECLR_PROFILER_PATH = "$profilerHomeDir\elastic_apm_profiler.dll"
  ELASTIC_APM_PROFILER_HOME = "$profilerHomeDir"
  ELASTIC_APM_PROFILER_INTEGRATIONS = "$profilerHomeDir\integrations.yml"
  ELASTIC_APM_SERVER_URL = "http://localhost:8200" 
  ELASTIC_APM_SERVICE_NAME = "dotnettestmetrics0"
  ELASTIC_APM_METRICS_INTERVAL = "0"
}

$environment.Keys | ForEach-Object {
  & $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}

```
