mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Add documentation
This commit is contained in:
parent
9bd8a3a90b
commit
3d073080f8
@ -30,7 +30,7 @@ type metricRouterConfig struct {
|
|||||||
type metricRouter struct {
|
type metricRouter struct {
|
||||||
inputs []chan lp.CCMetric // List of all input channels
|
inputs []chan lp.CCMetric // List of all input channels
|
||||||
outputs []chan lp.CCMetric // List of all output channels
|
outputs []chan lp.CCMetric // List of all output channels
|
||||||
done chan bool // channel to finish stop metric router
|
done chan bool // channel to finish / stop metric router
|
||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
timestamp time.Time // timestamp
|
timestamp time.Time // timestamp
|
||||||
ticker mct.MultiChanTicker
|
ticker mct.MultiChanTicker
|
||||||
@ -200,19 +200,23 @@ func (r *metricRouter) Start() {
|
|||||||
cclog.ComponentDebug("MetricRouter", "STARTED")
|
cclog.ComponentDebug("MetricRouter", "STARTED")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddInput adds a input channel to the metric router
|
||||||
func (r *metricRouter) AddInput(input chan lp.CCMetric) {
|
func (r *metricRouter) AddInput(input chan lp.CCMetric) {
|
||||||
r.inputs = append(r.inputs, input)
|
r.inputs = append(r.inputs, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddOutput adds a output channel to the metric router
|
||||||
func (r *metricRouter) AddOutput(output chan lp.CCMetric) {
|
func (r *metricRouter) AddOutput(output chan lp.CCMetric) {
|
||||||
r.outputs = append(r.outputs, output)
|
r.outputs = append(r.outputs, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close finishes / stops the metric router
|
||||||
func (r *metricRouter) Close() {
|
func (r *metricRouter) Close() {
|
||||||
r.done <- true
|
r.done <- true
|
||||||
cclog.ComponentDebug("MetricRouter", "CLOSE")
|
cclog.ComponentDebug("MetricRouter", "CLOSE")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New creates a new initialized metric router
|
||||||
func New(ticker mct.MultiChanTicker, wg *sync.WaitGroup, routerConfigFile string) (MetricRouter, error) {
|
func New(ticker mct.MultiChanTicker, wg *sync.WaitGroup, routerConfigFile string) (MetricRouter, error) {
|
||||||
r := new(metricRouter)
|
r := new(metricRouter)
|
||||||
err := r.Init(ticker, wg, routerConfigFile)
|
err := r.Init(ticker, wg, routerConfigFile)
|
||||||
|
Loading…
Reference in New Issue
Block a user