Skip to content

Commit d486ee6

Browse files
committed
Add interfaces and tests in DTSpan to finish a span
Signed-off-by: Emelia Lei <[email protected]>
1 parent 68ec278 commit d486ee6

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Diff for: src/groups/bmq/bmqimp/bmqimp_brokersession.t.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -2798,6 +2798,12 @@ class DTTestSpan : public bmqpi::DTSpan {
27982798
{
27992799
return d_operation;
28002800
}
2801+
2802+
int finish() const BSLS_KEYWORD_OVERRIDE
2803+
{
2804+
// NOT IMPLEMENTED
2805+
return 0;
2806+
}
28012807
};
28022808

28032809
class DTTestTracer : public bmqpi::DTTracer {

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

+7
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ class DTSpan {
5656
/// Returns the name of the operation that this `DTSpan` represents.
5757
virtual bsl::string_view operation() const = 0;
5858

59+
/// Mark the end of the `DTSpan`. Only the timing of the first call for a
60+
/// given `DTSpan` will be recorded, and implementations are free to ignore
61+
/// all further calls. A finished Span can not be re-started. If finish()
62+
/// is not directly called, it will be called from the destructor.
63+
/// Return 0 on success, or a non-zero error code on error.
64+
virtual int finish() const = 0;
65+
5966
// =============
6067
// class Baggage
6168
// =============

Diff for: src/groups/bmq/bmqpi/bmqpi_dtspan.t.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ using namespace BloombergLP;
2929
/// A test implementation of the `bmqpi::DTSpan` protocol.
3030
struct DTSpanTestImp : public bsls::ProtocolTestImp<bmqpi::DTSpan> {
3131
bsl::string_view operation() const BSLS_KEYWORD_OVERRIDE;
32+
int finish() const BSLS_KEYWORD_OVERRIDE;
3233
};
3334

3435
// Define one of DTSpanTestImp methods out-of-line, to instruct the compiler to
@@ -38,6 +39,11 @@ bsl::string_view DTSpanTestImp::operation() const
3839
return markDone();
3940
}
4041

42+
int DTSpanTestImp::finish() const
43+
{
44+
return markDone();
45+
};
46+
4147
// ============================================================================
4248
// TESTS
4349
// ============================================================================

0 commit comments

Comments
 (0)