2626
2727namespace cpp2sky {
2828
29- class CurrentSegmentSpan {
29+ class TracingSpan {
3030 public:
31- virtual ~CurrentSegmentSpan () = default ;
31+ virtual ~TracingSpan () = default ;
3232
3333 /* *
3434 * Generate Apache SkyWalking native span object from current segment span.
@@ -180,11 +180,11 @@ class CurrentSegmentSpan {
180180 virtual bool finished () const = 0;
181181};
182182
183- using CurrentSegmentSpanPtr = std::shared_ptr<CurrentSegmentSpan >;
183+ using TracingSpanPtr = std::shared_ptr<TracingSpan >;
184184
185- class SegmentContext {
185+ class TracingContext {
186186 public:
187- virtual ~SegmentContext () = default ;
187+ virtual ~TracingContext () = default ;
188188
189189 /* *
190190 * Get trace ID. This value must be unique globally.
@@ -209,7 +209,7 @@ class SegmentContext {
209209 /* *
210210 * Get spans generated by this segment context.
211211 */
212- virtual const std::list<CurrentSegmentSpanPtr >& spans () const = 0;
212+ virtual const std::list<TracingSpanPtr >& spans () const = 0;
213213
214214 /* *
215215 * Get span context which generated this segment context as parent.
@@ -225,13 +225,12 @@ class SegmentContext {
225225 * Generate a segment span related with this segment context.
226226 * @param parent_span Parent span which is extracted from caller.
227227 */
228- virtual CurrentSegmentSpanPtr createExitSpan (
229- CurrentSegmentSpanPtr parent_span) = 0;
228+ virtual TracingSpanPtr createExitSpan (TracingSpanPtr parent_span) = 0;
230229
231230 /* *
232231 * Generate root segment span, called once per workload.
233232 */
234- virtual CurrentSegmentSpanPtr createEntrySpan () = 0;
233+ virtual TracingSpanPtr createEntrySpan () = 0;
235234
236235 /* *
237236 * Generate sw8 value to send SegmentRef.
@@ -240,7 +239,7 @@ class SegmentContext {
240239 * https://github.com/apache/skywalking-data-collect-protocol/blob/master/language-agent/Tracing.proto#L97-L101
241240 */
242241 virtual std::optional<std::string> createSW8HeaderValue (
243- CurrentSegmentSpanPtr parent, const std::string_view target_address) = 0;
242+ TracingSpanPtr parent, const std::string_view target_address) = 0;
244243 // If you don't specify parent span, stored to current segment, it will be
245244 // selected newest span as parent span.
246245 virtual std::optional<std::string> createSW8HeaderValue (
@@ -267,48 +266,47 @@ class SegmentContext {
267266 virtual bool readyToSend () = 0;
268267};
269268
270- using SegmentContextPtr = std::shared_ptr<SegmentContext >;
269+ using TracingContextPtr = std::shared_ptr<TracingContext >;
271270/* *
272271 * RAII based span creation. It acquired then create new span with required
273272 * properties. The span wiil be closed and set end time when called destructor.
274273 */
275274class StartEntrySpan {
276275 public:
277- StartEntrySpan (SegmentContextPtr segment_context ,
276+ StartEntrySpan (TracingContextPtr tracing_context ,
278277 std::string_view operation_name)
279- : span_(segment_context ->createEntrySpan ()) {
278+ : span_(tracing_context ->createEntrySpan ()) {
280279 span_->startSpan (operation_name.data ());
281280 }
282281
283282 ~StartEntrySpan () {
284- // Span won't be released because the entity is holded by SegmentContext .
283+ // Span won't be released because the entity is holded by TracingContext .
285284 span_->endSpan ();
286285 }
287286
288- CurrentSegmentSpanPtr get () { return span_; }
287+ TracingSpanPtr get () { return span_; }
289288
290289 private:
291- CurrentSegmentSpanPtr span_;
290+ TracingSpanPtr span_;
292291};
293292
294293class StartExitSpan {
295294 public:
296- StartExitSpan (SegmentContextPtr segment_context,
297- CurrentSegmentSpanPtr parent_span,
295+ StartExitSpan (TracingContextPtr tracing_context, TracingSpanPtr parent_span,
298296 std::string_view operation_name)
299- : span_(segment_context ->createExitSpan (parent_span)) {
297+ : span_(tracing_context ->createExitSpan (parent_span)) {
300298 span_->startSpan (operation_name.data ());
301299 }
302300
303301 ~StartExitSpan () {
304- // Span won't be released because the entity is holded by SegmentContext .
302+ // Span won't be released because the entity is holded by TracingContext .
305303 span_->endSpan ();
306304 }
307305
308- CurrentSegmentSpanPtr get () { return span_; }
306+ TracingSpanPtr get () { return span_; }
309307
310308 private:
311- CurrentSegmentSpanPtr span_;
309+ TracingSpanPtr span_;
312310};
313311
314312} // namespace cpp2sky
0 commit comments