MCPcopy Create free account
hub / github.com/apache/impala / MetricsToJSON

Method MetricsToJSON

be/src/kudu/util/trace.cc:203–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void Trace::MetricsToJSON(JsonWriter* jw) const {
204 // Convert into a map with 'std::string' keys instead of 'const char*'
205 // keys, so that the results are in a consistent (sorted) order.
206 std::map<string, int64_t> counters;
207 for (const auto& entry : metrics_.Get()) {
208 counters[entry.first] = entry.second;
209 }
210
211 jw->StartObject();
212 for (const auto& e : counters) {
213 jw->String(e.first);
214 jw->Int64(e.second);
215 }
216 vector<pair<StringPiece, scoped_refptr<Trace>>> child_traces;
217 {
218 std::lock_guard<simple_spinlock> l(lock_);
219 child_traces = child_traces_;
220 }
221
222 if (!child_traces.empty()) {
223 jw->String("child_traces");
224 jw->StartArray();
225
226 for (const auto& e : child_traces) {
227 jw->StartArray();
228 jw->String(e.first.data(), e.first.size());
229 e.second->MetricsToJSON(jw);
230 jw->EndArray();
231 }
232 jw->EndArray();
233 }
234 jw->EndObject();
235}
236
237void Trace::DumpCurrentTrace() {
238 Trace* t = CurrentTrace();

Callers

nothing calls this directly

Calls 10

GetMethod · 0.45
StartObjectMethod · 0.45
StringMethod · 0.45
Int64Method · 0.45
emptyMethod · 0.45
StartArrayMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
EndArrayMethod · 0.45
EndObjectMethod · 0.45

Tested by

no test coverage detected