mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Collectors in parallel (#74)
* Provide info to CollectorManager whether the collector can be executed in parallel with others * Split serial and parallel collectors. Read in parallel first
This commit is contained in:
		@@ -13,17 +13,19 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type MetricCollector interface {
 | 
			
		||||
	Name() string                                         // Name of the metric collector
 | 
			
		||||
	Init(config json.RawMessage) error                    // Initialize metric collector
 | 
			
		||||
	Initialized() bool                                    // Is metric collector initialized?
 | 
			
		||||
	Name() string                      // Name of the metric collector
 | 
			
		||||
	Init(config json.RawMessage) error // Initialize metric collector
 | 
			
		||||
	Initialized() bool                 // Is metric collector initialized?
 | 
			
		||||
	Parallel() bool
 | 
			
		||||
	Read(duration time.Duration, output chan lp.CCMetric) // Read metrics from metric collector
 | 
			
		||||
	Close()                                               // Close / finish metric collector
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type metricCollector struct {
 | 
			
		||||
	name string            // name of the metric
 | 
			
		||||
	init bool              // is metric collector initialized?
 | 
			
		||||
	meta map[string]string // static meta data tags
 | 
			
		||||
	name     string            // name of the metric
 | 
			
		||||
	init     bool              // is metric collector initialized?
 | 
			
		||||
	parallel bool              // can the metric collector be executed in parallel with others
 | 
			
		||||
	meta     map[string]string // static meta data tags
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the name of the metric collector
 | 
			
		||||
@@ -31,6 +33,11 @@ func (c *metricCollector) Name() string {
 | 
			
		||||
	return c.name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Name returns the name of the metric collector
 | 
			
		||||
func (c *metricCollector) Parallel() bool {
 | 
			
		||||
	return c.parallel
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Setup is for future use
 | 
			
		||||
func (c *metricCollector) setup() error {
 | 
			
		||||
	return nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user