| 360 | } // namespace |
| 361 | |
| 362 | void Trace::record_tool_call_start(const ToolCall& call) { |
| 363 | if (ended_.load()) |
| 364 | return; |
| 365 | |
| 366 | // One clock read per event: startTime and the envelope timestamp share it. |
| 367 | std::string ts = to_iso8601(std::chrono::system_clock::now()); |
| 368 | |
| 369 | std::lock_guard<std::mutex> lock(mu_); |
| 370 | std::string parent_id = |
| 371 | active_generation_ ? active_generation_->id : std::string(); |
| 372 | JsonValue body = |
| 373 | make_span_create(new_uuid(), id_, parent_id, call.tool_name, ts, |
| 374 | call.arguments, tracer_.config().environment); |
| 375 | |
| 376 | size_t idx = events_.size(); |
| 377 | events_.push_back(wrap_event(kEventSpanCreate, ts, std::move(body))); |
| 378 | open_tool_spans_[call.id] = idx; |
| 379 | } |
| 380 | |
| 381 | void Trace::record_tool_call_finish(const ToolResult& result) { |
| 382 | if (ended_.load()) |
no test coverage detected