Skip to content

Commit

Permalink
Add example config for outputting metrics to SLF4J
Browse files Browse the repository at this point in the history
  • Loading branch information
at055612 committed Jan 24, 2025
1 parent 62f6383 commit f13475e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 16 additions & 0 deletions stroom-proxy/stroom-proxy-app/proxy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ public class FileStores {
private final Map<Key, Path> fileStores = new ConcurrentHashMap<>();

private final CachedValue<Map<Key, StoreStats>, Void> statsMapUpdater;
// private final Queue<NamedMetric> unregisteredMetrics = new ConcurrentLinkedQueue<>();
// private volatile Consumer<NamedMetric> metricConsumer;

public FileStores() {
statsMapUpdater = CachedValue.stateless(Duration.ofSeconds(30), this::buildStoreState);
}

private Map<Key, StoreStats> buildStoreState() {
LOGGER.info("Capturing store stats");
LOGGER.debug("Capturing store stats");
final Map<Key, StoreStats> map = new HashMap<>();
for (final Entry<Key, Path> entry : fileStores.entrySet()) {
final Path path = entry.getValue();
Expand Down

0 comments on commit f13475e

Please sign in to comment.