@@ -87,20 +87,27 @@ class SpanImpl final {
87
87
88
88
void SetName (absl::string_view name) LOCKS_EXCLUDED(mu_);
89
89
90
+ void MarkAbandoned () LOCKS_EXCLUDED(mu_);
91
+
90
92
// Returns true on success (if this is the first time the Span has ended) and
91
93
// also marks the end of the Span and sets its end_time_.
92
94
bool End () LOCKS_EXCLUDED(mu_);
93
95
94
- // Returns true if the span has ended.
96
+ // Returns true if the Span has ended.
95
97
bool HasEnded () const LOCKS_EXCLUDED(mu_);
96
98
99
+ // Returns true if the Span is sampled for export. Returns false if the Span
100
+ // was abandoned.
101
+ bool IsSampled () const LOCKS_EXCLUDED(mu_);
102
+
97
103
absl::string_view name () const { return name_; }
98
104
99
105
// Returns the name of the span as a constref string.
100
106
const std::string& name_constref () const { return name_; }
101
107
102
108
// Returns the SpanContext associated with this Span.
103
- SpanContext context () const { return context_; }
109
+ // The trace_options do reflect MarkAbandoned().
110
+ SpanContext context () const LOCKS_EXCLUDED(mu_);
104
111
105
112
SpanId parent_span_id () const { return parent_span_id_; }
106
113
@@ -126,7 +133,7 @@ class SpanImpl final {
126
133
// a root span.
127
134
const SpanId parent_span_id_;
128
135
// TraceId, SpanId, and TraceOptions for the current span.
129
- const SpanContext context_;
136
+ SpanContext context_ GUARDED_BY (mu_) ;
130
137
// Queue of recorded annotations.
131
138
TraceEvents<EventWithTime<exporter::Annotation>> annotations_ GUARDED_BY (mu_);
132
139
// Queue of recorded network events.
@@ -138,6 +145,8 @@ class SpanImpl final {
138
145
AttributeList attributes_ GUARDED_BY (mu_);
139
146
// Marks if the span has ended.
140
147
bool has_ended_ GUARDED_BY (mu_);
148
+ // Marks if the span was abandoned.
149
+ bool is_abandoned_ GUARDED_BY (mu_);
141
150
// True if the parent Span is in a different process.
142
151
const bool remote_parent_;
143
152
};
0 commit comments