This repository was archived by the owner on Jul 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
opencensus/trace/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ RunningSpanStore::Summary RunningSpanStoreImpl::GetSummary() const {
6767 RunningSpanStore::Summary summary;
6868 absl::MutexLock l (&mu_);
6969 for (const auto & addr_span : spans_) {
70- const std::string& name = addr_span.second ->name_constref ();
70+ const std::string name = addr_span.second ->name ();
7171 auto it = summary.per_span_name_summary .find (name);
7272 if (it != summary.per_span_name_summary .end ()) {
7373 it->second .num_running_spans ++;
Original file line number Diff line number Diff line change @@ -161,6 +161,11 @@ bool SpanImpl::HasEnded() const {
161161 return has_ended_;
162162}
163163
164+ std::string SpanImpl::name () const {
165+ absl::MutexLock l (&mu_);
166+ return name_;
167+ }
168+
164169exporter::SpanData SpanImpl::ToSpanData () const {
165170 absl::MutexLock l (&mu_);
166171 // Make a deep copy of attributes.
Original file line number Diff line number Diff line change @@ -94,10 +94,9 @@ class SpanImpl final {
9494 // Returns true if the span has ended.
9595 bool HasEnded () const LOCKS_EXCLUDED(mu_);
9696
97- absl::string_view name () const { return name_; }
98-
99- // Returns the name of the span as a constref string.
100- const std::string& name_constref () const { return name_; }
97+ // Returns a copy of the current name of the Span, since SetName can be used
98+ // to change it.
99+ std::string name () const LOCKS_EXCLUDED(mu_);
101100
102101 // Returns the SpanContext associated with this Span.
103102 SpanContext context () const { return context_; }
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class SpanTestPeer {
4141 return span->span_impl_for_test ()->status_ ;
4242 }
4343
44- static absl::string_view GetName (Span* span) {
44+ static std::string GetName (Span* span) {
4545 return span->span_impl_for_test ()->name ();
4646 }
4747
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export BAZEL_OPTIONS="$BAZEL_OPTIONS --experimental_ui_actions_shown=1"
2424
2525# Enable thread safety analysis (only works with clang).
2626if [[ " $TRAVIS_COMPILER " = " clang" ]]; then
27- export BAZEL_OPTIONS=" $BAZEL_OPTIONS --copt=-Werror=thread-safety"
27+ export BAZEL_OPTIONS=" $BAZEL_OPTIONS --copt=-Werror=thread-safety --copt=-Werror=thread-safety-reference "
2828fi
2929
3030export BAZEL_VERSION=" 0.24.1"
You can’t perform that action at this time.
0 commit comments