From 172c17ff868559fa36a2f3f81c9cbfb832f9d59a Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 1 Jun 2022 22:31:36 -0700 Subject: [PATCH 1/4] Copy string_view passed to ETW exporter in AttributeValue --- api/include/opentelemetry/trace/span_context.h | 2 +- .../etw/include/opentelemetry/exporters/etw/etw_properties.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/include/opentelemetry/trace/span_context.h b/api/include/opentelemetry/trace/span_context.h index ca13a8df60..e19bb99001 100644 --- a/api/include/opentelemetry/trace/span_context.h +++ b/api/include/opentelemetry/trace/span_context.h @@ -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(); } diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h index 04ad86130f..915dda6575 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h @@ -222,7 +222,7 @@ class PropertyValue : public PropertyVariant break; } case common::AttributeType::kTypeString: { - PropertyVariant::operator=(nostd::string_view(nostd::get(v)).data()); + PropertyVariant::operator=(std::string{nostd::string_view(nostd::get(v)).data()}); break; } From 6b66478d666caa58dfd1ec14133795c6db517cf9 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Thu, 2 Jun 2022 09:00:38 -0700 Subject: [PATCH 2/4] Format new change --- .../etw/include/opentelemetry/exporters/etw/etw_properties.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h index 915dda6575..8f74d01871 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h @@ -222,7 +222,9 @@ class PropertyValue : public PropertyVariant break; } case common::AttributeType::kTypeString: { - PropertyVariant::operator=(std::string{nostd::string_view(nostd::get(v)).data()}); + PropertyVariant::operator= + (std::string{nostd::string_view(nostd::get(v)).data()}); + break; } From 8d6e3614bd354ce3564b4c43647ee558bbb69fe4 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Thu, 2 Jun 2022 09:15:32 -0700 Subject: [PATCH 3/4] Remove extra empty line --- .../etw/include/opentelemetry/exporters/etw/etw_properties.h | 1 - 1 file changed, 1 deletion(-) diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h index 8f74d01871..6291166e75 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h @@ -224,7 +224,6 @@ class PropertyValue : public PropertyVariant case common::AttributeType::kTypeString: { PropertyVariant::operator= (std::string{nostd::string_view(nostd::get(v)).data()}); - break; } From 76eee879124fdc22d42cfa0e535c96f5a8635af2 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Thu, 2 Jun 2022 11:49:16 -0700 Subject: [PATCH 4/4] Fix comment --- .../etw/include/opentelemetry/exporters/etw/etw_properties.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h index 6291166e75..3cf365c8a0 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h @@ -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)