MCPcopy Create free account
hub / github.com/ClickHouse/ai-sdk-cpp / record_tool_call_start

Method record_tool_call_start

src/langfuse/tracer.cpp:362–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360} // namespace
361
362void 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
381void Trace::record_tool_call_finish(const ToolResult& result) {
382 if (ended_.load())

Callers 1

instrumentMethod · 0.80

Calls 2

make_span_createFunction · 0.85
wrap_eventFunction · 0.85

Tested by

no test coverage detected