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

Darwin diskstats reports operation counts divided by block size as sectors

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

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

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

評価

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

調査の方向性

collector/diskstats_darwin.go の issue でリンクされている2つの式から始め、このファイルにある既存のバイトカウンターのエクスポートと比較してください。issue では、Darwin のセクターメトリクスファミリーを両方削除し、利用側をバイトカウンターに誘導することを提案しています。これらのファミリーに関するプロジェクトのメトリクステストまたは参照を確認してください。誤ったセクターカウンターが削除され、影響を受けるチェックが通れば完了です。利用側は単位の変更を考慮する必要があります。

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

説明

The Darwin collector exports node_disk_read_sectors_total and node_disk_written_sectors_total using these expressions in v1.12.1, still present on master at 638ec72c:

float64(stat.NumRead) / float64(stat.BlockSize)
float64(stat.NumWrite) / float64(stat.BlockSize)

iostat.DriveStats defines NumRead and NumWrite as operation counts and BlockSize as bytes. Its Darwin bridge maps these separately from BytesRead and BytesWritten; the IOKit reader reads operation counts, byte counts, and preferred block size from their respective keys. The exported values therefore have units of operations divided by bytes, rather than sectors. The same collector already exports node_disk_read_bytes_total from BytesRead and node_disk_written_bytes_total from BytesWritten (source).

Reproduce the current arithmetic with Python 3:

cases = [("read", 3, 16384, 4096), ("write", 1000, 8192000, 4096)]
for name, operations, byte_count, block_size in cases:
    print(f"{name}: actual={operations / block_size:.12g}, sectors_if_512_bytes={byte_count / 512:g}")
read: actual=0.000732421875, sectors_if_512_bytes=32
write: actual=0.244140625, sectors_if_512_bytes=16000

The 512-byte sector value is a comparison convention, not a macOS API contract. Validation: arithmetic reproduction only; native macOS collector tests were not run.

I propose removing the two Darwin sector families and directing consumers to the existing byte counters, following Linux PR #787. Queries, rules, and panels must change their units and thresholds because the byte counters are not numeric replacements for the sector values.

主要言語
Go
スター
13.9k
フォーク
2.7k
平均マージ
2日 10時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

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

prometheus/node_exporter のほかの issue

prometheus/node_exporter の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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