• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanopub-registry / 28155387420

25 Jun 2026 07:53AM UTC coverage: 31.926% (-0.2%) from 32.089%
28155387420

push

github

web-flow
chore: enhance and standardize logging across multiple components (#116)

* chore(EntryStatus): enhance logging for null and unsupported status value handling

* chore(logging): standardize logger variable names across multiple classes

* chore(CoverageFilter): enhance logging for coverage filter initialization and type checks

* chore(RegistryPeerConnector): enhance logging for peer connection and nanopub fetching

* chore(logging): enhance logging for request handling and error reporting in multiple pages

* chore(MainVerticle): enhance logging for HTTP server startup, request routing, and POST processing

* chore(Task): improve logging messages

* chore(Task): enhance logging for server status checks and account loading processes

* chore(RegistryInfo): add logging messages for RegistryInfo snapshot assembly and JSON serialization

* chore(logging): enhance logging throughout various components for better traceability and debugging

* chore(Utils): enhance logging for user IRI extraction in IntroNanopub

* chore(TrustStatePage): enhance logging for trust-state snapshot resolution and querying

* chore(NanopubLoader): enhance logging for nanopub retrieval and processing

* chore(Task): enhance logging for task execution and status transitions

313 of 1106 branches covered (28.3%)

Branch coverage included in aggregate %.

1048 of 3157 relevant lines covered (33.2%)

5.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.61
src/main/java/com/knowledgepixels/registry/RegistryInfo.java
1
package com.knowledgepixels.registry;
2

3
import com.google.gson.Gson;
4
import com.mongodb.client.ClientSession;
5
import org.bson.Document;
6
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
8

9
import java.io.Serializable;
10

11
import static com.knowledgepixels.registry.RegistryDB.*;
12

13
@SuppressWarnings("unused")
14
public class RegistryInfo implements Serializable {
9✔
15

16
    private static final long serialVersionUID = 1L;
17

18
    private static final Logger logger = LoggerFactory.getLogger(RegistryInfo.class);
9✔
19

20
    private String registryVersion;
21
    private Long setupId;
22
    private Long trustStateCounter;
23
    private String lastTrustStateUpdate;
24
    private String trustStateHash;
25
    private String status;
26
    private String coverageTypes;
27
    private String coverageAgents;
28
    private String currentSetting;
29
    private String originalSetting;
30
    private Long agentCount;
31
    private Long accountCount;
32
    private Long nanopubCount;
33
    private Long loadCounter;
34
    private Boolean isTestInstance;
35
    private Boolean optionalLoadEnabled;
36
    private Boolean trustCalculationEnabled;
37

38
    private static final Gson gson = new Gson();
15✔
39

40
    public static RegistryInfo getLocal(ClientSession mongoSession) {
41
        logger.debug("Assembling RegistryInfo snapshot");
9✔
42

43
        RegistryInfo ri = new RegistryInfo();
12✔
44
        Document si = new Document();
12✔
45
        for (Document d : collection(Collection.SERVER_INFO.toString()).find(mongoSession)) {
42✔
46
            si.put(d.getString("_id"), d.get("value"));
27✔
47
        }
3✔
48
        logger.debug("Loaded {} entries from {} collection: {}", si.size(), Collection.SERVER_INFO, si.keySet());
60✔
49

50
        ri.registryVersion = Utils.getVersion();
9✔
51
        ri.setupId = (Long) si.get("setupId");
18✔
52
        ri.trustStateCounter = (Long) si.get("trustStateCounter");
18✔
53
        ri.lastTrustStateUpdate = (String) si.get("lastTrustStateUpdate");
18✔
54
        ri.trustStateHash = (String) si.get("trustStateHash");
18✔
55
        ri.loadCounter = (Long) getMaxValue(mongoSession, Collection.NANOPUBS.toString(), "counter");
24✔
56
        if (ri.loadCounter == null) {
9!
57
            logger.debug("No max 'counter' value found in {} (collection may be empty)", Collection.NANOPUBS);
×
58
        }
59

60
        ri.status = (String) si.get("status");
18✔
61
        if (ri.status == null) {
9!
62
            logger.warn("Server status is missing from {} ('status' key not set)", Collection.SERVER_INFO);
×
63
        }
64

65
        ri.coverageTypes = si.get("coverageTypes") != null ? (String) si.get("coverageTypes") : "all";
33!
66
        ri.coverageAgents = si.get("coverageAgents") != null ? (String) si.get("coverageAgents") : "viaSetting";
33!
67
        logger.debug("Coverage settings resolved: coverageTypes={}, coverageAgents={}", ri.coverageTypes, ri.coverageAgents);
21✔
68

69
        ri.currentSetting = (String) getValue(mongoSession, Collection.SETTING.toString(), "current");
24✔
70
        ri.originalSetting = (String) getValue(mongoSession, Collection.SETTING.toString(), "original");
24✔
71
        if (ri.currentSetting == null || ri.originalSetting == null) {
18!
72
            logger.debug("Setting lookup incomplete: currentSetting={}, originalSetting={}", ri.currentSetting, ri.originalSetting);
×
73
        }
74

75
        ri.trustCalculationEnabled = !"false".equals(System.getenv("REGISTRY_ENABLE_TRUST_CALCULATION"));
30!
76
        if (!"false".equals(System.getenv("REGISTRY_ENABLE_TRUST_CALCULATION"))) {
15!
77
            ri.agentCount = collection(Collection.AGENTS.toString()).countDocuments(mongoSession);
24✔
78
            logger.debug("Trust calculation enabled; agentCount={}", ri.agentCount);
18✔
79
        } else {
80
            logger.debug("Trust calculation disabled (REGISTRY_ENABLE_TRUST_CALCULATION=false); skipping agentCount");
×
81
        }
82

83
        ri.accountCount = collection(Collection.ACCOUNTS.toString()).countDocuments(mongoSession);
24✔
84
        ri.nanopubCount = collection(Collection.NANOPUBS.toString()).countDocuments(mongoSession);
24✔
85
        logger.debug("Counts: accountCount={}, nanopubCount={}", ri.accountCount, ri.nanopubCount);
21✔
86

87
        ri.isTestInstance = si.get("testInstance") != null && (Boolean) si.get("testInstance");
42!
88
        ri.optionalLoadEnabled = !"false".equals(System.getenv("REGISTRY_ENABLE_OPTIONAL_LOAD"));
30!
89

90
        logger.info("RegistryInfo snapshot ready: version={}, status={}, setupId={}, isTestInstance={}, optionalLoadEnabled={}, trustCalculationEnabled={}", ri.registryVersion, ri.status, ri.setupId, ri.isTestInstance, ri.optionalLoadEnabled, ri.trustCalculationEnabled);
105✔
91

92
        return ri;
6✔
93
    }
94

95
    public String asJson() {
96
        String json = gson.toJson(this);
12✔
97
        logger.debug("Serialized RegistryInfo to JSON ({} chars)", json.length());
18✔
98
        return json;
6✔
99
    }
100

101
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc