core/config: add config version, additional telemetry (#4645)

* core/config: add config version, additional telemetry

* typo
This commit is contained in:
Caleb Doxsey 2023-10-27 15:16:40 -06:00 committed by GitHub
parent dd7e3b993c
commit ae420f01c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)
}