Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::zipkin_span_data Struct Reference

Zipkin-specific span representation. More...

#include <trace_exporters.h>

Collaboration diagram for kcenon::monitoring::zipkin_span_data:
Collaboration graph

Public Member Functions

std::string to_json_v2 () const
 Convert to Zipkin JSON v2 format.
 
std::vector< uint8_t > to_protobuf () const
 Convert to Zipkin protobuf format (stub)
 

Public Attributes

std::string trace_id
 
std::string span_id
 
std::string parent_id
 
std::string name
 
std::string kind
 
std::chrono::microseconds timestamp
 
std::chrono::microseconds duration
 
std::string local_endpoint_service_name
 
std::string remote_endpoint_service_name
 
std::unordered_map< std::string, std::string > tags
 
bool shared = false
 

Detailed Description

Zipkin-specific span representation.

Definition at line 167 of file trace_exporters.h.

Member Function Documentation

◆ to_json_v2()

std::string kcenon::monitoring::zipkin_span_data::to_json_v2 ( ) const
inline

Convert to Zipkin JSON v2 format.

Definition at line 183 of file trace_exporters.h.

183 {
184 std::ostringstream json;
185 json << "{";
186 json << "\"traceId\":\"" << trace_id << "\",";
187 json << "\"id\":\"" << span_id << "\",";
188 if (!parent_id.empty()) {
189 json << "\"parentId\":\"" << parent_id << "\",";
190 }
191 json << "\"name\":\"" << name << "\",";
192 json << "\"kind\":\"" << kind << "\",";
193 json << "\"timestamp\":" << timestamp.count() << ",";
194 json << "\"duration\":" << duration.count() << ",";
195
196 // Local endpoint
197 json << "\"localEndpoint\":{\"serviceName\":\"" << local_endpoint_service_name << "\"},";
198
199 // Remote endpoint (if set)
200 if (!remote_endpoint_service_name.empty()) {
201 json << "\"remoteEndpoint\":{\"serviceName\":\"" << remote_endpoint_service_name << "\"},";
202 }
203
204 // Tags
205 json << "\"tags\":{";
206 bool first = true;
207 for (const auto& [key, value] : tags) {
208 if (!first) json << ",";
209 json << "\"" << key << "\":\"" << value << "\"";
210 first = false;
211 }
212 json << "}";
213
214 if (shared) {
215 json << ",\"shared\":true";
216 }
217
218 json << "}";
219 return json.str();
220 }
std::unordered_map< std::string, std::string > tags
std::chrono::microseconds duration
std::chrono::microseconds timestamp

References duration, kind, local_endpoint_service_name, name, parent_id, remote_endpoint_service_name, shared, span_id, tags, timestamp, and trace_id.

◆ to_protobuf()

std::vector< uint8_t > kcenon::monitoring::zipkin_span_data::to_protobuf ( ) const
inline

Convert to Zipkin protobuf format (stub)

Definition at line 225 of file trace_exporters.h.

225 {
226 // Protobuf serialization requires generated code
227 // Return empty for now - full implementation would use protobuf library
228 return {};
229 }

Member Data Documentation

◆ duration

std::chrono::microseconds kcenon::monitoring::zipkin_span_data::duration

◆ kind

std::string kcenon::monitoring::zipkin_span_data::kind

◆ local_endpoint_service_name

std::string kcenon::monitoring::zipkin_span_data::local_endpoint_service_name

◆ name

std::string kcenon::monitoring::zipkin_span_data::name

◆ parent_id

std::string kcenon::monitoring::zipkin_span_data::parent_id

◆ remote_endpoint_service_name

std::string kcenon::monitoring::zipkin_span_data::remote_endpoint_service_name

Definition at line 176 of file trace_exporters.h.

Referenced by to_json_v2().

◆ shared

bool kcenon::monitoring::zipkin_span_data::shared = false

Definition at line 178 of file trace_exporters.h.

Referenced by to_json_v2().

◆ span_id

std::string kcenon::monitoring::zipkin_span_data::span_id

◆ tags

std::unordered_map<std::string, std::string> kcenon::monitoring::zipkin_span_data::tags

◆ timestamp

std::chrono::microseconds kcenon::monitoring::zipkin_span_data::timestamp

◆ trace_id

std::string kcenon::monitoring::zipkin_span_data::trace_id

The documentation for this struct was generated from the following file: