From c70897898a45a62b2c67c8fa574332c3aff1c412 Mon Sep 17 00:00:00 2001 From: Nastassia Dailidava <133115055+nastassia-dailidava@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:07:06 +0200 Subject: [PATCH] allegro-internal/flex-roadmap#804 Added/removed logs (#431) --- CHANGELOG.md | 4 ++++ .../servicemesh/envoycontrol/SimpleCache.java | 21 ++++++------------- .../envoycontrol/v3/SimpleCacheTest.java | 1 - 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae541611..9b9e3b0c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Lists all changes with user impact. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [0.21.1] +### Changed +- Added additional logs to SimpleCache + ## [0.21.0] ### Changed - Added `paths` field in API to support Glob Patterns diff --git a/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java b/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java index d75493edc..e1b66b0d8 100644 --- a/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java +++ b/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java @@ -268,12 +268,15 @@ public DeltaWatch createDeltaWatch( String version) { long watchId = watchCount.incrementAndGet(); status.setWatch(watchId, watch); - watch.setStop(() -> status.removeWatch(watchId)); + watch.setStop(() -> { + LOGGER.debug("removing watch {}", watchId); + status.removeWatch(watchId); + }); + if (LOGGER.isDebugEnabled()) { - LOGGER.debug("open watch {} for {}[{}] from node {} for version {}", + LOGGER.debug("open watch {} for {} from node {} for version {}", watchId, url, - String.join(", ", resources), group, version); } @@ -371,12 +374,6 @@ protected void respondWithSpecificOrder(T group, String version = snapshot.version(watch.request().getResourceType(), watch.request().getResourceNamesList()); if (!watch.request().getVersionInfo().equals(version)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("responding to open watch {}[{}] with new version {}", - id, - String.join(", ", watch.request().getResourceNamesList()), - version); - } respond(watch, snapshot, group); @@ -413,12 +410,6 @@ protected void respondWithSpecificOrder(T group, String version = snapshot.version(watch.request().getResourceType(), Collections.emptyList()); if (!watch.version().equals(version)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("responding to open watch {}[{}] with new version {}", - id, - String.join(", ", watch.trackedResources().keySet()), - version); - } List removedResources = snapshotRemovedResources.stream() .filter(s -> watch.trackedResources().get(s) != null) diff --git a/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java b/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java index 444b0bd38..4c32f4bc1 100644 --- a/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java +++ b/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java @@ -95,7 +95,6 @@ public void invalidNamesListShouldReturnWatcherWithNoResponseInAdsMode() { false, false ); - assertThatWatchIsOpenWithNoResponses(new WatchAndTracker(watch, responseTracker)); }