mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-04 01:25:06 +01:00 
			
		
		
		
	omit metrics with empty series
This commit is contained in:
		@@ -326,7 +326,6 @@ func (pdb *PrometheusDataRepository) LoadData(
 | 
			
		||||
					Timestep: metricConfig.Timestep,
 | 
			
		||||
					Series:   make([]schema.Series, 0),
 | 
			
		||||
				}
 | 
			
		||||
				jobData[metric][scope] = jobMetric
 | 
			
		||||
			}
 | 
			
		||||
			step := int64(metricConfig.Timestep)
 | 
			
		||||
			steps := int64(to.Sub(from).Seconds()) / step
 | 
			
		||||
@@ -335,6 +334,10 @@ func (pdb *PrometheusDataRepository) LoadData(
 | 
			
		||||
				jobMetric.Series = append(jobMetric.Series,
 | 
			
		||||
					pdb.RowToSeries(from, step, steps, row))
 | 
			
		||||
			}
 | 
			
		||||
			// only add metric if at least one host returned data
 | 
			
		||||
			if !ok && len(jobMetric.Series) > 0{
 | 
			
		||||
				jobData[metric][scope] = jobMetric
 | 
			
		||||
			}
 | 
			
		||||
			// sort by hostname to get uniform coloring
 | 
			
		||||
			sort.Slice(jobMetric.Series, func(i, j int) bool {
 | 
			
		||||
				return (jobMetric.Series[i].Hostname < jobMetric.Series[j].Hostname)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user