MCPcopy Create free account
hub / github.com/apple/foundationdb / getError

Function getError

fdbserver/Status.actor.cpp:251–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251static JsonBuilderObject getError(const TraceEventFields& errorFields) {
252 JsonBuilderObject statusObj;
253 try {
254 if (errorFields.size()) {
255 double time = atof(errorFields.getValue("Time").c_str());
256 statusObj["time"] = time;
257
258 statusObj["raw_log_message"] = errorFields.toString();
259
260 std::string type = errorFields.getValue("Type");
261 statusObj["type"] = type;
262
263 std::string description = type;
264 std::string errorName;
265 if (errorFields.tryGetValue("Error", errorName)) {
266 statusObj["name"] = errorName;
267 description += ": " + errorName;
268 } else
269 statusObj["name"] = "process_error";
270
271 struct tm* timeinfo;
272 time_t t = (time_t)time;
273 timeinfo = localtime(&t);
274 char buffer[128];
275 strftime(buffer, 128, "%c", timeinfo);
276 description += " at " + std::string(buffer);
277
278 statusObj["description"] = description;
279 }
280 } catch (Error& e) {
281 TraceEvent(SevError, "StatusGetErrorError").error(e).detail("RawError", errorFields.toString());
282 }
283 return statusObj;
284}
285
286static JsonBuilderObject machineStatusFetcher(WorkerEvents mMetrics,
287 std::vector<WorkerDetails> workers,

Callers 3

mapMethod · 0.50
isErrorMethod · 0.50

Calls 9

localtimeFunction · 0.85
TraceEventClass · 0.85
tryGetValueMethod · 0.80
detailMethod · 0.80
sizeMethod · 0.45
c_strMethod · 0.45
getValueMethod · 0.45
toStringMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected