Skip to content

Commit

Permalink
Merge branch 'main' into baggage-context-api
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Aug 30, 2021
2 parents 5d13683 + 4ae969b commit 19600ca
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions api/include/opentelemetry/trace/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,5 @@ class Span
virtual bool IsRecording() const noexcept = 0;
};

template <class SpanType, class TracerType>
nostd::shared_ptr<trace::Span> to_span_ptr(TracerType *objPtr,
nostd::string_view name,
const trace::StartSpanOptions &options)
{
return nostd::shared_ptr<trace::Span>{new (std::nothrow) SpanType{*objPtr, name, options}};
}

} // namespace trace
OPENTELEMETRY_END_NAMESPACE
5 changes: 4 additions & 1 deletion exporters/otlp/src/otlp_recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions exporters/otlp/test/otlp_recordable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 19600ca

Please sign in to comment.