Skip to content

Commit

Permalink
Oops, temperature and clock frequency are int64.
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpeshansky committed Jul 26, 2024
1 parent 479e123 commit 7e089fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions receiver/dcgmreceiver/client_gpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ func TestCollectGpuProfilingMetrics(t *testing.T) {
assert.LessOrEqual(t, value, int64(100000000))
case "DCGM_FI_DEV_GPU_TEMP":
// arbitrary max of 100000 °C
value := asFloat64(metric)
assert.GreaterOrEqual(t, value, float64(0.0))
assert.LessOrEqual(t, value, float64(100000.0))
value := asInt64(metric)
assert.GreaterOrEqual(t, value, int64(0))
assert.LessOrEqual(t, value, int64(100000))
case "DCGM_FI_DEV_SM_CLOCK":
// arbitrary max of 100000 MHz
value := asFloat64(metric)
assert.GreaterOrEqual(t, value, float64(0.0))
assert.LessOrEqual(t, value, float64(100000.0))
value := asInt64(metric)
assert.GreaterOrEqual(t, value, int64(0))
assert.LessOrEqual(t, value, int64(100000))
case "DCGM_FI_DEV_TOTAL_ENERGY_CONSUMPTION":
// TODO
case "DCGM_FI_DEV_POWER_USAGE":
Expand Down
4 changes: 2 additions & 2 deletions receiver/dcgmreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ func (s *dcgmScraper) scrape(_ context.Context) (pmetric.Metrics, error) {
s.mb.RecordGpuDcgmEnergyConsumptionDataPoint(now, s.aggregates.energyConsumptionFallback)
}
if metric, ok := metrics["DCGM_FI_DEV_GPU_TEMP"]; ok {
s.mb.RecordGpuDcgmTemperatureDataPoint(now, metric.asFloat64())
s.mb.RecordGpuDcgmTemperatureDataPoint(now, float64(metric.asInt64()))
}
if metric, ok := metrics["DCGM_FI_DEV_SM_CLOCK"]; ok {
clockFreq := 1e6 * metric.asFloat64() /* MHz to Hz */
clockFreq := 1e6 * float64(metric.asInt64()) /* MHz to Hz */
s.mb.RecordGpuDcgmClockFrequencyDataPoint(now, clockFreq)
}
if metric, ok := metrics["DCGM_FI_DEV_POWER_VIOLATION"]; ok {
Expand Down

0 comments on commit 7e089fd

Please sign in to comment.