NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
tracer.h
Go to the documentation of this file.
1
19#pragma once
20
21#include <neograph/api.h>
22
23#include <cstdint>
24#include <memory>
25#include <string>
26#include <string_view>
27
28namespace neograph::observability {
29
45class NEOGRAPH_API Span {
46public:
47 virtual ~Span() = default;
48
49 virtual void set_attribute(std::string_view key, std::string_view value) = 0;
50 virtual void set_attribute(std::string_view key, int64_t value) = 0;
51 virtual void set_attribute(std::string_view key, double value) = 0;
52
59 virtual void set_attribute_bool(std::string_view key, bool value) = 0;
60
64 void set_attribute(std::string_view key, const char* value) {
65 set_attribute(key, std::string_view(value ? value : ""));
66 }
67
73 virtual void add_event(std::string_view name,
74 std::string_view payload = {}) = 0;
75
76 virtual void set_status_ok() = 0;
77 virtual void set_status_error(std::string_view message) = 0;
78
81 virtual void end() = 0;
82};
83
114class NEOGRAPH_API Tracer {
115public:
116 virtual ~Tracer() = default;
117
124 virtual std::unique_ptr<Span> start_span(std::string_view name,
125 Span* parent = nullptr) = 0;
126};
127
128} // namespace neograph::observability
NEOGRAPH_API export/import macro for shared-library builds.
Opaque per-request span; lifetime is unique_ptr.
Definition tracer.h:45
virtual void set_attribute_bool(std::string_view key, bool value)=0
Renamed off the set_attribute overload set on purpose: a const char* literal passed as the value woul...
virtual void end()=0
Close the span.
virtual void add_event(std::string_view name, std::string_view payload={})=0
Record a discrete time-stamped event on this span (mapped to OTel's Span::AddEvent).
void set_attribute(std::string_view key, const char *value)
Forwarding overload so string literals ("CHAIN") reach the string_view sink rather than slipping into...
Definition tracer.h:64
Adapter facade for a tracing backend.
Definition tracer.h:114
virtual std::unique_ptr< Span > start_span(std::string_view name, Span *parent=nullptr)=0