-
Notifications
You must be signed in to change notification settings - Fork 14
feat: enrich OTLP telemetry identity #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
acf5fc6
feat: enrich OTLP telemetry identity
jingxiang-z 21add81
fix: limit identity enrichment to metrics
jingxiang-z cab4214
feat: export NVLink domain inventory
jingxiang-z 039ac47
fix: satisfy uptime staticcheck
jingxiang-z 7250bfe
feat: enrich inventory info metrics
jingxiang-z File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package collector | ||
|
|
||
| import ( | ||
| "strconv" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/NVIDIA/fleet-intelligence-agent/internal/machineinfo" | ||
| ) | ||
|
|
||
| // GPUIdentity contains stable, non-workload identity for one physical GPU. | ||
| type GPUIdentity struct { | ||
| UUID string | ||
| GPU string | ||
| PCIBusID string | ||
| Device string | ||
| ModelName string | ||
| Architecture string | ||
| GPUSerial string | ||
| VBIOSVersion string | ||
| ClusterUUID string | ||
| CliqueID string | ||
| } | ||
|
|
||
| // EntityCatalog is an immutable identity snapshot shared by metric and log conversion. | ||
| // MIG identities are intentionally outside this catalog. | ||
| type EntityCatalog struct { | ||
| Hostname string | ||
| GPUDriverVersion string | ||
| CUDADriverVersion string | ||
| KernelVersion string | ||
| BootTime time.Time | ||
| GPUsByUUID map[string]GPUIdentity | ||
| GPUUUIDByIndex map[string]string | ||
| } | ||
|
|
||
| // NewEntityCatalog builds a physical-entity identity snapshot from cached inventory. | ||
| func NewEntityCatalog(info *machineinfo.MachineInfo, dcgmGPUIndexes map[string]string) *EntityCatalog { | ||
| catalog := &EntityCatalog{ | ||
| GPUsByUUID: make(map[string]GPUIdentity), | ||
| GPUUUIDByIndex: make(map[string]string), | ||
| } | ||
|
|
||
| for uuid, gpu := range dcgmGPUIndexes { | ||
| uuid = strings.TrimSpace(uuid) | ||
| gpu = strings.TrimSpace(gpu) | ||
| if uuid == "" { | ||
| continue | ||
| } | ||
| identity := GPUIdentity{UUID: uuid, GPU: gpu} | ||
| catalog.GPUsByUUID[uuid] = identity | ||
| if gpu != "" { | ||
| catalog.GPUUUIDByIndex[gpu] = uuid | ||
| } | ||
| } | ||
|
|
||
| if info == nil { | ||
| return catalog | ||
| } | ||
| catalog.Hostname = strings.TrimSpace(info.Hostname) | ||
| catalog.GPUDriverVersion = strings.TrimSpace(info.GPUDriverVersion) | ||
| catalog.CUDADriverVersion = strings.TrimSpace(info.CUDAVersion) | ||
| catalog.KernelVersion = strings.TrimSpace(info.KernelVersion) | ||
| if !info.Uptime.IsZero() { | ||
| catalog.BootTime = info.Uptime.UTC() | ||
| } | ||
| if info.GPUInfo == nil { | ||
| return catalog | ||
| } | ||
|
|
||
| defaultModelName := strings.TrimSpace(info.GPUInfo.Product) | ||
| defaultArchitecture := strings.TrimSpace(info.GPUInfo.Architecture) | ||
| for _, gpuInfo := range info.GPUInfo.GPUs { | ||
| uuid := strings.TrimSpace(gpuInfo.UUID) | ||
| if uuid == "" { | ||
| continue | ||
| } | ||
|
|
||
| identity := catalog.GPUsByUUID[uuid] | ||
| identity.UUID = uuid | ||
| if identity.GPU == "" { | ||
| identity.GPU = strings.TrimSpace(gpuInfo.GPUIndex) | ||
| } | ||
| identity.PCIBusID = strings.TrimSpace(gpuInfo.BusID) | ||
| identity.Architecture = defaultArchitecture | ||
| identity.GPUSerial = strings.TrimSpace(gpuInfo.SN) | ||
| identity.VBIOSVersion = strings.TrimSpace(gpuInfo.VBIOSVersion) | ||
| identity.ModelName = strings.TrimSpace(gpuInfo.ModelName) | ||
| if identity.ModelName == "" { | ||
| identity.ModelName = defaultModelName | ||
| } | ||
| identity.ClusterUUID = strings.TrimSpace(gpuInfo.ClusterUUID) | ||
| if gpuInfo.CliqueID != nil { | ||
| identity.CliqueID = strconv.FormatUint(uint64(*gpuInfo.CliqueID), 10) | ||
| } | ||
|
|
||
| minorID := strings.TrimSpace(gpuInfo.MinorID) | ||
| if minor, err := strconv.Atoi(minorID); err == nil && minor >= 0 { | ||
| identity.Device = "nvidia" + strconv.Itoa(minor) | ||
| } | ||
|
|
||
| catalog.GPUsByUUID[uuid] = identity | ||
| if identity.GPU != "" { | ||
| catalog.GPUUUIDByIndex[identity.GPU] = uuid | ||
| } | ||
| } | ||
|
|
||
| return catalog | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package collector | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| apiv1 "github.com/NVIDIA/fleet-intelligence-sdk/api/v1" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| "github.com/NVIDIA/fleet-intelligence-agent/internal/machineinfo" | ||
| ) | ||
|
|
||
| func TestNewEntityCatalog(t *testing.T) { | ||
| cliqueID := uint32(0) | ||
| bootTime := time.Date(2026, 8, 4, 12, 0, 0, 0, time.UTC) | ||
| info := &machineinfo.MachineInfo{ | ||
| Hostname: "gpu-node-01", | ||
| GPUDriverVersion: "575.57.08", | ||
| CUDAVersion: "12.9", | ||
| KernelVersion: "6.14.0-27-generic", | ||
| Uptime: metav1.NewTime(bootTime), | ||
| GPUInfo: &apiv1.MachineGPUInfo{ | ||
| Product: "fallback-model", | ||
| Architecture: "hopper", | ||
| GPUs: []apiv1.MachineGPUInstance{ | ||
| { | ||
| UUID: "GPU-abc", | ||
| GPUIndex: "7", | ||
| BusID: "0000:01:00.0", | ||
| MinorID: "2", | ||
| ModelName: "NVIDIA H100", | ||
| SN: "GPU-SERIAL-123", | ||
| VBIOSVersion: "97.00.82.00.5F", | ||
| ClusterUUID: "11111111-2222-3333-4444-555555555555", | ||
| CliqueID: &cliqueID, | ||
| }, | ||
| { | ||
| UUID: "GPU-def", | ||
| GPUIndex: "8", | ||
| MinorID: "-1", | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| catalog := NewEntityCatalog(info, map[string]string{"GPU-abc": "0"}) | ||
| require.NotNil(t, catalog) | ||
| assert.Equal(t, "gpu-node-01", catalog.Hostname) | ||
| assert.Equal(t, "575.57.08", catalog.GPUDriverVersion) | ||
| assert.Equal(t, "12.9", catalog.CUDADriverVersion) | ||
| assert.Equal(t, "6.14.0-27-generic", catalog.KernelVersion) | ||
| assert.Equal(t, bootTime, catalog.BootTime) | ||
| assert.Equal(t, GPUIdentity{ | ||
| UUID: "GPU-abc", | ||
| GPU: "0", | ||
| PCIBusID: "0000:01:00.0", | ||
| Device: "nvidia2", | ||
| ModelName: "NVIDIA H100", | ||
| Architecture: "hopper", | ||
| GPUSerial: "GPU-SERIAL-123", | ||
| VBIOSVersion: "97.00.82.00.5F", | ||
| ClusterUUID: "11111111-2222-3333-4444-555555555555", | ||
| CliqueID: "0", | ||
| }, catalog.GPUsByUUID["GPU-abc"]) | ||
| assert.Equal(t, "fallback-model", catalog.GPUsByUUID["GPU-def"].ModelName) | ||
| assert.Equal(t, "hopper", catalog.GPUsByUUID["GPU-def"].Architecture) | ||
| assert.Empty(t, catalog.GPUsByUUID["GPU-def"].GPUSerial) | ||
| assert.Empty(t, catalog.GPUsByUUID["GPU-def"].Device) | ||
| assert.Equal(t, "GPU-abc", catalog.GPUUUIDByIndex["0"]) | ||
| assert.Equal(t, "GPU-def", catalog.GPUUUIDByIndex["8"]) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.