From e23cde506d31d65d2a15c299f87fa5fd8735d7cf Mon Sep 17 00:00:00 2001 From: Denis Mishin Date: Mon, 6 May 2024 11:39:14 -0400 Subject: [PATCH] health-check: building config from databroker source --- internal/databroker/config_source.go | 3 +++ pkg/health/check.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/internal/databroker/config_source.go b/internal/databroker/config_source.go index 9255e339c..5bea7ccdf 100644 --- a/internal/databroker/config_source.go +++ b/internal/databroker/config_source.go @@ -21,6 +21,7 @@ import ( configpb "github.com/pomerium/pomerium/pkg/grpc/config" "github.com/pomerium/pomerium/pkg/grpc/databroker" "github.com/pomerium/pomerium/pkg/grpcutil" + "github.com/pomerium/pomerium/pkg/health" ) // ConfigSource provides a new Config source that decorates an underlying config with @@ -100,9 +101,11 @@ func (src *ConfigSource) rebuild(ctx context.Context, firstTime firstTime) { now = time.Now() err := src.buildNewConfigLocked(ctx, cfg) if err != nil { + health.ReportError(health.BuildDatabrokerConfig, err) log.Error(ctx).Err(err).Msg("databroker: failed to build new config") return } + health.ReportOK(health.BuildDatabrokerConfig) log.Debug(ctx).Str("elapsed", time.Since(now).String()).Msg("databroker: built new config") src.computedConfig = cfg diff --git a/pkg/health/check.go b/pkg/health/check.go index 229a9e40f..aa9a9d88b 100644 --- a/pkg/health/check.go +++ b/pkg/health/check.go @@ -5,6 +5,8 @@ import "fmt" type Check string const ( + // BuildDatabrokerConfig checks whether the Databroker config was applied + BuildDatabrokerConfig = Check("config.databroker.build") // StorageBackend checks whether the storage backend is healthy StorageBackend = Check("storage.backend") // XDSCluster checks whether the XDS Cluster resources were applied