Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opencensus/trace/internal/running_span_store_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ RunningSpanStore::Summary RunningSpanStoreImpl::GetSummary() const {
RunningSpanStore::Summary summary;
absl::MutexLock l(&mu_);
for (const auto& addr_span : spans_) {
const std::string& name = addr_span.second->name_constref();
const std::string name = addr_span.second->name();
auto it = summary.per_span_name_summary.find(name);
if (it != summary.per_span_name_summary.end()) {
it->second.num_running_spans++;
Expand Down
5 changes: 5 additions & 0 deletions opencensus/trace/internal/span_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ bool SpanImpl::HasEnded() const {
return has_ended_;
}

std::string SpanImpl::name() const {
absl::MutexLock l(&mu_);
return name_;
}

exporter::SpanData SpanImpl::ToSpanData() const {
absl::MutexLock l(&mu_);
// Make a deep copy of attributes.
Expand Down
7 changes: 3 additions & 4 deletions opencensus/trace/internal/span_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ class SpanImpl final {
// Returns true if the span has ended.
bool HasEnded() const LOCKS_EXCLUDED(mu_);

absl::string_view name() const { return name_; }

// Returns the name of the span as a constref string.
const std::string& name_constref() const { return name_; }
// Returns a copy of the current name of the Span, since SetName can be used
// to change it.
std::string name() const LOCKS_EXCLUDED(mu_);

// Returns the SpanContext associated with this Span.
SpanContext context() const { return context_; }
Expand Down
2 changes: 1 addition & 1 deletion opencensus/trace/internal/span_options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SpanTestPeer {
return span->span_impl_for_test()->status_;
}

static absl::string_view GetName(Span* span) {
static std::string GetName(Span* span) {
return span->span_impl_for_test()->name();
}

Expand Down
2 changes: 1 addition & 1 deletion tools/travis/build_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export BAZEL_OPTIONS="$BAZEL_OPTIONS --experimental_ui_actions_shown=1"

# Enable thread safety analysis (only works with clang).
if [[ "$TRAVIS_COMPILER" = "clang" ]]; then
export BAZEL_OPTIONS="$BAZEL_OPTIONS --copt=-Werror=thread-safety"
export BAZEL_OPTIONS="$BAZEL_OPTIONS --copt=-Werror=thread-safety --copt=-Werror=thread-safety-reference"
fi

export BAZEL_VERSION="0.24.1"
Expand Down