config: allow reloading of telemetry settings (#1255)

* metrics: support dynamic configuration settings

* add test

* trace: update configuration when settings change

* config: allow logging options to be configured when settings change

* envoy: allow changing log settings

* fix unexpected doc change

* fix tests

* pick a port at random

* update based on review
This commit is contained in:
Caleb Doxsey 2020-08-12 08:14:15 -06:00 committed by GitHub
parent 0d611c2a40
commit f822c9a5d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 538 additions and 266 deletions

View file

@ -55,6 +55,7 @@ type Source interface {
// A StaticSource always returns the same config. Useful for testing.
type StaticSource struct {
cfg *Config
lis []ChangeListener
}
// NewStaticSource creates a new StaticSource.
@ -67,8 +68,18 @@ func (src *StaticSource) GetConfig() *Config {
return src.cfg
}
// SetConfig sets the config.
func (src *StaticSource) SetConfig(cfg *Config) {
src.cfg = cfg
for _, li := range src.lis {
li(cfg)
}
}
// OnConfigChange is ignored for the StaticSource.
func (src *StaticSource) OnConfigChange(ChangeListener) {}
func (src *StaticSource) OnConfigChange(li ChangeListener) {
src.lis = append(src.lis, li)
}
// A FileOrEnvironmentSource retrieves config options from a file or the environment.
type FileOrEnvironmentSource struct {