2021-05-18 15:15:26 +02:00
|
|
|
package receivers
|
|
|
|
|
|
|
|
import (
|
2022-10-10 11:53:11 +02:00
|
|
|
lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric"
|
2021-05-18 15:15:26 +02:00
|
|
|
)
|
|
|
|
|
2022-02-21 12:45:08 +01:00
|
|
|
type defaultReceiverConfig struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
}
|
|
|
|
|
2022-02-28 12:16:48 +01:00
|
|
|
// Receiver configuration: Listen address, port
|
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 {
|
2021-05-18 15:15:26 +02:00
|
|
|
Start()
|
2022-02-28 12:16:48 +01:00
|
|
|
Close() // Close / finish metric receiver
|
|
|
|
Name() string // Name of the metric receiver
|
|
|
|
SetSink(sink chan lp.CCMetric) // Set sink channel
|
2022-01-25 15:37:43 +01:00
|
|
|
}
|
|
|
|
|
2022-02-28 12:16:48 +01:00
|
|
|
// Name returns the name of the metric receiver
|
2022-01-25 15:37:43 +01:00
|
|
|
func (r *receiver) Name() string {
|
|
|
|
return r.name
|
|
|
|
}
|
|
|
|
|
2022-02-28 12:16:48 +01:00
|
|
|
// SetSink set the sink channel
|
2022-01-25 15:37:43 +01:00
|
|
|
func (r *receiver) SetSink(sink chan lp.CCMetric) {
|
|
|
|
r.sink = sink
|
2021-05-18 15:15:26 +02:00
|
|
|
}
|