Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show past deviation in monitor #4734

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,6 +24,8 @@
import bisq.core.dao.monitoring.model.DaoStateBlock;
import bisq.core.dao.monitoring.model.ProposalStateBlock;
import bisq.core.dao.state.DaoStateService;
import bisq.core.filter.Filter;
import bisq.core.filter.FilterManager;
import bisq.core.network.p2p.inventory.messages.GetInventoryRequest;
import bisq.core.network.p2p.inventory.messages.GetInventoryResponse;
import bisq.core.network.p2p.inventory.model.InventoryItem;
Expand All @@ -47,6 +49,7 @@
import javax.inject.Named;

import com.google.common.base.Enums;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;

import java.util.HashMap;
Expand All @@ -66,6 +69,7 @@ public class GetInventoryRequestHandler implements MessageListener {
private final DaoStateMonitoringService daoStateMonitoringService;
private final ProposalStateMonitoringService proposalStateMonitoringService;
private final BlindVoteStateMonitoringService blindVoteStateMonitoringService;
private final FilterManager filterManager;
private final int maxConnections;

@Inject
Expand All @@ -76,6 +80,7 @@ public GetInventoryRequestHandler(NetworkNode networkNode,
DaoStateMonitoringService daoStateMonitoringService,
ProposalStateMonitoringService proposalStateMonitoringService,
BlindVoteStateMonitoringService blindVoteStateMonitoringService,
FilterManager filterManager,
@Named(Config.MAX_CONNECTIONS) int maxConnections) {
this.networkNode = networkNode;
this.peerManager = peerManager;
Expand All @@ -84,6 +89,7 @@ public GetInventoryRequestHandler(NetworkNode networkNode,
this.daoStateMonitoringService = daoStateMonitoringService;
this.proposalStateMonitoringService = proposalStateMonitoringService;
this.blindVoteStateMonitoringService = blindVoteStateMonitoringService;
this.filterManager = filterManager;
this.maxConnections = maxConnections;

this.networkNode.addMessageListener(this);
Expand Down Expand Up @@ -149,6 +155,11 @@ public void onMessage(NetworkEnvelope networkEnvelope, Connection connection) {
inventory.put(InventoryItem.usedMemory, String.valueOf(Profiler.getUsedMemoryInBytes()));
inventory.put(InventoryItem.jvmStartTime, String.valueOf(ManagementFactory.getRuntimeMXBean().getStartTime()));

Filter filter = filterManager.getFilter();
if (filter != null) {
inventory.put(InventoryItem.filteredSeeds, Joiner.on(", ").join(filter.getSeedNodes()));
}

log.info("Send inventory {} to {}", inventory, connection.getPeersNodeAddressOptional());
GetInventoryResponse getInventoryResponse = new GetInventoryResponse(inventory);
networkNode.sendMessage(connection, getInventoryResponse);
Expand Down
Expand Up @@ -124,7 +124,8 @@ public enum InventoryItem {
version("version", false),
commitHash("commitHash", false),
usedMemory("usedMemory", true),
jvmStartTime("jvmStartTime", true);
jvmStartTime("jvmStartTime", true),
filteredSeeds("filteredSeeds", false);

@Getter
private final String key;
Expand Down
Expand Up @@ -176,6 +176,8 @@ private String getSeedNodeInfo(NodeAddress nodeAddress,
true, true) :
"n/a";
sb.append("Run duration: ").append(duration).append("<br/>");

sb.append("Filtered seed nodes: ").append(requestInfo.getDisplayValue(InventoryItem.filteredSeeds)).append("<br/>");
}

return sb.toString();
Expand Down