Skip to content

Commit

Permalink
Copy string_view passed to ETW exporter in PropertyVariant (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Jun 2, 2022
1 parent 9df5c4f commit 93ef013
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/span_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SpanContext final

bool IsRemote() const noexcept { return is_remote_; }

static SpanContext GetInvalid() { return SpanContext(false, false); }
static SpanContext GetInvalid() noexcept { return SpanContext(false, false); }

bool IsSampled() const noexcept { return trace_flags_.IsSampled(); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class PropertyValue : public PropertyVariant
{}

/**
* @brief Convert owning PropertyValue to non-owning common::AttributeValue
* @brief Convert non-owning common::AttributeValue to owning PropertyValue.
* @return
*/
PropertyValue &FromAttributeValue(const common::AttributeValue &v)
Expand Down Expand Up @@ -222,7 +222,8 @@ class PropertyValue : public PropertyVariant
break;
}
case common::AttributeType::kTypeString: {
PropertyVariant::operator=(nostd::string_view(nostd::get<nostd::string_view>(v)).data());
PropertyVariant::operator=
(std::string{nostd::string_view(nostd::get<nostd::string_view>(v)).data()});
break;
}

Expand Down

2 comments on commit 93ef013

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 93ef013 Previous: 9df5c4f Ratio
BM_SpinLockThrashing/1/process_time/real_time 0.7645628834498748 ms/iter 0.16253521934941656 ms/iter 4.70

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 93ef013 Previous: 9df5c4f Ratio
BM_LockFreeBuffer/2 3550361.4738373235 ns/iter 1239094.0189361572 ns/iter 2.87

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.