2021-03-26 16:48:09 +01:00
|
|
|
package sinks
|
|
|
|
|
|
|
|
import (
|
2024-07-13 02:23:58 +02:00
|
|
|
lp "github.com/ClusterCockpit/cc-energy-manager/pkg/cc-message"
|
2021-03-26 16:48:09 +01:00
|
|
|
)
|
|
|
|
|
2022-02-04 18:12:24 +01:00
|
|
|
type defaultSinkConfig struct {
|
2022-03-15 16:16:26 +01:00
|
|
|
MetaAsTags []string `json:"meta_as_tags,omitempty"`
|
|
|
|
Type string `json:"type"`
|
2021-05-18 15:16:10 +02:00
|
|
|
}
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type sink struct {
|
2022-03-15 16:16:26 +01:00
|
|
|
meta_as_tags map[string]bool // Use meta data tags as tags
|
|
|
|
name string // Name of the sink
|
2021-03-26 16:48:09 +01:00
|
|
|
}
|
|
|
|
|
2022-01-25 15:37:43 +01:00
|
|
|
type Sink interface {
|
2024-07-13 02:23:58 +02:00
|
|
|
Write(point lp.CCMessage) error // Write metric to the sink
|
2022-02-28 12:16:48 +01:00
|
|
|
Flush() error // Flush buffered metrics
|
|
|
|
Close() // Close / finish metric sink
|
|
|
|
Name() string // Name of the metric sink
|
2022-01-25 15:37:43 +01:00
|
|
|
}
|
|
|
|
|
2022-02-28 12:16:48 +01:00
|
|
|
// Name returns the name of the metric sink
|
2022-01-25 15:37:43 +01:00
|
|
|
func (s *sink) Name() string {
|
|
|
|
return s.name
|
2021-03-26 16:48:09 +01:00
|
|
|
}
|