8000 missing metrics by kvahed · Pull Request #10625 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

missing metrics #10625

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

Merged
merged 50 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c3a2e25
some missing metrics
kvahed Dec 3, 2019
a6187c7
added the missing from startistics
kvahed Dec 4, 2019
f2dd77f
minimise reallocs
kvahed Dec 4, 2019
f7a41a4
Merge branch 'devel' into bug-fix/missing-metrics
jsteemann Jan 30, 2020
767a664
Update MetricsFeature.cpp
Simran-B Feb 3, 2020
83abd1d
devel merge
kvahed Mar 3, 2020
6274fa0
Merge branch 'bug-fix/missing-metrics' of https://github.com/arangodb…
kvahed Mar 3, 2020
e6be5fb
all in
kvahed Mar 4, 2020
f7ba3fd
oh my
kvahed Mar 4, 2020
dac8b9f
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 4, 2020
86ddd5b
logarithmic histogram
kvahed Mar 4, 2020
145a53e
rewrote the whole interface of logarithmic histograms to accomodate a…
kvahed Mar 5, 2020
b559bf4
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 5, 2020
987c5dc
log output
kvahed Mar 5, 2020
9df019d
log tests
kvahed Mar 6, 2020
aef8899
log tests
kvahed Mar 6, 2020
2737ca2
more tests
kvahed Mar 6, 2020
14ac1df
metrics fixing on
kvahed Mar 6, 2020
cbe2765
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 9, 2020
064933a
added tests
kvahed Mar 9, 2020
17c5e95
corrected prometheus export
kvahed Mar 9, 2020
7f7b4be
log tests
kvahed Mar 9, 2020
c05bdf4
metrics with label discrimination
kvahed Mar 9, 2020
77810dc
metrics with label discrimination
kvahed Mar 9, 2020
1750900
only counters outstanding with new key scheme
kvahed Mar 10, 2020
700796c
only counters outstanding with new key scheme
kvahed Mar 10, 2020
7248328
only counters outstanding with new key scheme
kvahed Mar 10, 2020
a8d44c0
fixed label behaviour
kvahed Mar 10, 2020
fca1583
corrected retrieve bahaviour.
kvahed Mar 10, 2020
365fa26
feature tests
kvahed Mar 10, 2020
fbd7bea
feature tests
kvahed Mar 10, 2020
52e6c8f
fetching bug
kvahed Mar 10, 2020
99eaed8
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 10, 2020
51c50ee
fixed uint64_t
kvahed Mar 10, 2020
ef284bb
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 10, 2020
ce4e870
wtf
kvahed Mar 10, 2020
ee61f66
histogram count labels
kvahed Mar 11, 2020
a80de52
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 11, 2020
6ebb0b9
histogram feature tests
kvahed Mar 11, 2020
3a800b4
histogram feature tests
kvahed Mar 11, 2020
10c3aa7
gauge feature tests
kvahed Mar 11, 2020
8277d0a
long int ambiguity
kvahed Mar 11, 2020
ea159b2
windows warning
kvahed Mar 11, 2020
94be7d7
separator on wrong side
kvahed Mar 11, 2020
853f0fc
windows warnings
kvahed Mar 11, 2020
2c05c51
added role to labels
kvahed Mar 12, 2020
3b34ab5
http requests
kvahed Mar 12, 2020
c955d13
added agency commit histogram
kvahed Mar 12, 2020
674b058
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
kvahed Mar 13, 2020
63b44e5
could break won't anymore
kvahed Mar 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions arangod/Agency/Agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ Agent::Agent(ApplicationServer& server, config_t const& config)
"agency_agent_write_no_leader", 0, "Agency write no leader")),
_read_ok(
_server.getFeature<arangodb::MetricsFeature>().counter(
"agency_agent_read_ok", 0, "Agency write ok")),
"agency_agent_read_ok", 0, "Agency read ok")),
_read_no_leader(
_server.getFeature<arangodb::MetricsFeature>().counter(
"agency_agent_read_no_leader", 0, "Agency write no leader")),
"agency_agent_read_no_leader", 0, "Agency read no leader")),
_write_hist_msec(
_server.getFeature<arangodb::MetricsFeature>().histogram(
"agency_agent_write_hist", 10, 0., 20., "Agency write histogram [ms]")) {
"agency_agent_write_hist", log_scale_t(2.f, 0.f, 200.f, 10),
"Agency write histogram [ms]")),
_commit_hist_msec(
_server.getFeature<arangodb::MetricsFeature>().histogram(
"agency_agent_commit_hist", log_scale_t(std::exp(1.f), 0.f, 200.f, 10),
"Agency RAFT commit histogram [ms]")) {
_state.configure(this);
_constituent.configure(this);
if (size() > 1) {
Expand All @@ -102,6 +107,11 @@ Agent::Agent(ApplicationServer& server, config_t const& config)
/// This agent's id
std::string Agent::id() const { return _config.id(); }

// Under no circumstances guard the member. Metrics guard themselves.
decltype(Agent::_commit_hist_msec) Agent::commitHist() const {
return _commit_hist_msec;
}

/// Agent's id is set once from state machine
bool Agent::id(std::string const& id) {
bool success;
Expand Down Expand Up @@ -1221,7 +1231,7 @@ write_ret_t Agent::write(query_t const& query, WriteMode const& wmode) {
indices.insert(indices.end(), tmp.begin(), tmp.end());
}
_write_hist_msec.count(
duration<double,std::milli>(high_resolution_clock::now()-start).count());
duration<float,std::milli>(high_resolution_clock::now()-start).count());
}

// Maximum log index
Expand Down Expand Up @@ -1276,7 +1286,7 @@ read_ret_t Agent::read(query_t const& query) {
// Retrieve data from readDB
std::vector<bool> success = _readDB.read(query, result);

++_read_no_leader;
++_read_ok;
return read_ret_t(true, leader, std::move(success), std::move(result));
}

Expand Down
5 changes: 4 additions & 1 deletion arangod/Agency/Agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ class Agent final : public arangodb::Thread, public AgentInterface {
/// the agency leader.
void updateSomeConfigValues(VPackSlice);

Histogram<log_scale_t<float>>& commitHist() const;

private:

/// @brief load() has run
Expand Down Expand Up @@ -499,7 +501,8 @@ class Agent final : public arangodb::Thread, public AgentInterface {
Counter& _write_no_leader;
Counter& _read_ok;
Counter& _read_no_leader;
Histogram<double>& _write_hist_msec;
Histogram<log_scale_t<float>>& _write_hist_msec;
Histogram<log_scale_t<float>>& _commit_hist_msec;

};
} // namespace consensus
Expand Down
7 changes: 7 additions & 0 deletions arangod/Agency/RestAgencyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ RestStatus RestAgencyHandler::handleStore() {
}

RestStatus RestAgencyHandler::handleWrite() {

using namespace std::chrono;
if (_request->requestType() != rest::RequestType::POST) {
return reportMethodNotAllowed();
}
Expand Down Expand Up @@ -238,6 +240,9 @@ RestStatus RestAgencyHandler::handleWrite() {
return reportMessage(rest::ResponseCode::SERVICE_UNAVAILABLE, "No leader");
}

// Start timing
auto const start = high_resolution_clock::now();

// Do write
write_ret_t ret;
try {
Expand Down Expand Up @@ -295,6 +300,8 @@ RestStatus RestAgencyHandler::handleWrite() {

if (max_index > 0) {
result = _agent->waitFor(max_index);
_agent->commitHist().count(
duration<float,std::milli>(high_resolution_clock::now()-start).count());
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions arangod/Cluster/ServerState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ std::string ServerState::roleToAgencyKey(ServerState::RoleEnum role) {
return "Coordinator";
case ROLE_SINGLE:
return "Single";

case ROLE_UNDEFINED:
case ROLE_AGENT: {
TRI_ASSERT(false);
case ROLE_AGENT:
return "Agent";
case ROLE_UNDEFINED: {
return "Undefined";
}
}
return "INVALID_CLUSTER_ROLE";
Expand Down Expand Up @@ -740,6 +740,14 @@ bool ServerState::registerAtAgencyPhase1(AgencyComm& comm, ServerState::RoleEnum
return false;
}

std::string ServerState::getShortName() const {
std::stringstream ss; // ShortName
auto num = getShortId();
size_t width = std::max(std::to_string(num + 1).size(), static_cast<size_t>(4));
ss << roleToAgencyKey(getRole()) << std::setw(width) << std::setfill('0') << num + 1;
return ss.str();
}

bool ServerState::registerAtAgencyPhase2(AgencyComm& comm, bool const hadPersistedId) {
TRI_ASSERT(!_id.empty() && !_myEndpoint.empty());

Expand Down
3 changes: 3 additions & 0 deletions arangod/Cluster/ServerState.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ class ServerState {
/// @brief set the server short id
void setShortId(uint32_t);

/// @brief set the server short id
std::string getShortName() const;

RebootId getRebootId() const;

void setRebootId(RebootId rebootId);
Expand Down
12 changes: 7 additions & 5 deletions CA6E arangod/RestServer/Metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ std::ostream& operator<< (std::ostream& o, Metrics::hist_type const& v) {
return o;
}

Metric::Metric(std::string const& name, std::string const& help)
: _name(name), _help(help) {};
Metric::Metric(std::string const& name, std::string const& help, std::string const& labels)
: _name(name), _help(help), _labels(labels) {};

Metric::~Metric() {}

std::string const& Metric::help() const { return _help; }
std::string const& Metric::name() const { return _name; }
std::string const& Metric::labels() const { return _labels; }

Counter& Counter::operator++() {
count();
Expand Down Expand Up @@ -102,12 +103,13 @@ void Counter::toPrometheus(std::string& result) const {
_b.push();
result += "#TYPE " + name() + " counter\n";
result += "#HELP " + name() + " " + help() + "\n";
result += name() + " " + std::to_string(load()) + "\n";
result += name() + "{" + labels() + "} " + std::to_string(load()) + "\n";
}

Counter::Counter(
uint64_t const& val, std::string const& name, std::string const& help) :
Metric(name, help), _c(val), _b(_c) {}
uint64_t const& val, std::string const& name, std::string const& help,
std::string const& labels) :
Metric(name, help, labels), _c(val), _b(_c) {}

Counter::~Counter() { _b.push(); }

Loading
0