Skip to content

feat: add gpu index for nvidia-smi input#1446

Open
LeeZBug wants to merge 1 commit into
flashcatcloud:mainfrom
LeeZBug:add-gpu-index
Open

feat: add gpu index for nvidia-smi input#1446
LeeZBug wants to merge 1 commit into
flashcatcloud:mainfrom
LeeZBug:add-gpu-index

Conversation

@LeeZBug
Copy link
Copy Markdown

@LeeZBug LeeZBug commented May 25, 2026

When scraping configuration with nvidia-smi, it was found that the GPU index was missing. This commit adds an index label to the metric labels.

@LeeZBug LeeZBug closed this May 25, 2026
@LeeZBug LeeZBug deleted the add-gpu-index branch May 25, 2026 11:09
@LeeZBug LeeZBug restored the add-gpu-index branch May 25, 2026 11:10
@LeeZBug LeeZBug reopened this May 25, 2026
@kongfei605 kongfei605 requested a review from Copilot May 26, 2026 01:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GPU index label to the nvidia_smi input’s emitted metrics so GPUs can be identified by both UUID and their nvidia-smi index.

Changes:

  • Adds index as a query field constant and includes it in the required query fields list.
  • Reads the GPU index from the scrape results and attaches it to gpu_info and per-field metric samples.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
inputs/nvidia_smi/types.go Adds indexQField to requiredFields so it’s included in scrapes.
inputs/nvidia_smi/fields.go Introduces the indexQField constant.
inputs/nvidia_smi/nvidia_smi.go Attaches index label to gpu_info and all parsed metric samples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 109 to +111
}

slist.PushFront(types.NewSample(inputName, metricInfo.metricName, num, map[string]string{"uuid": uuid}))
slist.PushFront(types.NewSample(inputName, metricInfo.metricName, num, map[string]string{"uuid": uuid, "index": index}))
Comment on lines 25 to 28
requiredFields = []qField{
uuidQField,
indexQField,
nameQField,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants