File tree Expand file tree Collapse file tree 6 files changed +35
-2
lines changed Expand file tree Collapse file tree 6 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 1
- EXTRA_DIST = LICENSE lightstep-tracer-common
1
+ EXTRA_DIST = LICENSE lightstep-tracer-common/collector.proto
2
2
3
3
SUBDIRS = src test
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.14 ] ,
7
+ AC_INIT ( [ lightstep-tracer-cpp] , [ 0.15 ] ,
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 @@ -38,6 +38,7 @@ class TracerOptions {
38
38
Attributes tracer_attributes;
39
39
40
40
// Optional: a user-defined guid generator to use.
41
+ // TODO remove this in favor of thread-local PRNGs?
41
42
std::function<uint64_t ()> guid_generator;
42
43
};
43
44
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ typedef std::function<std::unique_ptr<Recorder>(const TracerImpl&)> RecorderFact
119
119
120
120
Tracer NewUserDefinedTransportLightStepTracer (const TracerOptions& topts, RecorderFactory rf);
121
121
122
+ // For use routing ReportRequests via generic gRPC endpoints, use these names:
123
+ const std::string& CollectorServiceFullName ();
124
+ const std::string& CollectorMethodName ();
125
+
122
126
} // namespace lightstep
123
127
124
128
#endif // __LIGHTSTEP_TRACER_H__
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ namespace {
10
10
11
11
std::atomic<ImplPtr*> global_tracer;
12
12
13
+ // Note: These must be kept up-to-date with the collector endpoint
14
+ // gRPC service and method names.
15
+ const char collectorServiceFullName[] = " lightstep.collector.CollectorService" ;
16
+ const char collectorMethodName[] = " Report" ;
17
+
13
18
} // namespace
14
19
15
20
BuiltinCarrierFormat BuiltinCarrierFormat::BinaryCarrier{BuiltinCarrierFormat::Binary};
@@ -76,4 +81,14 @@ ReportBuilder::ReportBuilder(const TracerImpl &impl)
76
81
preamble_.mutable_auth ()->set_access_token (impl.access_token ());
77
82
}
78
83
84
+ const std::string& CollectorServiceFullName () {
85
+ static std::string name = collectorServiceFullName;
86
+ return name;
87
+ }
88
+
89
+ const std::string& CollectorMethodName () {
90
+ static std::string name = collectorMethodName;
91
+ return name;
92
+ }
93
+
79
94
} // namespace lightstep
Original file line number Diff line number Diff line change 1
1
#include < vector>
2
2
#include < iostream>
3
3
#include < mutex>
4
+ #include < sstream>
4
5
5
6
#include " lightstep/tracer.h"
6
7
#include " lightstep/impl.h"
@@ -36,8 +37,20 @@ uint64_t my_guids() {
36
37
return unsafe++;
37
38
}
38
39
40
+ void check_tracer_names () throw(error) {
41
+ // The official value is not exported from gRPC, so hard-code it again:
42
+ const char grpc_path[] = " /lightstep.collector.CollectorService/Report" ;
43
+ std::stringstream assembled;
44
+ assembled << " /" << lightstep::CollectorServiceFullName () << " /" << lightstep::CollectorMethodName ();
45
+ if (assembled.str () != grpc_path) {
46
+ throw error (" Incorrect gRPC service and method names hard-coded" );
47
+ }
48
+ }
49
+
39
50
int main () {
40
51
try {
52
+ check_tracer_names ();
53
+
41
54
lightstep::TracerOptions topts;
42
55
43
56
topts.access_token = " i_am_an_access_token" ;
You can’t perform that action at this time.
0 commit comments