diff --git a/README.md b/README.md index b1304752d5..ad7e4f1fe8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The C++ [OpenTelemetry](https://opentelemetry.io/) client. | Metrics | Development paused [1] | N/A | | Logs | Experimental [2] | N/A | -* [1]: The development of the metrics API and SDK has paused due to limited development resources, prioritization of a stable Traces release, and waiting for availability of stable Metrics ( API + SDK ) design from the OpenTelemetry specification. The current implementation can be included in build by setting `ENABLE_METRICS_PREVIEW` preprocessor macro. +* [1]: The development of the metrics API and SDK has paused due to limited development resources, prioritization of a stable Traces release, and waiting for availability of stable Metrics (API + SDK) design from the OpenTelemetry specification. The current implementation can be included in build by setting `ENABLE_METRICS_PREVIEW` preprocessor macro. * [2]: The current Log Signal Implementation is Experimental, and will change as the current OpenTelemetry Log specification matures. The current implementation can be included in build by setting `ENABLE_LOGS_PREVIEW` preprocessor macro. ## OpenTelemetry Specification Compatibility Matrix @@ -55,7 +55,7 @@ of the current project. | macOS 10.15 (Xcode 12.2) | Bazel | | Windows Server 2019 (Visual Studio Enterprise 2019) | CMake, Bazel | -[1]: Bazel build is disabled for GCC 4.8, as GRPC library ( required by OTLP expoter) +[1]: Bazel build is disabled for GCC 4.8, as gRPC library (required by OTLP expoter) doesn't build with this compiler. CMake build won't build OTLP exporter with GCC 4.8. In general, the code shipped from this repository should build on all platforms diff --git a/api/include/opentelemetry/trace/span.h b/api/include/opentelemetry/trace/span.h index be5f5276cd..87b64747cf 100644 --- a/api/include/opentelemetry/trace/span.h +++ b/api/include/opentelemetry/trace/span.h @@ -185,13 +185,5 @@ class Span virtual bool IsRecording() const noexcept = 0; }; -template -nostd::shared_ptr to_span_ptr(TracerType *objPtr, - nostd::string_view name, - const trace::StartSpanOptions &options) -{ - return nostd::shared_ptr{new (std::nothrow) SpanType{*objPtr, name, options}}; -} - } // namespace trace OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/otlp/src/otlp_recordable.cc b/exporters/otlp/src/otlp_recordable.cc index a17419df7e..8562ecc7ae 100644 --- a/exporters/otlp/src/otlp_recordable.cc +++ b/exporters/otlp/src/otlp_recordable.cc @@ -293,7 +293,10 @@ void OtlpRecordable::AddLink(const opentelemetry::trace::SpanContext &span_conte void OtlpRecordable::SetStatus(trace::StatusCode code, nostd::string_view description) noexcept { span_.mutable_status()->set_code(opentelemetry::proto::trace::v1::Status_StatusCode(code)); - span_.mutable_status()->set_message(description.data(), description.size()); + if (code == trace::StatusCode::kError) + { + span_.mutable_status()->set_message(description.data(), description.size()); + } } void OtlpRecordable::SetName(nostd::string_view name) noexcept diff --git a/exporters/otlp/test/otlp_recordable_test.cc b/exporters/otlp/test/otlp_recordable_test.cc index 9d34cd26a4..bc5e76bac0 100644 --- a/exporters/otlp/test/otlp_recordable_test.cc +++ b/exporters/otlp/test/otlp_recordable_test.cc @@ -93,13 +93,21 @@ TEST(OtlpRecordable, SetDuration) TEST(OtlpRecordable, SetStatus) { - OtlpRecordable rec; - trace::StatusCode code(trace::StatusCode::kOk); + OtlpRecordable rec1; + trace::StatusCode code_error(trace::StatusCode::kError); nostd::string_view description = "For test"; - rec.SetStatus(code, description); - - EXPECT_EQ(rec.span().status().code(), opentelemetry::proto::trace::v1::Status_StatusCode(code)); - EXPECT_EQ(rec.span().status().message(), description); + rec1.SetStatus(code_error, description); + + EXPECT_EQ(rec1.span().status().code(), + opentelemetry::proto::trace::v1::Status_StatusCode(code_error)); + EXPECT_EQ(rec1.span().status().message(), description); + + OtlpRecordable rec2; + trace::StatusCode code_ok(trace::StatusCode::kOk); + rec2.SetStatus(code_ok, description); + EXPECT_EQ(rec2.span().status().code(), + opentelemetry::proto::trace::v1::Status_StatusCode(code_ok)); + EXPECT_EQ(rec2.span().status().message(), ""); } TEST(OtlpRecordable, AddEventDefault)