Skip to content

Commit

Permalink
More logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpeshansky committed Jul 26, 2024
1 parent 7e089fd commit 15dbcc9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions receiver/dcgmreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,21 @@ func (s *dcgmScraper) scrape(_ context.Context) (pmetric.Metrics, error) {
return s.mb.Emit(), err
}

s.settings.Logger.Sugar().Info(fmt.Sprintf("Client created: %v; collecting metrics", s.client))
deviceMetrics, err := s.client.collectDeviceMetrics()
if err != nil {
s.settings.Logger.Sugar().Warn(fmt.Sprintf("Metrics not collected; err=%v", err))
return s.mb.Emit(), err
}

now := pcommon.NewTimestampFromTime(time.Now())
s.settings.Logger.Sugar().Info(fmt.Sprintf("Metrics collected: %d", len(deviceMetrics)))
for gpuIndex, gpuMetrics := range deviceMetrics {
metricsByName := make(map[string][]dcgmMetric)
for _, metric := range gpuMetrics {
metricsByName[metric.name] = append(metricsByName[metric.name], metric)
}
s.settings.Logger.Sugar().Warn(fmt.Sprintf("Got %d unique metrics: %v", len(metricsByName), metricsByName))
metrics := make(map[string]dcgmMetric)
for name, points := range metricsByName {
slices.SortStableFunc(points, func(a, b dcgmMetric) int {
Expand Down

0 comments on commit 15dbcc9

Please sign in to comment.