This commit is contained in:
bui 2021-04-30 11:10:07 +02:00
parent 1ad06404f2
commit 9dfc4bc06d
2 changed files with 12 additions and 8 deletions

View file

@ -65,6 +65,7 @@ cat mode will return once source has been exhausted.
type DataSource interface {
GetMetrics() []prometheus.Collector // Returns pointers to metrics that are managed by the module
Configure([]byte, *log.Entry) error // Configure the datasource
ConfigureByDSN(string, *log.Entry) error // Configure the datasource
GetMode() string // Get the mode (TAIL, CAT or SERVER)
SupportedModes() []string // Returns the mode supported by the datasource
SupportedDSN() []string // Returns the list of supported URI schemes (file:// s3:// ...)

View file

@ -42,6 +42,7 @@ func (f *MockSource) CanRun() error { re
func (f *MockSource) GetMetrics() []prometheus.Collector { return nil }
func (f *MockSource) Dump() interface{} { return f }
func (f *MockSource) SupportedDSN() []string { return []string{"mock://"} }
func (f *MockSource) ConfigureByDSN(string, *log.Entry) error { return fmt.Errorf("not supported") }
//func (f *MockSource) New() DataSource { return &MockSource{} }
@ -327,10 +328,11 @@ func (f *MockCat) OneShotAcquisition(out chan types.Event, tomb *tomb.Tomb) erro
func (f *MockCat) LiveAcquisition(chan types.Event, *tomb.Tomb) error {
return fmt.Errorf("can't run in tail")
}
func (f *MockCat) CanRun() error { return nil }
func (f *MockCat) GetMetrics() []prometheus.Collector { return nil }
func (f *MockCat) Dump() interface{} { return f }
func (f *MockCat) SupportedDSN() []string { return []string{"mock://"} }
func (f *MockCat) CanRun() error { return nil }
func (f *MockCat) GetMetrics() []prometheus.Collector { return nil }
func (f *MockCat) Dump() interface{} { return f }
func (f *MockCat) SupportedDSN() []string { return []string{"mock://"} }
func (f *MockCat) ConfigureByDSN(string, *log.Entry) error { return fmt.Errorf("not supported") }
//----
@ -360,10 +362,11 @@ func (f *MockTail) LiveAcquisition(out chan types.Event, t *tomb.Tomb) error {
return nil
}
}
func (f *MockTail) CanRun() error { return nil }
func (f *MockTail) GetMetrics() []prometheus.Collector { return nil }
func (f *MockTail) Dump() interface{} { return f }
func (f *MockTail) SupportedDSN() []string { return []string{"mock://"} }
func (f *MockTail) CanRun() error { return nil }
func (f *MockTail) GetMetrics() []prometheus.Collector { return nil }
func (f *MockTail) Dump() interface{} { return f }
func (f *MockTail) SupportedDSN() []string { return []string{"mock://"} }
func (f *MockTail) ConfigureByDSN(string, *log.Entry) error { return fmt.Errorf("not supported") }
//func StartAcquisition(sources []DataSource, output chan types.Event, AcquisTomb *tomb.Tomb) error {