# System.PlatformNotSupportedException: Performance Counters are not supported on this platform

**URL:** <https://discuss.elastic.co/t/system-platformnotsupportedexception-performance-counters-are-not-supported-on-this-platform/363876>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [July 26, 2024, 3:53pm UTC](https://discuss.elastic.co/t/system-platformnotsupportedexception-performance-counters-are-not-supported-on-this-platform/363876 "2024-07-26T15:53:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinaykoul4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinaykoul4/32/130735_2.png) [@vinaykoul4](https://discuss.elastic.co/u/vinaykoul4)\
**Post date:** [July 26, 2024, 3:53pm UTC](https://discuss.elastic.co/t/system-platformnotsupportedexception-performance-counters-are-not-supported-on-this-platform/363876/1 "2024-07-26T15:53:07Z")

</div>

As per agent logs, we receive error **System.PlatformNotSupportedException: Performance Counters are not supported on this platform**  
due to which System metrics won't be collected. Can Someone help me with this, we are using public API for manual instrumentation of our Application (windows service)

Full logs -  
2024-07-26 14:19:34.6630|ERROR|glodsm02z02454|54928|73|{SystemTotalCpuProvider} Error instantiating 'Processor' performance counter|Axis.Streams.Common.General.Apm.ApmLoggerAdapter.Log|System.PlatformNotSupportedException: Performance Counters are not supported on this platform.  
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName)  
at Elastic.Apm.Metrics.MetricsProvider.SystemTotalCpuProvider.GetSamples()  
2024-07-26 14:19:34.6837|WARN|glodsm02z02454|54928|73|{SystemTotalCpuProvider} System metrics won't be collected|Axis.Streams.Common.General.Apm.ApmLoggerAdapter.Log|  
2024-07-26 14:19:34.6837|WARN|glodsm02z02454|54928|73|{MetricsCollector} Failed reading total system CPU time 1 times: no valid samples|Axis.Streams.Common.General.Apm.ApmLoggerAdapter.Log|  
.Net Core - 6  
Elastic.APM Package - 1.26  
Agent Version - 1.25

Thanks in Advance.

---

<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:** [July 31, 2024, 11:38am UTC](https://discuss.elastic.co/t/system-platformnotsupportedexception-performance-counters-are-not-supported-on-this-platform/363876/2 "2024-07-31T11:38:47Z")

</div>

Hi,

the error is very clear: `PerformanceCounter` is only supported on Windows - I guess you are on Linux?

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![vinaykoul4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinaykoul4/32/130735_2.png) [@vinaykoul4](https://discuss.elastic.co/u/vinaykoul4)\
**Post date:** [July 31, 2024, 6:14pm UTC](https://discuss.elastic.co/t/system-platformnotsupportedexception-performance-counters-are-not-supported-on-this-platform/363876/3 "2024-07-31T18:14:50Z")

</div>

@Wolfram_Haussig We have all windows servers on which applications are hosted. Not sure what are we missing here?
