mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-10-31 17:05:07 +01:00 
			
		
		
		
	Enable strings as field values in stdout sink
This commit is contained in:
		| @@ -27,8 +27,13 @@ func (s *StdoutSink) Write(measurement string, tags map[string]string, fields ma | |||||||
| 		tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", k, v)) | 		tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", k, v)) | ||||||
| 	} | 	} | ||||||
| 	for k, v := range fields { | 	for k, v := range fields { | ||||||
| 		if !math.IsNaN(v.(float64)) { | 	    switch v.(type) { | ||||||
| 			fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", k, v.(float64))) | 	    case float64: | ||||||
|  | 		    if !math.IsNaN(v.(float64)) { | ||||||
|  | 			    fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", k, v.(float64))) | ||||||
|  | 		    } | ||||||
|  | 		case string: | ||||||
|  | 		    fieldstr = append(fieldstr, fmt.Sprintf("%s=%q", k, v.(string))) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if len(tagsstr) > 0 { | 	if len(tagsstr) > 0 { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user