fix: correct Prometheus type for NVLink bandwidth fields from counter to gauge#658
Open
allenz92 wants to merge 1 commit into
Open
fix: correct Prometheus type for NVLink bandwidth fields from counter to gauge#658allenz92 wants to merge 1 commit into
allenz92 wants to merge 1 commit into
Conversation
… to gauge
DCGM field 449 (DCGM_FI_DEV_NVLINK_BANDWIDTH_TOTAL) is declared as
`counter` but DCGM internally computes an instantaneous throughput rate
(MiB/s) via ReadAndCacheNvLinkBandwidth() in DcgmCacheManager.cpp:
double valueDbl = (currentKiB - prevKiB) / timeDiffSec / 1000.0;
The NVML source fields (NVML_FI_DEV_NVLINK_THROUGHPUT_DATA_RX/TX, field
IDs 138/139) are documented as cumulative KiB in nvml.h. DCGM converts
them to an instantaneous MiB/s rate, so the exported value fluctuates
with GPU load and can decrease between samples.
This makes the metric a gauge by definition (Prometheus docs: "A gauge
is a metric that represents a single numerical value that can arbitrarily
go up and down"). Marking it as counter causes dashboards that apply
rate() or increase() to produce near-zero or meaningless results.
Also corrects the help text to accurately describe the value as
throughput rate rather than "number of counters".
Fixes NVIDIA#417
Signed-off-by: Allen Zhou <loveinjavac@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Prometheus metric type for
DCGM_FI_DEV_NVLINK_BANDWIDTH_TOTAL(and its commented-out per-lane variant
DCGM_FI_DEV_NVLINK_BANDWIDTH_L0)from
countertogauge.Fixes #417
Root Cause
DCGM field 449 (
DCGM_FI_DEV_NVLINK_BANDWIDTH_TOTAL) is an alias forDCGM_FI_DEV_NVLINK_THROUGHPUT_TOTAL. Internally, DCGM reads the rawNVML cumulative KiB counters (
NVML_FI_DEV_NVLINK_THROUGHPUT_DATA_RXand
NVML_FI_DEV_NVLINK_THROUGHPUT_DATA_TX, field IDs 138/139, unitdocumented as KiB in
nvml.h) and converts them to an instantaneousthroughput rate in
ReadAndCacheNvLinkBandwidth()(
dcgmlib/src/DcgmCacheManager.cpp):The published value is therefore an instantaneous MiB/s rate that
fluctuates with NVLink activity. It is a gauge, not a counter.
Impact
Users whose Grafana dashboards apply rate() or increase() to this
metric (which is the correct treatment for a counter) get near-zero or
meaningless results. The actual NVLink throughput is hidden.
Changes
(MiB/s, TX+RX combined) rather than "number of NVLink bandwidth counters"