1
0
Fork 0

Version/Engine Cluster Health (#7474)

* Export Version and Engine in Cluster Health. Additionally export `versionString` in registered Servers.

* Updated Changelog.
This commit is contained in:
Lars Maier 2018-11-27 14:56:00 +01:00 committed by Max Neunhöffer
parent 7213b80c6c
commit f3ade0f860
3 changed files with 49 additions and 19 deletions

View File

@ -1,6 +1,8 @@
devel
-----
* Export Version and Storage Engine in `_admin/cluster/health` for Coordinators and DBServers.
* fixed Foxx complaining about valid `$schema` value in manifest.json
* Foxx `req.makeAbsolute` now will return meaningful values when ArangoDB is using

View File

@ -53,13 +53,17 @@ struct HealthRecord {
std::string advertisedEndpoint;
std::string lastAcked;
std::string hostId;
std::string serverVersion;
std::string engine;
size_t version;
explicit HealthRecord() : version(0) {}
HealthRecord(
std::string const& sn, std::string const& ep, std::string const& ho) :
shortName(sn), endpoint(ep), hostId(ho), version(0) {}
std::string const& sn, std::string const& ep, std::string const& ho,
std::string const& en, std::string const& sv) :
shortName(sn), endpoint(ep), hostId(ho), serverVersion(sv),
engine(en), version(0) {}
explicit HealthRecord(Node const& node) {
*this = node;
@ -94,6 +98,12 @@ struct HealthRecord {
if (node.has("AdvertisedEndpoint")) {
version = 3;
advertisedEndpoint = node.hasAsString("AdvertisedEndpoint").first;
if (node.has("Engine") && node.has("Version")) {
version = 4;
engine = node.hasAsString("Engine").first;
serverVersion = node.hasAsString("Version").first;
}
}
} else if (node.has("LastHeartbeatStatus")) {
version = 1;
@ -116,6 +126,8 @@ struct HealthRecord {
advertisedEndpoint = other.advertisedEndpoint;
endpoint = other.endpoint;
hostId = other.hostId;
engine = other.engine;
serverVersion = other.serverVersion;
version = other.version;
return *this;
}
@ -128,6 +140,8 @@ struct HealthRecord {
obj.add("Host", VPackValue(hostId));
obj.add("SyncStatus", VPackValue(syncStatus));
obj.add("Status", VPackValue(status));
obj.add("Version", VPackValue(serverVersion));
obj.add("Engine", VPackValue(engine));
if (syncTime.empty()) {
obj.add("Timestamp",
VPackValue(timepointToString(std::chrono::system_clock::now())));
@ -443,18 +457,31 @@ std::vector<check_t> Supervision::check(std::string const& type) {
shortName = tmp_shortName.first;
// "/arango/Current/<serverId>/endpoint"
// "/arango/Current/ServersRegistered/<server-id>/endpoint"
std::string endpoint;
std::string epPath = serverID + "/endpoint";
if (serversRegistered.has(epPath)) {
endpoint = serversRegistered.hasAsString(epPath).first;
}
// "/arango/Current/<serverId>/host"
// "/arango/Current/ServersRegistered/<server-id>/host"
std::string hostId;
std::string hoPath = serverID + "/host";
if (serversRegistered.has(hoPath)) {
hostId = serversRegistered.hasAsString(hoPath).first;
}
// "/arango/Current/ServersRegistered/<server-id>/serverVersion"
std::string serverVersion;
std::string svPath = serverID + "/versionString";
if (serversRegistered.has(svPath)) {
serverVersion = serversRegistered.hasAsString(svPath).first;
}
// "/arango/Current/ServersRegistered/<server-id>/engine"
std::string engine;
std::string enPath = serverID + "/engine";
if (serversRegistered.has(enPath)) {
engine = serversRegistered.hasAsString(enPath).first;
}
// "/arango/Current/<serverId>/externalEndpoint"
/*std::string externalEndpoint;
@ -464,8 +491,8 @@ std::vector<check_t> Supervision::check(std::string const& type) {
}*/
// Health records from persistence, from transience and a new one
HealthRecord transist(shortName, endpoint, hostId);
HealthRecord persist(shortName, endpoint, hostId);
HealthRecord transist(shortName, endpoint, hostId, engine, serverVersion);
HealthRecord persist(shortName, endpoint, hostId, engine, serverVersion);
// Get last health entries from transient and persistent key value stores
if (_transient.has(healthPrefix + serverID)) {

View File

@ -654,6 +654,7 @@ bool ServerState::registerAtAgencyPhase2(AgencyComm& comm) {
builder.add("advertisedEndpoint", VPackValue(_advertisedEndpoint));
builder.add("host", VPackValue(getHost()));
builder.add("version", VPackValue(rest::Version::getNumericServerVersion()));
builder.add("versionString", VPackValue(rest::Version::getServerVersion()));
builder.add("engine", VPackValue(EngineSelectorFeature::engineName()));
} catch (...) {
LOG_TOPIC(FATAL, arangodb::Logger::CLUSTER) << "out of memory";