core/config: add config version, additional telemetry

This commit is contained in:
Caleb Doxsey 2023-10-27 13:16:03 -06:00
parent dd7e3b993c
commit 141aebece0
13 changed files with 857 additions and 766 deletions

View file

@ -114,6 +114,7 @@ func NewFileOrEnvironmentSource(
cfg := &Config{
Options: options,
EnvoyVersion: envoyVersion,
Version: 1,
}
ports, err := netutil.AllocatePorts(6)
@ -151,6 +152,7 @@ func (src *FileOrEnvironmentSource) check(ctx context.Context) {
options, err := newOptionsFromConfig(src.configFile)
if err == nil {
cfg = cfg.Clone()
cfg.Version++
cfg.Options = options
metrics.SetConfigInfo(ctx, cfg.Options.Services, "local", cfg.Checksum(), true)
} else {
@ -160,6 +162,8 @@ func (src *FileOrEnvironmentSource) check(ctx context.Context) {
src.config = cfg
src.mu.Unlock()
log.Info(ctx).Int64("config-version", cfg.Version).Msg("config: loaded configuration")
src.Trigger(ctx, cfg)
}