mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 07:29:04 +01:00
Format Receivers
This commit is contained in:
parent
7106e465ad
commit
f3697b9991
@ -14,7 +14,7 @@ type ReceiverConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Receiver struct {
|
type Receiver struct {
|
||||||
name string
|
name string
|
||||||
addr string
|
addr string
|
||||||
port string
|
port string
|
||||||
database string
|
database string
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package receivers
|
package receivers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
s "github.com/ClusterCockpit/cc-metric-collector/sinks"
|
s "github.com/ClusterCockpit/cc-metric-collector/sinks"
|
||||||
protocol "github.com/influxdata/line-protocol"
|
protocol "github.com/influxdata/line-protocol"
|
||||||
nats "github.com/nats-io/nats.go"
|
nats "github.com/nats-io/nats.go"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type NatsReceiver struct {
|
type NatsReceiver struct {
|
||||||
@ -19,7 +19,7 @@ var DefaultTime = func() time.Time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *NatsReceiver) Init(config ReceiverConfig, sink s.SinkFuncs) error {
|
func (r *NatsReceiver) Init(config ReceiverConfig, sink s.SinkFuncs) error {
|
||||||
if len(config.Addr) == 0 ||
|
if len(config.Addr) == 0 ||
|
||||||
len(config.Port) == 0 ||
|
len(config.Port) == 0 ||
|
||||||
len(config.Database) == 0 {
|
len(config.Database) == 0 {
|
||||||
return errors.New("Not all configuration variables set required by NatsReceiver")
|
return errors.New("Not all configuration variables set required by NatsReceiver")
|
||||||
|
Loading…
Reference in New Issue
Block a user