From 33fe0e1251562964ae3b2dacfbcb872f21050d03 Mon Sep 17 00:00:00 2001 From: Vache Shirikian Date: Thu, 25 Jan 2024 12:05:18 -0800 Subject: [PATCH] ERROR vs WARN for registry/publisher errors This should help expose Atlas reporting errors more quickly to systems that harvest and expose ERRORs --- .../main/java/com/netflix/spectator/atlas/AtlasRegistry.java | 4 ++-- .../com/netflix/spectator/atlas/impl/DefaultPublisher.java | 4 ++-- .../com/netflix/spectator/stateless/StatelessRegistry.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java b/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java index 6e19a1060..c5d94a7e7 100644 --- a/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java +++ b/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java @@ -217,7 +217,7 @@ public void stop() { overridableClock.setWallTime(now / stepMillis * stepMillis + stepMillis); sendToAtlas(); } catch (Exception e) { - logger.warn("failed to flush data to Atlas", e); + logger.error("failed to flush data to Atlas", e); } // Shutdown publisher used for sending metrics @@ -317,7 +317,7 @@ void sendToLWC() { CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); } } catch (Exception e) { - logger.warn("failed to send metrics for subscriptions (uri={})", evalUri, e); + logger.error("failed to send metrics for subscriptions (uri={})", evalUri, e); } } else { logger.debug("lwc is disabled, skipping subscriptions"); diff --git a/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/DefaultPublisher.java b/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/DefaultPublisher.java index 85f6290fd..887068762 100644 --- a/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/DefaultPublisher.java +++ b/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/DefaultPublisher.java @@ -170,7 +170,7 @@ public CompletableFuture publish(PublishPayload payload) { recordClockSkew((date == null) ? 0L : date.toEpochMilli()); validationHelper.recordResults(payload.getMetrics().size(), res); } catch (Exception e) { - logger.warn("failed to send metrics (uri={})", uri, e); + logger.error("failed to send metrics (uri={})", uri, e); validationHelper.incrementDroppedHttp(payload.getMetrics().size()); } }; @@ -191,7 +191,7 @@ public CompletableFuture publish(EvalPayload payload) { .withJsonContent(json) .send(); } catch (Exception e) { - logger.warn("failed to send metrics for subscriptions (uri={})", evalUri, e); + logger.error("failed to send metrics for subscriptions (uri={})", evalUri, e); } }; return CompletableFuture.runAsync(task, senderPool); diff --git a/spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java b/spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java index 923ac5d8a..10b0b90d5 100644 --- a/spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java +++ b/spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java @@ -123,12 +123,12 @@ private void collectData() { .compress(Deflater.BEST_SPEED) .send(); if (res.status() != 200) { - logger.warn("failed to send metrics, status {}: {}", res.status(), res.entityAsString()); + logger.error("failed to send metrics, status {}: {}", res.status(), res.entityAsString()); } } removeExpiredMeters(); } catch (Exception e) { - logger.warn("failed to send metrics", e); + logger.error("failed to send metrics", e); } }