File tree Expand file tree Collapse file tree 5 files changed +12
-6
lines changed Expand file tree Collapse file tree 5 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 4
4
# by homebrew, see the commands to set PKG_CONFIG_PATH in build.sh.
5
5
6
6
AC_PREREQ ( [ 2.69] )
7
- AC_INIT ( [ lightstep-tracer-cpp] , [ 0.15 ] ,
7
+ AC_INIT ( [ lightstep-tracer-cpp] , [ 0.16 ] ,
8
8
[ https://github.com/lightstep/lightstep-tracer-cpp/issues] )
9
9
LT_INIT([ disable-shared] )
10
10
AM_INIT_AUTOMAKE ( [ 1.14 foreign subdir-objects] )
Original file line number Diff line number Diff line change @@ -53,11 +53,15 @@ TracerImpl::TracerImpl(const TracerOptions& options_in)
53
53
rand_source_ (std::random_device()()),
54
54
tracer_start_time_(Clock::now()) {
55
55
56
+ tracer_id_ = GetOneId ();
57
+
56
58
if (options_.tracer_attributes .find (ComponentNameKey) == options_.tracer_attributes .end ()) {
57
59
options_.tracer_attributes .emplace (std::make_pair (ComponentNameKey, util::program_name ()));
58
60
}
59
- if (options_.tracer_attributes .find (TracerIDKey) == options_.tracer_attributes .end ()) {
60
- options_.tracer_attributes .emplace (std::make_pair (TracerIDKey, uint64ToHex (GetOneId ())));
61
+ // Note: drop the TracerIDKey, this is copied from tracer_id_.
62
+ auto guid_lookup = options_.tracer_attributes .find (TracerIDKey);
63
+ if (guid_lookup != options_.tracer_attributes .end ()) {
64
+ options_.tracer_attributes .erase (guid_lookup);
61
65
}
62
66
63
67
options_.tracer_attributes .emplace (std::make_pair (PlatformNameKey, " c++11" ));
Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ class TracerImpl {
72
72
const std::string& component_name () const { return component_name_; }
73
73
const std::string& access_token () const { return options_.access_token ; }
74
74
75
+ uint64_t tracer_id () const { return tracer_id_; }
76
+
75
77
TimeStamp tracer_start_time () const { return tracer_start_time_; }
76
78
const Attributes& tracer_attributes () const { return options_.tracer_attributes ; }
77
79
@@ -106,6 +108,7 @@ class TracerImpl {
106
108
uint64_t GetOneId ();
107
109
108
110
TracerOptions options_;
111
+ uint64_t tracer_id_;
109
112
std::shared_ptr<Recorder> recorder_;
110
113
111
114
// Protects rand_source_, recorder_.
Original file line number Diff line number Diff line change @@ -74,9 +74,7 @@ ReportBuilder::ReportBuilder(const TracerImpl &impl)
74
74
for (const auto & tt : impl.options ().tracer_attributes ) {
75
75
*tracer->mutable_tags ()->Add () = util::make_kv (tt.first , tt.second );
76
76
77
- if (tt.first == TracerIDKey) {
78
- tracer->set_tracer_id (util::stringToUint64 (tt.second ));
79
- }
77
+ tracer->set_tracer_id (impl.tracer_id ());
80
78
}
81
79
preamble_.mutable_auth ()->set_access_token (impl.access_token ());
82
80
}
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ int main() {
57
57
topts.collector_host = " " ;
58
58
topts.collector_port = 9998 ;
59
59
topts.collector_encryption = " " ;
60
+ topts.tracer_attributes [" lightstep.guid" ] = " invalid" ;
60
61
topts.guid_generator = my_guids;
61
62
62
63
lightstep::Tracer::InitGlobal (NewUserDefinedTransportLightStepTracer (topts, [](const lightstep::TracerImpl& impl) {
You can’t perform that action at this time.
0 commit comments