Search in sources :

Example 1 with VdsClusterHtmlRendrer

use of com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer in project vespa by vespa-engine.

the class ContentCluster method writeHtmlState.

public void writeHtmlState(final VdsClusterHtmlRendrer vdsClusterHtmlRendrer, final StringBuilder sb, final Timer timer, final ClusterState state, final ClusterStatsAggregator statsAggregator, final Distribution distribution, final FleetControllerOptions options, final EventLog eventLog) {
    final VdsClusterHtmlRendrer.Table table = vdsClusterHtmlRendrer.createNewClusterHtmlTable(clusterName, slobrokGenerationCount);
    final List<Group> groups = LeafGroups.enumerateFrom(distribution.getRootGroup());
    for (int j = 0; j < groups.size(); ++j) {
        final Group group = groups.get(j);
        assert (group != null);
        final String localName = group.getUnixStylePath();
        assert (localName != null);
        final TreeMap<Integer, NodeInfo> storageNodeInfoByIndex = new TreeMap<>();
        final TreeMap<Integer, NodeInfo> distributorNodeInfoByIndex = new TreeMap<>();
        for (ConfiguredNode configuredNode : group.getNodes()) {
            storeNodeInfo(configuredNode.index(), NodeType.STORAGE, storageNodeInfoByIndex);
            storeNodeInfo(configuredNode.index(), NodeType.DISTRIBUTOR, distributorNodeInfoByIndex);
        }
        table.renderNodes(storageNodeInfoByIndex, distributorNodeInfoByIndex, timer, state, statsAggregator, options.minMergeCompletionRatio, options.maxPrematureCrashes, eventLog, clusterName, localName);
    }
    table.addTable(sb, options.stableStateTimePeriod);
}
Also used : Group(com.yahoo.vdslib.distribution.Group) VdsClusterHtmlRendrer(com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode)

Example 2 with VdsClusterHtmlRendrer

use of com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer in project vespa by vespa-engine.

the class LegacyIndexPageRequestHandler method handle.

@Override
public StatusPageResponse handle(StatusPageServer.HttpRequest request) {
    TimeZone tz = TimeZone.getTimeZone("UTC");
    long currentTime = timer.getCurrentTimeInMillis();
    StatusPageResponse response = new StatusPageResponse();
    response.setContentType("text/html");
    StringBuilder content = new StringBuilder();
    content.append("<!-- Answer to request " + request + " -->\n");
    response.writeHtmlHeader(content, cluster.getName() + " Cluster Controller " + data.getOptions().fleetControllerIndex + " Status Page");
    content.append("<p><font size=\"-1\">").append(" [ <a href=\"#config\">Current config</a>").append(" | <a href=\"#clusterstates\">Cluster states</a>").append(" | <a href=\"#eventlog\">Event log</a>").append(" ]</font></p>\n");
    content.append("<table><tr><td>UTC time when creating this page:</td><td align=\"right\">").append(RealTimer.printDateNoMilliSeconds(currentTime, tz)).append("</td></tr>");
    // content.append("<tr><td>Fleetcontroller version:</td><td align=\"right\">" + Vtag.V_TAG_PKG + "</td></tr/>");
    content.append("<tr><td>Cluster controller uptime:</td><td align=\"right\">" + RealTimer.printDuration(currentTime - startedTime) + "</td></tr></table>");
    // State of master election
    masterElectionHandler.writeHtmlState(content, data.getOptions().stateGatherCount);
    if (masterElectionHandler.isAmongNthFirst(data.getOptions().stateGatherCount)) {
        // Table overview of all the nodes
        cluster.writeHtmlState(new VdsClusterHtmlRendrer(), content, timer, stateVersionTracker.getVersionedClusterState(), stateVersionTracker.getAggregatedClusterStats(), data.getOptions().storageDistribution, data.getOptions(), eventLog);
        // Overview of current config
        data.getOptions().writeHtmlState(content, request);
        // Current cluster state and cluster state history
        writeHtmlState(stateVersionTracker, content, request);
    } else {
        // Overview of current config
        data.getOptions().writeHtmlState(content, request);
    }
    // Event log
    eventLog.writeHtmlState(content, null);
    response.writeHtmlFooter(content, "");
    response.writeContent(content.toString());
    return response;
}
Also used : VdsClusterHtmlRendrer(com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer) StatusPageResponse(com.yahoo.vespa.clustercontroller.core.status.statuspage.StatusPageResponse)

Aggregations

VdsClusterHtmlRendrer (com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRendrer)2 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)1 Group (com.yahoo.vdslib.distribution.Group)1 StatusPageResponse (com.yahoo.vespa.clustercontroller.core.status.statuspage.StatusPageResponse)1