Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
trace.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <fc/log/zipkin.hpp>
4#include <optional>
5
8#define fc_create_trace( TRACE_STR ) \
9 ::fc::zipkin_config::is_enabled() ? \
10 ::fc::optional_trace{ ::std::optional<::fc::zipkin_trace>( ::std::in_place, (TRACE_STR) ) } \
11 : ::fc::optional_trace{};
12
16#define fc_create_trace_with_id( TRACE_STR, TRACE_ID ) \
17 ::fc::zipkin_config::is_enabled() ? \
18 ::fc::optional_trace{ ::std::optional<::fc::zipkin_trace>( ::std::in_place, ::fc::zipkin_span::to_id(TRACE_ID), (TRACE_STR) ) } \
19 : ::fc::optional_trace{};
20
24#define fc_create_span( TRACE_VARNAME, SPAN_STR ) \
25 ( (TRACE_VARNAME) && ::fc::zipkin_config::is_enabled() ) ? \
26 (TRACE_VARNAME).opt->create_span( (SPAN_STR) ) \
27 : ::std::optional<::fc::zipkin_span>{};
28
32#define fc_create_span_from_token( TRACE_TOKEN, SPAN_STR ) \
33 ( (TRACE_TOKEN) && ::fc::zipkin_config::is_enabled() ) ? \
34 ::fc::zipkin_trace::create_span_from_token( (TRACE_TOKEN), (SPAN_STR) ) \
35 : ::std::optional<::fc::zipkin_span>{};
36
40#define fc_add_tag( SPAN_VARNAME, TAG_KEY_STR, TAG_VALUE_STR) \
41 FC_MULTILINE_MACRO_BEGIN \
42 if( (SPAN_VARNAME) && ::fc::zipkin_config::is_enabled() ) \
43 (SPAN_VARNAME)->add_tag( (TAG_KEY_STR), (TAG_VALUE_STR) ); \
44 FC_MULTILINE_MACRO_END