mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-08-11 13:33:00 +02:00
Use new sink instances to allow multiple of same sink type
This commit is contained in:
@@ -68,8 +68,8 @@ func (s *InfluxAsyncSink) connect() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *InfluxAsyncSink) Init(config json.RawMessage) error {
|
||||
s.name = "InfluxSink"
|
||||
func (s *InfluxAsyncSink) Init(name string, config json.RawMessage) error {
|
||||
s.name = fmt.Sprintf("InfluxSink(%s)", name)
|
||||
|
||||
// Set default for maximum number of points sent to server in single request.
|
||||
s.config.BatchSize = 100
|
||||
@@ -118,3 +118,9 @@ func (s *InfluxAsyncSink) Close() {
|
||||
s.writeApi.Flush()
|
||||
s.client.Close()
|
||||
}
|
||||
|
||||
func NewInfluxAsyncSink(name string, config json.RawMessage) (Sink, error) {
|
||||
s := new(InfluxAsyncSink)
|
||||
s.Init(name, config)
|
||||
return s, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user