userver: userver/tracing/span_event.hpp Source File
Loading...
Searching...
No Matches
span_event.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <chrono>
7#include <string_view>
8#include <unordered_map>
9
12
13USERVER_NAMESPACE_BEGIN
14
15namespace tracing {
16
21struct 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
27 explicit SpanEvent(std::string_view name);
28
32 SpanEvent(std::string_view name, KeyValue attributes);
33
35 std::string name;
36
38 Timestamp timestamp{};
39
46 KeyValue attributes;
47};
48
50
51void WriteToStream(const SpanEvent& span_event, formats::json::StringBuilder& sw);
52
53} // namespace tracing
54
55USERVER_NAMESPACE_END