/proc/self/cwd/source/extensions/tracers/zipkin/util.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "source/extensions/tracers/zipkin/util.h" |
2 | | |
3 | | #include <chrono> |
4 | | #include <random> |
5 | | #include <regex> |
6 | | |
7 | | #include "source/common/common/hex.h" |
8 | | #include "source/common/common/utility.h" |
9 | | |
10 | | #include "absl/strings/str_cat.h" |
11 | | #include "absl/strings/str_join.h" |
12 | | |
13 | | namespace Envoy { |
14 | | namespace Extensions { |
15 | | namespace Tracers { |
16 | | namespace Zipkin { |
17 | | |
18 | 0 | uint64_t Util::generateRandom64(TimeSource& time_source) { |
19 | 0 | uint64_t seed = std::chrono::duration_cast<std::chrono::nanoseconds>( |
20 | 0 | time_source.systemTime().time_since_epoch()) |
21 | 0 | .count(); |
22 | 0 | std::mt19937_64 rand_64(seed); |
23 | 0 | return rand_64(); |
24 | 0 | } |
25 | | |
26 | | ProtobufWkt::Value Util::uint64Value(uint64_t value, absl::string_view name, |
27 | 0 | Replacements& replacements) { |
28 | 0 | const std::string string_value = std::to_string(value); |
29 | 0 | replacements.push_back({absl::StrCat("\"", name, "\":\"", string_value, "\""), |
30 | 0 | absl::StrCat("\"", name, "\":", string_value)}); |
31 | 0 | return ValueUtil::stringValue(string_value); |
32 | 0 | } |
33 | | |
34 | | } // namespace Zipkin |
35 | | } // namespace Tracers |
36 | | } // namespace Extensions |
37 | | } // namespace Envoy |