Skip to content

Commit 6f2bd2f

Browse files
authored
Merge pull request #45 from lightstep/jmacd/remove_text_proto_carrier
Remove text proto carrier
2 parents e74ebcf + 56a71a0 commit 6f2bd2f

File tree

5 files changed

+3
-87
lines changed

5 files changed

+3
-87
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# by homebrew, see the commands to set PKG_CONFIG_PATH in build.sh.
55

66
AC_PREREQ([2.69])
7-
AC_INIT([lightstep-tracer-cpp], [0.36],
7+
AC_INIT([lightstep-tracer-cpp], [0.37],
88
[https://github.com/lightstep/lightstep-tracer-cpp/issues])
99
LT_INIT([disable-shared])
1010
AM_INIT_AUTOMAKE([1.14 foreign subdir-objects])

src/c++11/impl.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ bool TracerImpl::inject_lightstep_carrier(SpanContext sc, const CarrierWriter& o
177177
(*baggage)[key] = value;
178178
return true;
179179
});
180-
181-
// TODO Remove the text encoding after [...] has upgraded globally.
182-
TextProtoWriter legacy_writer(output);
183-
inject_text_carrier(sc, legacy_writer);
184180
return true;
185181
}
186182

@@ -234,9 +230,6 @@ SpanContext TracerImpl::extract_lightstep_carrier(const CarrierReader& opaque) {
234230

235231
const BinaryCarrier& proto = carrier->data_;
236232
const BasicTracerCarrier& basic = proto.basic_ctx();
237-
if (basic.trace_id() == 0 && basic.span_id() == 0) {
238-
return extract_text_carrier(TextProtoReader(proto));
239-
}
240233

241234
std::shared_ptr<ContextImpl> ctx(new ContextImpl);
242235
ctx->trace_id = basic.trace_id();

src/c++11/lightstep/carrier.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,6 @@ class ProtoWriter : public CarrierWriter {
3333
BinaryCarrier *const output_;
3434
};
3535

36-
// TextProtoReader/Writer handle reading and writing the opentracing
37-
// text carrier representation.
38-
class TextProtoReader : public BasicCarrierReader {
39-
public:
40-
explicit TextProtoReader(const BinaryCarrier& data) : data_(data) { }
41-
42-
void ForeachKey(std::function<void(const std::string& key,
43-
const std::string& value)> f) const override {
44-
for (const auto& c : data_.text_ctx()) {
45-
f(c.key(), c.value());
46-
}
47-
}
48-
49-
private:
50-
const BinaryCarrier& data_;
51-
};
52-
53-
class TextProtoWriter : public BasicCarrierWriter {
54-
public:
55-
explicit TextProtoWriter(BinaryCarrier *output) : output_(output) { }
56-
57-
void Set(const std::string &key, const std::string &value) const override {
58-
TextCarrierPair *kv = output_->add_text_ctx();
59-
kv->set_key(key);
60-
kv->set_value(value);
61-
}
62-
63-
private:
64-
BinaryCarrier *const output_;
65-
};
66-
6736
} // namespace lightstep
6837

6938
#endif // __LIGHTSTEP_CARRIER_H__

test/c++11/carrier_test.cc

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -69,58 +69,12 @@ int main() {
6969
tracer.Extract(lightstep::CarrierFormat::LightStepBinaryCarrier,
7070
lightstep::ProtoReader(binary_orig));
7171

72-
// Test migration using both formats.
73-
lightstep::BinaryCarrier binary_dual1;
74-
if (!tracer.Inject(test1,
75-
lightstep::CarrierFormat::LightStepBinaryCarrier,
76-
lightstep::ProtoWriter(&binary_dual1))) {
77-
throw error("inject failed");
78-
}
79-
lightstep::BinaryCarrier binary_text = binary_dual1;
80-
lightstep::BinaryCarrier binary_basic = binary_dual1;
81-
binary_basic.clear_text_ctx();
82-
binary_text.clear_basic_ctx();
83-
84-
std::string data_orig = binary_orig.SerializeAsString();
85-
std::string data_basic = binary_basic.SerializeAsString();
86-
87-
// TODO Use gUNIT for testing proto equivalence, as proto-encoding
88-
// is not required to be pass an equals test (it's safe here,
89-
// since we use a single baggage item and the protolib always
90-
// encodes in tag order).
91-
if (data_orig != data_basic) {
92-
throw error("proto data mismatch [" + data_orig + "] != [" + data_basic + "]");
93-
}
94-
95-
// Test extraction of the text carrier format.
96-
lightstep::SpanContext test2 =
97-
tracer.Extract(lightstep::CarrierFormat::LightStepBinaryCarrier,
98-
lightstep::ProtoReader(binary_text));
99-
100-
lightstep::BinaryCarrier binary_dual2;
101-
if (!tracer.Inject(test2,
102-
lightstep::CarrierFormat::LightStepBinaryCarrier,
103-
lightstep::ProtoWriter(&binary_dual2))) {
104-
throw error("inject failed");
105-
}
106-
107-
std::string data_dual1 = binary_dual1.SerializeAsString();
108-
std::string data_dual2 = binary_dual2.SerializeAsString();
109-
110-
if (data_dual1 != data_dual2) {
111-
throw error("proto data mismatch [" + data_dual1 + "] != [" + data_dual2 + "]");
112-
}
72+
// Note: Code to test carrier-format migration removed 03/22/2017.
11373

11474
// Test extraction of a well-known input, for validation with other libraries.
11575
const char same_data64[] = "EigJOjioEaYHBgcRNmifUO7/xlgYASISCgdjaGVja2VkEgdiYWdnYWdl";
11676
std::string same_data = base64_decode(same_data64);
11777

118-
// The "same" data was generated in this code, so this test only
119-
// identifies a change of behavior.
120-
if (same_data != data_basic) {
121-
throw error("well-known data mismatch");
122-
}
123-
12478
lightstep::BinaryCarrier same_basic;
12579
same_basic.ParseFromString(same_data);
12680

0 commit comments

Comments
 (0)