Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

node-mixin: Adjust `memory used` Dashboard to use `MemAvailable`

オープン 初心者向け
#3,830 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
linux, prometheus
領域
observability

調査の方向性

この issue は、特定のファイル docs/node-mixin/lib/prom-mixin.libsonnet の 126-137 行目と、ルールファイル docs/node-mixin/rules/rules.libsonnet を指しています。まず、現在のメモリ使用量ダッシュボードの計算式と、すでに MemAvailable を使用している既存のメモリ使用率ルールを調べてください。タスクは、ダッシュボードの計算式を更新して、互換性のために古い計算にフォールバックする MemAvailable を使用することです。JSONnet ミキシンの構造を確認し、Prometheus クエリがどのように構築されているかを理解することで、変更を検証してください。

索引モデルが issue の本文から書いたものです。

説明

Currently, the memory used dashboard in the node-mixin for Linux uses the formula

\text{memory used} = \text{MemTotal} - \text{MemFree} - \text{Buffers} - \text{Cached}

https://github.com/prometheus/node_exporter/blob/125a02099cde708ee9c99fddcc29a2703e92c576/docs/node-mixin/lib/prom-mixin.libsonnet#L126-L137

The Linux kernel introduced MemAvailable specifically because the formula above is a less accurate estimation of usable memory. As a result, a more accurate number for memory usage would be

\text{memory used} = \text{MemTotal} - \text{MemAvailable}

We encouraged gopsutil to adopt the same formula to calculate usage and psutil adopted it at coincidentally the same time (but independent of our gopsutil suggestion).

I see that the memory utilization dashboard already accounts for this: https://github.com/prometheus/node_exporter/blob/125a02099cde708ee9c99fddcc29a2703e92c576/docs/node-mixin/rules/rules.libsonnet#L43-L58

Should the memory used dashboard do the same thing? I assume if it did something like this:

  node_memory_MemTotal_bytes{%(nodeExporterSelector)s} - (
    node_memory_MemAvailable_bytes{%(nodeExporterSelector)s}
    or
    (
      node_memory_Buffers_bytes{%(nodeExporterSelector)s}
      +
      node_memory_Cached_bytes{%(nodeExporterSelector)s}
      +
      node_memory_MemFree_bytes{%(nodeExporterSelector)s}
    )
  )

That would make it so users on Linux environments that don't provide MemAvailable wouldn't be broken, but the rest could get a more accurate value that is similar to the calculation already being done in the utilization dashboard.

P.S. The way free used to calculated this in the past also included SReclaimable as part of the calculation alongside Cached, Buffers, and MemFree, and gopsutil used to do the same thing. I'm unsure whether it's worth it at this point to mess with the existing approximation formula in the dashboard, but I figured I would bring it up.

主要言語
Go
スター
13.8k
フォーク
2.7k
平均マージ
1日 4時間
マージ済み PR(30日)
7

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prometheus/node_exporter のほかの issue

prometheus/node_exporter の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。