2021-05-18 15:15:26 +02:00
|
|
|
package receivers
|
|
|
|
|
|
|
|
import (
|
|
|
|
// "time"
|
2022-02-21 12:45:08 +01:00
|
|
|
"encoding/json"
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
2021-05-18 15:15:26 +02:00
|
|
|
)
|
|
|
|
|
2022-02-21 12:45:08 +01:00
|
|
|
type defaultReceiverConfig struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
}
|
|
|
|
|
2021-05-18 15:15:26 +02:00
|
|
|
type ReceiverConfig struct {
|
2022-01-25 15:37:43 +01:00
|
|
|
Addr string `json:"address"`
|
|
|
|
Port string `json:"port"`
|
|
|
|
Database string `json:"database"`
|
|
|
|
Organization string `json:"organization,omitempty"`
|
|
|
|
Type string `json:"type"`
|
2021-05-18 15:15:26 +02:00
|
|
|
}
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type receiver struct {
|
2022-02-22 16:33:38 +01:00
|
|
|
name string
|
|
|
|
sink chan lp.CCMetric
|
2021-05-18 15:15:26 +02:00
|
|
|
}
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type Receiver interface {
|
2022-02-21 12:45:08 +01:00
|
|
|
Init(name string, config json.RawMessage) error
|
2021-05-18 15:15:26 +02:00
|
|
|
Start()
|
|
|
|
Close()
|
2022-01-25 15:37:43 +01:00
|
|
|
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
|
2021-05-18 15:15:26 +02:00
|
|
|
}
|