cc-metric-collector/receivers/metricReceiver.go
Thomas Gruber ea5b3bdbd6
Use receiver names from config (#34)
* Use common configuration format of 'receiver_name' -> 'receiver_config'

* Adjust receiver configuration files
2022-02-21 12:45:08 +01:00

43 lines
780 B
Go

package receivers
import (
// "time"
"encoding/json"
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
)
type defaultReceiverConfig struct {
Type string `json:"type"`
}
type ReceiverConfig struct {
Addr string `json:"address"`
Port string `json:"port"`
Database string `json:"database"`
Organization string `json:"organization,omitempty"`
Type string `json:"type"`
}
type receiver struct {
typename string
name string
sink chan lp.CCMetric
}
type Receiver interface {
Init(name string, config json.RawMessage) error
Start()
Close()
Name() string
SetSink(sink chan lp.CCMetric)
}
func (r *receiver) Name() string {
return r.name
}
func (r *receiver) SetSink(sink chan lp.CCMetric) {
r.sink = sink
}