Additional comments

This commit is contained in:
Holger Obermaier
2022-02-28 12:16:48 +01:00
parent 2c08e53be4
commit 33fec95eac
5 changed files with 46 additions and 22 deletions

View File

@@ -10,17 +10,18 @@ type defaultSinkConfig struct {
}
type sink struct {
meta_as_tags bool
name string
meta_as_tags bool // Use meta data tags as tags
name string // Name of the sink
}
type Sink interface {
Write(point lp.CCMetric) error
Flush() error
Close()
Name() string
Write(point lp.CCMetric) error // Write metric to the sink
Flush() error // Flush buffered metrics
Close() // Close / finish metric sink
Name() string // Name of the metric sink
}
// Name returns the name of the metric sink
func (s *sink) Name() string {
return s.name
}

View File

@@ -46,6 +46,9 @@ func (s *SampleSink) Close() {
// Initialize the sink by giving it a name and reading in the config JSON
func NewSampleSink(name string, config json.RawMessage) (Sink, error) {
s := new(SampleSink)
// Set name of sampleSink
// The name should be chosen in such a way that different instances of SampleSink can be distinguished
s.name = fmt.Sprintf("SampleSink(%s)", name) // Always specify a name here
// Set defaults in s.config