This repository was archived by the owner on Aug 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 25
25
#include < type_traits>
26
26
#include < vector>
27
27
28
+ #include < opentracing/span.h>
29
+
28
30
namespace jaegertracing {
29
31
30
32
class LogRecord {
@@ -45,6 +47,12 @@ class LogRecord {
45
47
{
46
48
}
47
49
50
+ LogRecord (const opentracing::LogRecord & other)
51
+ : _timestamp(other.timestamp),
52
+ _fields (other.fields.begin(), other.fields.end())
53
+ {
54
+ }
55
+
48
56
const Clock::time_point& timestamp () const { return _timestamp; }
49
57
50
58
const std::vector<Tag>& fields () const { return _fields; }
Original file line number Diff line number Diff line change @@ -97,6 +97,10 @@ void Span::FinishWithOptions(
97
97
}
98
98
_duration = finishTimeSteady - _startTimeSteady;
99
99
tracer = _tracer;
100
+
101
+ std::copy (finishSpanOptions.log_records .begin (),
102
+ finishSpanOptions.log_records .end (),
103
+ std::back_inserter (_logs));
100
104
}
101
105
102
106
// Call `reportSpan` even for non-sampled traces.
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ class Tag {
38
38
{
39
39
}
40
40
41
+ template <typename ValueArg>
42
+ Tag (const std::pair<std::string,ValueArg> & tag_pair)
43
+ : _key(tag_pair.first)
44
+ , _value(tag_pair.second)
45
+ {
46
+ }
47
+
41
48
bool operator ==(const Tag& rhs) const
42
49
{
43
50
return _key == rhs._key && _value == rhs._value ;
Original file line number Diff line number Diff line change @@ -179,7 +179,12 @@ TEST(Tracer, testTracer)
179
179
ASSERT_EQ (" test-baggage-item-value" ,
180
180
span->BaggageItem (" test-baggage-item-key" ));
181
181
span->Log ({ { " log-bool" , true } });
182
- span->Finish ();
182
+ opentracing::FinishSpanOptions foptions;
183
+ opentracing::LogRecord lr{};
184
+ lr.fields = { {" options-log" , " yep" } };
185
+ foptions.log_records .push_back (std::move (lr));
186
+ lr.timestamp = opentracing::SystemClock::now ();
187
+ span->FinishWithOptions (foptions);
183
188
ASSERT_GE (Span::SteadyClock::now (),
184
189
span->startTimeSteady () + span->duration ());
185
190
span->SetOperationName (" test-set-operation-after-finish" );
You can’t perform that action at this time.
0 commit comments