From f13475eca5fd9ec9525aa4285265d84747df02f4 Mon Sep 17 00:00:00 2001 From: at055612 <22818309+at055612@users.noreply.github.com> Date: Fri, 24 Jan 2025 11:08:43 +0000 Subject: [PATCH] Add example config for outputting metrics to SLF4J --- stroom-proxy/stroom-proxy-app/proxy-dev.yml | 16 ++++++++++++++++ .../java/stroom/proxy/repo/store/FileStores.java | 4 +--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/stroom-proxy/stroom-proxy-app/proxy-dev.yml b/stroom-proxy/stroom-proxy-app/proxy-dev.yml index a03831e04f..ff9bb23cb8 100644 --- a/stroom-proxy/stroom-proxy-app/proxy-dev.yml +++ b/stroom-proxy/stroom-proxy-app/proxy-dev.yml @@ -58,6 +58,22 @@ logging: archivedFileCount: 100 timeZone: UTC logFormat: "%-6level [%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}] [%t] %logger - %X{code} %msg %n" + # Log the dropwizard metrics out to a minute rolled file. + # Metrics get sampled every min by default +# "metrics": +# level: INFO +# additive: false +# appenders: +# - type: file +# currentLogFilename: logs/metrics/metrics.log +# threshold: ALL +# queueSize: 256 +# discardingThreshold: 0 +# archive: true +# archivedLogFilenamePattern: logs/metrics/metrics%d{yyyy-MM-dd'T'HH:mm}.log +# archivedFileCount: 100 +# timeZone: UTC +# logFormat: "[%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}] %msg%n" appenders: - type: console diff --git a/stroom-proxy/stroom-proxy-repo/src/main/java/stroom/proxy/repo/store/FileStores.java b/stroom-proxy/stroom-proxy-repo/src/main/java/stroom/proxy/repo/store/FileStores.java index 6bfa708e73..a82e135c6e 100644 --- a/stroom-proxy/stroom-proxy-repo/src/main/java/stroom/proxy/repo/store/FileStores.java +++ b/stroom-proxy/stroom-proxy-repo/src/main/java/stroom/proxy/repo/store/FileStores.java @@ -31,15 +31,13 @@ public class FileStores { private final Map fileStores = new ConcurrentHashMap<>(); private final CachedValue, Void> statsMapUpdater; -// private final Queue unregisteredMetrics = new ConcurrentLinkedQueue<>(); -// private volatile Consumer metricConsumer; public FileStores() { statsMapUpdater = CachedValue.stateless(Duration.ofSeconds(30), this::buildStoreState); } private Map buildStoreState() { - LOGGER.info("Capturing store stats"); + LOGGER.debug("Capturing store stats"); final Map map = new HashMap<>(); for (final Entry entry : fileStores.entrySet()) { final Path path = entry.getValue();