Skip to content

Commit 7e6bf70

Browse files
committed
Add interfaces in DTTracer to serialize and deserialize span
Signed-off-by: Emelia Lei <[email protected]>
1 parent d43b473 commit 7e6bf70

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: src/groups/bmq/bmqpi/bmqpi_dttracer.h

+18
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// BDE
3333
#include <bsl_memory.h>
3434
#include <bsl_string_view.h>
35+
#include <bsl_vector.h>
3536

3637
namespace BloombergLP {
3738
namespace bmqpi {
@@ -56,6 +57,23 @@ class DTTracer {
5657
const bsl::shared_ptr<DTSpan>& parent,
5758
const bsl::string_view& operation,
5859
const DTSpan::Baggage& baggage = DTSpan::Baggage()) const = 0;
60+
61+
/// Serialize the underlying context for a specified `DTSpan` and return
62+
/// the bit stream as `out`. Return 0 on success, or a non-zero error code
63+
/// on error.
64+
virtual int serializeSpan(bsl::vector<unsigned char>* out,
65+
const bsl::shared_ptr<DTSpan>& dtSpan) = 0;
66+
67+
/// Deserialize the specified bit stream `in` into a span context.
68+
/// Create a child span and pass into `out` based on the deserialized
69+
/// parent span context, the given `operation`, and an optional key-value
70+
/// tags `baggage`. Return 0 on success, or a non-zero error code on
71+
/// error.
72+
virtual int deserializeAndCreateChildSpan(
73+
bsl::shared_ptr<DTSpan>* out,
74+
const bsl::vector<unsigned char>& in,
75+
const bsl::string_view& operation,
76+
const DTSpan::Baggage& baggage = DTSpan::Baggage()) = 0;
5977
};
6078

6179
} // close package namespace

0 commit comments

Comments
 (0)