diff --git a/pkg/configurator/client.go b/pkg/configurator/client.go index 1bed39d3f1..0411b4b763 100644 --- a/pkg/configurator/client.go +++ b/pkg/configurator/client.go @@ -100,7 +100,8 @@ func (c *Client) run(stop <-chan struct{}) { log.Debug().Msgf("Started OSM MeshConfig informer") log.Debug().Msg("[MeshConfig Client] Waiting for MeshConfig informer's cache to sync") if !cache.WaitForCacheSync(stop, c.informer.HasSynced) { - log.Error().Str(errcode.Kind, errcode.ErrMeshConfigInformerInitCache.String()).Msg("Failed initial cache sync for MeshConfig informer") + // TODO: Need to push metric + log.Error().Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrMeshConfigInformerInitCache)).Msg("Failed initial cache sync for MeshConfig informer") return } @@ -133,7 +134,7 @@ func meshConfigUpdatedMessageHandler(psubMsg *events.PubSubMessage) { prevMeshConfig, okPrevCast := psubMsg.OldObj.(*v1alpha1.MeshConfig) newMeshConfig, okNewCast := psubMsg.NewObj.(*v1alpha1.MeshConfig) if !okPrevCast || !okNewCast { - log.Error().Str(errcode.Kind, errcode.ErrMeshConfigStructCasting.String()).Msgf("[%s] Error casting old/new MeshConfigs objects (%v %v)", + log.Error().Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrMeshConfigStructCasting)).Msgf("[%s] Error casting old/new MeshConfigs objects (%v %v)", psubMsg.AnnouncementType, okPrevCast, okNewCast) return } @@ -191,7 +192,7 @@ func (c *Client) getMeshConfig() *v1alpha1.MeshConfig { meshConfigCacheKey := c.getMeshConfigCacheKey() item, exists, err := c.cache.GetByKey(meshConfigCacheKey) if err != nil { - log.Error().Err(err).Str(errcode.Kind, errcode.ErrMeshConfigFetchFromCache.String()).Msgf("Error getting MeshConfig from cache with key %s", meshConfigCacheKey) + log.Error().Err(err).Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrMeshConfigFetchFromCache)).Msgf("Error getting MeshConfig from cache with key %s", meshConfigCacheKey) return &v1alpha1.MeshConfig{} } diff --git a/pkg/configurator/methods.go b/pkg/configurator/methods.go index bc06fa96c5..8d1826399b 100644 --- a/pkg/configurator/methods.go +++ b/pkg/configurator/methods.go @@ -52,7 +52,7 @@ func marshalConfigToJSON(config *configv1alpha1.MeshConfigSpec) (string, error) func (c *Client) GetMeshConfigJSON() (string, error) { cm, err := marshalConfigToJSON(&c.getMeshConfig().Spec) if err != nil { - log.Error().Err(err).Str(errcode.Kind, errcode.ErrMeshConfigMarshaling.String()).Msgf("Error marshaling MeshConfig %s: %+v", c.getMeshConfigCacheKey(), c.getMeshConfig()) + log.Error().Err(err).Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrMeshConfigMarshaling)).Msgf("Error marshaling MeshConfig %s: %+v", c.getMeshConfigCacheKey(), c.getMeshConfig()) return "", err } return cm, nil