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

Method build_trace_event

src/langfuse/tracer.cpp:478–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478JsonValue 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
505bool Trace::end() {
506 if (ended_.exchange(true))

Callers

nothing calls this directly

Calls 1

wrap_eventFunction · 0.85

Tested by

no test coverage detected