userver
C++ Async Framework
Toggle main menu visibility
Documentation
API Groups
Namespaces
Reference
Class List
Class Index
File List
Macros
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
span_event.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/tracing/span_event.hpp
4
/// @brief @copybrief tracing::SpanEvent
5
6
#
include
<
chrono
>
7
#
include
<
string_view
>
8
#
include
<
unordered_map
>
9
10
#
include
<
userver
/
formats
/
json_fwd
.
hpp
>
11
#
include
<
userver
/
tracing
/
any_value
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
tracing
{
16
17
/// @brief Span event -- time-stamped annotation of the span with user-provided text description.
18
/// @see https://opentelemetry.io/docs/concepts/signals/traces/#span-events
19
/// @see
20
/// https://github.com/open-telemetry/opentelemetry-proto/blob/v1.3.2/opentelemetry/proto/trace/v1/trace.proto#L220.
21
struct
SpanEvent
final
{
22
using
Timestamp = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>;
23
using
KeyValue = std::unordered_map<std::string,
AnyValue
>;
24
25
/// @brief Constructor. Creates span event with name and timestamp.
26
/// @param name Event name.
27
explicit
SpanEvent
(std::string_view name);
28
29
/// @brief Constructor. Creates span event with name, timestamp and attributes.
30
/// @param name Event name.
31
/// @param attributes Key-value attributes.
32
SpanEvent
(std::string_view name, KeyValue attributes);
33
34
/// @brief Event name.
35
std::string
name
;
36
37
/// @brief Event timestamp.
38
Timestamp
timestamp
{};
39
40
/// @brief Attributes.
41
/// @see
42
/// https://github.com/open-telemetry/opentelemetry-proto/blob/v1.3.2/opentelemetry/proto/common/v1/common.proto#L64.
43
/// @see
44
/// https://github.com/open-telemetry/opentelemetry-proto/blob/v1.3.2/opentelemetry/proto/trace/v1/trace.proto#L231.
45
/// @details Collection of unique key-value pairs.
46
KeyValue
attributes
;
47
};
21
struct
SpanEvent
final
{
…
};
48
49
SpanEvent Parse(
const
formats
::
json
::Value& value,
formats
::
parse
::
To
<SpanEvent>);
50
51
void
WriteToStream(
const
SpanEvent& span_event,
formats
::
json
::StringBuilder& sw);
52
53
}
// namespace tracing
54
55
USERVER_NAMESPACE_END
userver
tracing
span_event.hpp
Generated on Wed Apr 30 2025 15:55:02 for userver by
Doxygen
1.13.2