MCPcopy Create free account
hub / github.com/apache/mesos / update

Method update

src/master/allocator/mesos/metrics.cpp:48–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47template<class Quantities>
48void QuotaMetrics::update(const string& role, const Quantities& quantities)
49{
50 hashmap<string, PushGauge>& gauges = metrics[role];
51
52 hashset<string> namesToRemove = gauges.keys();
53
54 for (const auto& quantity : quantities) {
55 const string& name = quantity.first;
56 const double value = quantity.second.value();
57
58 namesToRemove.erase(name);
59
60 if (gauges.contains(name)) {
61 gauges.at(name) = value;
62 continue;
63 }
64
65 PushGauge newGauge(
66 "allocator/mesos/quota/roles/" + role + "/resources/" + name + suffix);
67
68 newGauge = value;
69 process::metrics::add(newGauge);
70 gauges.put(name, newGauge);
71 }
72
73 for (const string& name : namesToRemove) {
74 process::metrics::remove(gauges.at(name));
75 gauges.erase(name);
76 }
77
78 if (gauges.empty()) {
79 metrics.erase(role);
80 }
81}
82
83
84QuotaMetrics::~QuotaMetrics() {

Callers 3

updateAllocationMethod · 0.45
updateQuotaMethod · 0.45
updateConsumedMethod · 0.45

Calls 9

atMethod · 0.80
addFunction · 0.50
removeFunction · 0.50
keysMethod · 0.45
valueMethod · 0.45
eraseMethod · 0.45
containsMethod · 0.45
putMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected