Warning metricCollector (net5.0 Windows)

Good morning,

I have a service in .NetCore 5.0 and windows (IIS) and I'm using the package of elasticAllApm and now in production I have seen the next warning:

[Warning] {"MetricsCollector"} Failed reading "CgroupMetricsProvider" 2 times: no valid samples

This message is repeating and I would like know if is possible with any option indicates that I don't want collect metrics or if I need activate something more.

Thanks for the heeelp :slight_smile:

Hi @Kirtash ,

yes, you can disable cgroup metrics collection.

In order to do so, you just need to add the following string to the DisableMetrics setting: system.process.cgroup.*. You can do this configuration similarly to any other config (like ServerUrls...).

With this you'll get rid of the warning.

1 Like

I assume these are related to Linux cgroup?
I initially thought there was some sort of misconfiguration with APM.
(Got here via google)

Hi!

Nope, in my case was in windows with IIS.

Now I added this line and all works correctly and I don't have these messages

The metrics itself are related to Linux cgroup indeed, but the agent tries to query all metrics on all platforms - basically the warning just states that it's unable to get the values on Windows (no surprise...) and once the agent knows about, i'll stop querying it.

Btw. this makes me think that we could have a better logic here and for this specific metric we should skip querying it on Windows completely.

I opened a PR to improve this: https://github.com/elastic/apm-agent-dotnet/pull/1490 - with that the agent will check the OS and not try to read it on non Linux OSs.

If that makes it into a release then the disable metrics setting described above won't be needed anymore to solve this.

Thanks for all! I will follow the PR to update the nuget package version :wink: