Skip to content

Commit

Permalink
No const move for AttributeValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Tax committed Jul 8, 2020
1 parent 65f6639 commit 0e25607
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions api/include/opentelemetry/plugin/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class Span final : public trace::Span
{}

// trace::Span
void SetAttribute(nostd::string_view name, const common::AttributeValue &&value) noexcept override
void SetAttribute(nostd::string_view name, const common::AttributeValue &value) noexcept override
{
span_->SetAttribute(name, std::move(value));
span_->SetAttribute(name, value);
}

void AddEvent(nostd::string_view name) noexcept override { span_->AddEvent(name); }
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class NoopSpan final : public Span
explicit NoopSpan(const std::shared_ptr<Tracer> &tracer) noexcept : tracer_{tracer} {}

void SetAttribute(nostd::string_view /*key*/,
const common::AttributeValue && /*value*/) noexcept override
const common::AttributeValue & /*value*/) noexcept override
{}

void AddEvent(nostd::string_view /*name*/) noexcept override {}
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Span
// Sets an attribute on the Span. If the Span previously contained a mapping for
// the key, the old value is replaced.
virtual void SetAttribute(nostd::string_view key,
const common::AttributeValue &&value) noexcept = 0;
const common::AttributeValue &value) noexcept = 0;

// Adds an event to the Span.
virtual void AddEvent(nostd::string_view name) noexcept = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/plugin/tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Span final : public trace::Span

// opentelemetry::trace::Span
void SetAttribute(nostd::string_view /*name*/,
const common::AttributeValue && /*value*/) noexcept override
const common::AttributeValue & /*value*/) noexcept override
{}

void AddEvent(nostd::string_view /*name*/) noexcept override {}
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void Recordable::SetIds(trace::TraceId trace_id,
}

void Recordable::SetAttribute(nostd::string_view key,
const opentelemetry::common::AttributeValue &&value) noexcept
const opentelemetry::common::AttributeValue &value) noexcept
{
(void)key;
(void)value;
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/recordable.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Recordable final : public sdk::trace::Recordable
trace::SpanId parent_span_id) noexcept override;

void SetAttribute(nostd::string_view key,
const opentelemetry::common::AttributeValue &&value) noexcept override;
const opentelemetry::common::AttributeValue &value) noexcept override;

void AddEvent(nostd::string_view name, core::SystemTimestamp timestamp) noexcept override;

Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/recordable.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Recordable
* @param value the attribute value
*/
virtual void SetAttribute(nostd::string_view key,
const opentelemetry::common::AttributeValue &&value) noexcept = 0;
const opentelemetry::common::AttributeValue &value) noexcept = 0;

/**
* Add an event to a span.
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/span_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class SpanData final : public Recordable
parent_span_id_ = parent_span_id;
}

void SetAttribute(nostd::string_view key, const common::AttributeValue &&value) noexcept override
void SetAttribute(nostd::string_view key, const common::AttributeValue &value) noexcept override
{
attributes_[std::string(key)] = value;
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/trace/span.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Span::Span(std::shared_ptr<Tracer> &&tracer,
recordable_->SetName(name);

attributes.ForEachKeyValue([&](nostd::string_view key, common::AttributeValue value) noexcept {
recordable_->SetAttribute(key, std::move(value));
recordable_->SetAttribute(key, value);
return true;
});

Expand All @@ -70,11 +70,11 @@ Span::~Span()
End();
}

void Span::SetAttribute(nostd::string_view key, const common::AttributeValue &&value) noexcept
void Span::SetAttribute(nostd::string_view key, const common::AttributeValue &value) noexcept
{
std::lock_guard<std::mutex> lock_guard{mu_};

recordable_->SetAttribute(key, std::move(value));
recordable_->SetAttribute(key, value);
}

void Span::AddEvent(nostd::string_view name) noexcept
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/trace/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Span final : public trace_api::Span
~Span() override;

// trace_api::Span
void SetAttribute(nostd::string_view key, const common::AttributeValue &&value) noexcept override;
void SetAttribute(nostd::string_view key, const common::AttributeValue &value) noexcept override;

void AddEvent(nostd::string_view name) noexcept override;

Expand Down

0 comments on commit 0e25607

Please sign in to comment.