mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-08-22 18:33:00 +02:00
Use new sink instances to allow multiple of same sink type
This commit is contained in:
@@ -38,9 +38,9 @@ type HttpSink struct {
|
||||
flushDelay time.Duration
|
||||
}
|
||||
|
||||
func (s *HttpSink) Init(config json.RawMessage) error {
|
||||
func (s *HttpSink) Init(name string, config json.RawMessage) error {
|
||||
// Set default values
|
||||
s.name = "HttpSink"
|
||||
s.name = fmt.Sprintf("HttpSink(%s)", name)
|
||||
s.config.MaxIdleConns = 10
|
||||
s.config.IdleConnTimeout = "5s"
|
||||
s.config.Timeout = "5s"
|
||||
@@ -169,3 +169,9 @@ func (s *HttpSink) Close() {
|
||||
}
|
||||
s.client.CloseIdleConnections()
|
||||
}
|
||||
|
||||
func NewHttpSink(name string, config json.RawMessage) (Sink, error) {
|
||||
s := new(HttpSink)
|
||||
s.Init(name, config)
|
||||
return s, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user