use metrics library for spring integration

This commit is contained in:
Carsten Otto
2021-11-30 15:43:04 +01:00
parent 7835750ac3
commit f7e76e3e8c
30 changed files with 116 additions and 273 deletions

View File

@@ -1,7 +1,6 @@
package de.cotto.lndmanagej.controller;
import com.codahale.metrics.MetricRegistry;
import de.cotto.lndmanagej.metrics.Metrics;
import com.codahale.metrics.annotation.Timed;
import de.cotto.lndmanagej.model.LocalOpenChannel;
import de.cotto.lndmanagej.model.Pubkey;
import de.cotto.lndmanagej.service.ChannelService;
@@ -19,21 +18,18 @@ public class LegacyController {
private static final String NEWLINE = "\n";
private final NodeService nodeService;
private final ChannelService channelService;
private final Metrics metrics;
public LegacyController(
NodeService nodeService,
ChannelService channelService,
Metrics metrics
ChannelService channelService
) {
this.nodeService = nodeService;
this.channelService = channelService;
this.metrics = metrics;
}
@Timed
@GetMapping("/open-channels/pretty")
public String getOpenChannelIdsPretty() {
metrics.mark(MetricRegistry.name(getClass(), "getOpenChannelIdsPretty"));
return channelService.getOpenChannels().stream()
.sorted(Comparator.comparing(LocalOpenChannel::getId))
.map(localOpenChannel -> {