prometheus-community / ecs_exporter

Prometheus exporter for Amazon Elastic Container Service (ECS)
Apache License 2.0
77 stars 19 forks source link

memory_stats.stats.cache not exposed as metric #24

Closed pawelmrowczynski closed 2 years ago

pawelmrowczynski commented 2 years ago

Hello,

We've tried to use this tool to export some metrics to our Prometheus. What we noticed immediately was that the Memory Usage data reported by our prometheus was completely different than the data reported by AWS Container Insights. We've investigated the issue and learned that the differences are caused by the way AWS calculates the usage of the memory inside of the container.

As you can see in the link below, AWS calculates the usage as the difference between usage and stats.cache (It was changed in 2016): https://github.com/aws/amazon-ecs-agent/commit/f2019aee016a1be1e340f06147be24367d6f96a6

Could we add this cache metric to the list of exposed metrics. I'd propose naming it as:

memCacheUsageDesc = prometheus.NewDesc(
        "ecs_memory_cache_usage",
        "Memory cache usage in bytes.",
        labels, nil)

With this users of esc_exporter would be able to decide how they want to present the data. We could do it in the same way AWS does (by substracting cache value), show both on a graf etc.

rakyll commented 2 years ago

Closed via https://github.com/prometheus-community/ecs_exporter/pull/26.