Go app framework
This commit is contained in:
38
pkg/otel/settings.go
Normal file
38
pkg/otel/settings.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package otel
|
||||
|
||||
import "time"
|
||||
|
||||
type settings struct {
|
||||
EnableStdoutExporter bool
|
||||
EnablePrometheusExporter bool
|
||||
MetricExportInterval time.Duration
|
||||
}
|
||||
|
||||
type Option interface {
|
||||
apply(*settings)
|
||||
}
|
||||
|
||||
type enableStdoutExporter struct {
|
||||
Option
|
||||
}
|
||||
|
||||
func (setting enableStdoutExporter) apply(o *settings) {
|
||||
o.EnableStdoutExporter = true
|
||||
}
|
||||
|
||||
type enablePrometheusExporter struct {
|
||||
Option
|
||||
}
|
||||
|
||||
func (setting enablePrometheusExporter) apply(o *settings) {
|
||||
o.EnablePrometheusExporter = true
|
||||
}
|
||||
|
||||
type exportInterval struct {
|
||||
Option
|
||||
interval time.Duration
|
||||
}
|
||||
|
||||
func (setting exportInterval) apply(o *settings) {
|
||||
o.MetricExportInterval = setting.interval
|
||||
}
|
Reference in New Issue
Block a user