2021-03-26 16:48:09 +01:00
|
|
|
package sinks
|
|
|
|
|
|
|
|
import (
|
2021-10-04 15:23:43 +02:00
|
|
|
// "time"
|
2022-01-25 15:37:43 +01:00
|
|
|
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
|
2021-03-26 16:48:09 +01:00
|
|
|
)
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type sinkConfig struct {
|
2021-05-18 15:16:10 +02:00
|
|
|
Type string `json:"type"`
|
2022-01-25 15:37:43 +01:00
|
|
|
Host string `json:"host,omitempty"`
|
|
|
|
Port string `json:"port,omitempty"`
|
|
|
|
Database string `json:"database,omitempty"`
|
|
|
|
User string `json:"user,omitempty"`
|
|
|
|
Password string `json:"password,omitempty"`
|
|
|
|
Organization string `json:"organization,omitempty"`
|
|
|
|
SSL bool `json:"ssl,omitempty"`
|
|
|
|
MetaAsTags bool `json:"meta_as_tags,omitempty"`
|
2021-05-18 15:16:10 +02:00
|
|
|
}
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type sink struct {
|
2021-05-18 15:16:10 +02:00
|
|
|
host string
|
|
|
|
port string
|
|
|
|
user string
|
|
|
|
password string
|
|
|
|
database string
|
|
|
|
organization string
|
2021-06-30 16:56:47 +02:00
|
|
|
ssl bool
|
2022-01-25 15:37:43 +01:00
|
|
|
meta_as_tags bool
|
|
|
|
name string
|
2021-03-26 16:48:09 +01:00
|
|
|
}
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type Sink interface {
|
|
|
|
Init(config sinkConfig) error
|
|
|
|
Write(point lp.CCMetric) error
|
2021-10-12 13:43:58 +02:00
|
|
|
Flush() error
|
2021-03-26 16:48:09 +01:00
|
|
|
Close()
|
2022-01-25 15:37:43 +01:00
|
|
|
Name() string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *sink) Name() string {
|
|
|
|
return s.name
|
2021-03-26 16:48:09 +01:00
|
|
|
}
|