Use receiver names from config (#34)

* Use common configuration format of 'receiver_name' -> 'receiver_config'

* Adjust receiver configuration files
This commit is contained in:
Thomas Gruber
2022-02-21 12:45:08 +01:00
committed by GitHub
parent 435528fa97
commit ea5b3bdbd6
5 changed files with 52 additions and 46 deletions

View File

@@ -2,9 +2,15 @@ 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"`
@@ -14,16 +20,13 @@ type ReceiverConfig struct {
}
type receiver struct {
name string
addr string
port string
database string
organization string
sink chan lp.CCMetric
typename string
name string
sink chan lp.CCMetric
}
type Receiver interface {
Init(config ReceiverConfig) error
Init(name string, config json.RawMessage) error
Start()
Close()
Name() string