.NET Core Agent, Google Cloud Run

APM Agent language and version:
.NET Core 1.10

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
Nuget Package Manager

Fresh install or upgraded from other version?
Fresh Install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

Description of the problem including expected versus actual behavior:
Logs are not sent to Elastic when the container is running in a Google Cloud Run revision. When running the app locally, or building and running the container locally, everything shows in APM dashboard as expected. However, as soon as it's deployed in Cloud Run revision, we see failures and timeouts in the logs.

Provide logs and/or server output (if relevant):
System.IO.FileNotFoundException: Could not find file '/sys/fs/cgroup/memory/memory.usage_in_bytes'.
{MetricsCollector} Failed reading total system CPU time 1 times: no valid samples
System.IO.FileNotFoundException: Could not find file '/sys/fs/cgroup/memory/memory.stat'.
{PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server (https://OUR ELASTIC CLOUD.apm.us-west1.gcp.cloud.es.io/):
System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.

Hi @therealkris,

It looks like there is an issue in collecting cgroup metrics. Collecting of cgroup metrics can be disabled for the moment with DisableMetrics configuration e.g. in appsetttings.json

  "ElasticApm": {
    "DisableMetrics": "system.process.cgroup.*"

It looks like a bug that the FileNotFoundException is not handled. Would you mind opening an issue on the agent repository?