| 476 | } |
| 477 | |
| 478 | JsonValue Trace::build_trace_event() const { |
| 479 | // Caller must hold mu_. |
| 480 | std::string start_iso = to_iso8601(trace_start_); |
| 481 | |
| 482 | JsonValue body; |
| 483 | body["id"] = id_; |
| 484 | body["name"] = name_; |
| 485 | body["timestamp"] = start_iso; |
| 486 | body["environment"] = tracer_.config().environment; |
| 487 | if (!tracer_.config().release.empty()) |
| 488 | body["release"] = tracer_.config().release; |
| 489 | if (input_) |
| 490 | body["input"] = *input_; |
| 491 | if (output_) |
| 492 | body["output"] = *output_; |
| 493 | if (user_id_) |
| 494 | body["userId"] = *user_id_; |
| 495 | if (session_id_) |
| 496 | body["sessionId"] = *session_id_; |
| 497 | if (metadata_) |
| 498 | body["metadata"] = *metadata_; |
| 499 | if (!tags_.empty()) |
| 500 | body["tags"] = tags_; |
| 501 | |
| 502 | return wrap_event(kEventTraceCreate, start_iso, std::move(body)); |
| 503 | } |
| 504 | |
| 505 | bool Trace::end() { |
| 506 | if (ended_.exchange(true)) |
nothing calls this directly
no test coverage detected