From 3db914e50a9b1c53ac6ccbf5900cdf80b2c2d53c Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 2 Sep 2021 21:34:59 -0700 Subject: [PATCH 1/8] add note on experimental semantic conv --- api/include/opentelemetry/trace/semantic_conventions.h | 5 +++++ .../opentelemetry/sdk/resource/semantic_conventions.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index 13c5905783..63f0403051 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/api/include/opentelemetry/trace/semantic_conventions.h @@ -1,6 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// NOTE: +// This implementation is based on the experimental specs for trace semantic convention: +// https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/trace/semantic_conventions +// and MAY will change in future. + #pragma once #include "opentelemetry/common/string_util.h" diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index 693b3e108a..71c3b8abb4 100644 --- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -1,3 +1,11 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// NOTE: +// This implementation is based on the experimental specs for resource semantic convention as here: +// https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/resource/semantic_conventions +// and MAY will change in future. + #pragma once #include From 7c37e8082895b3703b058d2560eaea3d2bf8bf59 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 2 Sep 2021 21:37:19 -0700 Subject: [PATCH 2/8] nit --- api/include/opentelemetry/trace/semantic_conventions.h | 3 ++- sdk/include/opentelemetry/sdk/resource/semantic_conventions.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index 63f0403051..3f38b9010e 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/api/include/opentelemetry/trace/semantic_conventions.h @@ -2,7 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // NOTE: -// This implementation is based on the experimental specs for trace semantic convention: +// This implementation is based on the experimental specs for trace semantic convention as defined +// here: // https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/trace/semantic_conventions // and MAY will change in future. diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index 71c3b8abb4..bb7941ff1b 100644 --- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -2,7 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 // NOTE: -// This implementation is based on the experimental specs for resource semantic convention as here: +// This implementation is based on the experimental specs for resource semantic convention as +// defined here: // https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.0/specification/resource/semantic_conventions // and MAY will change in future. From 6445528536ddfa2c1c182c0406f8fe6a944287bb Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 7 Sep 2021 14:10:25 -0700 Subject: [PATCH 3/8] Document experimental feature in versioning doc --- Versioning.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Versioning.md b/Versioning.md index b95fc77650..63753c1ccd 100644 --- a/Versioning.md +++ b/Versioning.md @@ -65,6 +65,12 @@ Refer to the [ABI Policy](./docs/abi-policy.md) for more details. To summarise: allowed to break existing stable interfaces. Feature flags will be removed once we have a stable implementation for the signal. +* As an expection, small experimental features in otherwise stable signals/components + mayn't necessarily be released under feature flag. These would be flagged as experimental + by adding a `NOTE` in it's header file - either at the beginning of file, or as the comment for + the experimental API methods. As an example, the Semantic Conventions for + trace signal is experimental at the time of the writing, as mentioned [here](https://github.com/lalitb/opentelemetry-cpp/blob/semantic-conv-experimental/api/include/opentelemetry/trace/semantic_conventions.h#L4:L7). + * GitHub releases will be made for all released versions. ## Example Versioning Lifecycle From 650b83fa63b250ba453c9f6a0e9eb3788a1297ce Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 7 Sep 2021 14:12:13 -0700 Subject: [PATCH 4/8] Document experimental feature in versioning doc --- Versioning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Versioning.md b/Versioning.md index 63753c1ccd..f20758db48 100644 --- a/Versioning.md +++ b/Versioning.md @@ -65,7 +65,7 @@ Refer to the [ABI Policy](./docs/abi-policy.md) for more details. To summarise: allowed to break existing stable interfaces. Feature flags will be removed once we have a stable implementation for the signal. -* As an expection, small experimental features in otherwise stable signals/components +* As an exception, small experimental features in otherwise stable signals/components mayn't necessarily be released under feature flag. These would be flagged as experimental by adding a `NOTE` in it's header file - either at the beginning of file, or as the comment for the experimental API methods. As an example, the Semantic Conventions for From f2fe59176148469d8fc6d85b8864c9b3ae36cf83 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 9 Sep 2021 16:47:34 -0700 Subject: [PATCH 5/8] rename experimental headers to experimental-* --- ....h => experimental_semantic_conventions.h} | 0 examples/grpc/CMakeLists.txt | 2 +- examples/grpc/{client.cpp => client.cc} | 24 ++++++++--------- examples/grpc/{server.cpp => server.cc} | 27 ++++++++++--------- examples/http/client.cc | 2 +- examples/http/server.cc | 2 +- exporters/jaeger/src/recordable.cc | 2 +- exporters/zipkin/src/recordable.cc | 2 +- ....h => experimental_semantic_conventions.h} | 0 9 files changed, 31 insertions(+), 30 deletions(-) rename api/include/opentelemetry/trace/{semantic_conventions.h => experimental_semantic_conventions.h} (100%) rename examples/grpc/{client.cpp => client.cc} (80%) rename examples/grpc/{server.cpp => server.cc} (80%) rename sdk/include/opentelemetry/sdk/resource/{semantic_conventions.h => experimental_semantic_conventions.h} (100%) diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/experimental_semantic_conventions.h similarity index 100% rename from api/include/opentelemetry/trace/semantic_conventions.h rename to api/include/opentelemetry/trace/experimental_semantic_conventions.h diff --git a/examples/grpc/CMakeLists.txt b/examples/grpc/CMakeLists.txt index 94d8a11129..3a90f57f71 100644 --- a/examples/grpc/CMakeLists.txt +++ b/examples/grpc/CMakeLists.txt @@ -37,7 +37,7 @@ else() endif() foreach(_target client server) - add_executable(${_target} "${_target}.cpp") + add_executable(${_target} "${_target}.cc") target_link_libraries( ${_target} example_grpc_proto protobuf::libprotobuf gRPC::grpc++ opentelemetry_trace opentelemetry_exporter_ostream_span) diff --git a/examples/grpc/client.cpp b/examples/grpc/client.cc similarity index 80% rename from examples/grpc/client.cpp rename to examples/grpc/client.cc index fc170a7c5b..21149c1958 100644 --- a/examples/grpc/client.cpp +++ b/examples/grpc/client.cc @@ -3,16 +3,16 @@ // modern compilers are unaffected. #include #ifdef BAZEL_BUILD -#include "examples/grpc/protos/messages.grpc.pb.h" +# include "examples/grpc/protos/messages.grpc.pb.h" #else -#include "messages.grpc.pb.h" +# include "messages.grpc.pb.h" #endif -#include "opentelemetry/trace/semantic_conventions.h" -#include "tracer_common.h" #include #include #include +#include "opentelemetry/trace/experimental_semantic_conventions.h" +#include "tracer_common.h" using grpc::Channel; using grpc::ClientContext; @@ -23,7 +23,6 @@ using grpc_example::Greeter; using grpc_example::GreetRequest; using grpc_example::GreetResponse; - namespace { @@ -45,13 +44,14 @@ class GreeterClient options.kind = opentelemetry::trace::SpanKind::kClient; std::string span_name = "GreeterClient/Greet"; - auto span = get_tracer("grpc")->StartSpan(span_name, - {{OTEL_CPP_GET_ATTR(AttrRpcSystem), "grpc"}, - {OTEL_CPP_GET_ATTR(AttrRpcService), "grpc-example.GreetService"}, - {OTEL_CPP_GET_ATTR(AttrRpcMethod), "Greet"}, - {OTEL_CPP_GET_ATTR(AttrNetPeerIp), ip}, - {OTEL_CPP_GET_ATTR(AttrNetPeerPort), port}}, - options); + auto span = get_tracer("grpc")->StartSpan( + span_name, + {{OTEL_CPP_GET_ATTR(AttrRpcSystem), "grpc"}, + {OTEL_CPP_GET_ATTR(AttrRpcService), "grpc-example.GreetService"}, + {OTEL_CPP_GET_ATTR(AttrRpcMethod), "Greet"}, + {OTEL_CPP_GET_ATTR(AttrNetPeerIp), ip}, + {OTEL_CPP_GET_ATTR(AttrNetPeerPort), port}}, + options); auto scope = get_tracer("grpc-client")->WithActiveSpan(span); diff --git a/examples/grpc/server.cpp b/examples/grpc/server.cc similarity index 80% rename from examples/grpc/server.cpp rename to examples/grpc/server.cc index 9ff855c140..c5ee379baf 100644 --- a/examples/grpc/server.cpp +++ b/examples/grpc/server.cc @@ -1,11 +1,11 @@ #ifdef BAZEL_BUILD -#include "examples/grpc/protos/messages.grpc.pb.h" +# include "examples/grpc/protos/messages.grpc.pb.h" #else -#include "messages.grpc.pb.h" +# include "messages.grpc.pb.h" #endif #include "opentelemetry/trace/context.h" -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/trace/experimental_semantic_conventions.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" #include "tracer_common.h" @@ -16,10 +16,10 @@ #include #include +#include #include #include #include -#include using grpc::Server; using grpc::ServerBuilder; @@ -31,7 +31,7 @@ using grpc_example::Greeter; using grpc_example::GreetRequest; using grpc_example::GreetResponse; -using Span = opentelemetry::trace::Span; +using Span = opentelemetry::trace::Span; using SpanContext = opentelemetry::trace::SpanContext; using namespace opentelemetry::trace; @@ -44,7 +44,8 @@ class GreeterServer final : public Greeter::Service const GreetRequest *request, GreetResponse *response) override { - for( auto elem: context->client_metadata()) { + for (auto elem : context->client_metadata()) + { std::cout << "ELEM: " << elem.first << " " << elem.second << "\n"; } @@ -61,13 +62,13 @@ class GreeterServer final : public Greeter::Service options.parent = opentelemetry::trace::GetSpan(new_context)->GetContext(); std::string span_name = "GreeterService/Greet"; - auto span = get_tracer("grpc") - ->StartSpan(span_name, - {{OTEL_CPP_GET_ATTR(AttrRpcSystem), "grpc"}, - {OTEL_CPP_GET_ATTR(AttrRpcService), "GreeterService"}, - {OTEL_CPP_GET_ATTR(AttrRpcMethod), "Greet"}, - {OTEL_CPP_GET_ATTR(AttrRpcGrpcStatusCode), 0}}, - options); + auto span = + get_tracer("grpc")->StartSpan(span_name, + {{OTEL_CPP_GET_ATTR(AttrRpcSystem), "grpc"}, + {OTEL_CPP_GET_ATTR(AttrRpcService), "GreeterService"}, + {OTEL_CPP_GET_ATTR(AttrRpcMethod), "Greet"}, + {OTEL_CPP_GET_ATTR(AttrRpcGrpcStatusCode), 0}}, + options); auto scope = get_tracer("grpc")->WithActiveSpan(span); // Fetch and parse whatever HTTP headers we can from the gRPC request. diff --git a/examples/http/client.cc b/examples/http/client.cc index 77694815a1..99874fa55c 100644 --- a/examples/http/client.cc +++ b/examples/http/client.cc @@ -3,7 +3,7 @@ #include "opentelemetry/ext/http/client/http_client_factory.h" #include "opentelemetry/ext/http/common/url_parser.h" -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/trace/experimental_semantic_conventions.h" #include "tracer_common.h" namespace diff --git a/examples/http/server.cc b/examples/http/server.cc index 7358ee92e1..fd509c8b67 100644 --- a/examples/http/server.cc +++ b/examples/http/server.cc @@ -3,7 +3,7 @@ #include "server.h" #include "opentelemetry/trace/context.h" -#include "opentelemetry/trace/semantic_conventions.h" +#include "opentelemetry/trace/experimental_semantic_conventions.h" #include "tracer_common.h" #include diff --git a/exporters/jaeger/src/recordable.cc b/exporters/jaeger/src/recordable.cc index f0e455923d..0e78ee3d71 100644 --- a/exporters/jaeger/src/recordable.cc +++ b/exporters/jaeger/src/recordable.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "opentelemetry/exporters/jaeger/recordable.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/sdk/resource/experimental_semantic_conventions.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter diff --git a/exporters/zipkin/src/recordable.cc b/exporters/zipkin/src/recordable.cc index 327fc317ca..e9da830348 100644 --- a/exporters/zipkin/src/recordable.cc +++ b/exporters/zipkin/src/recordable.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "opentelemetry/exporters/zipkin/recordable.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/sdk/resource/experimental_semantic_conventions.h" #include #include diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h similarity index 100% rename from sdk/include/opentelemetry/sdk/resource/semantic_conventions.h rename to sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h From 26bff3fe27f0765329a94b508f9a02187298f937 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 9 Sep 2021 16:56:57 -0700 Subject: [PATCH 6/8] review comments --- Versioning.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Versioning.md b/Versioning.md index f20758db48..ece8d41df3 100644 --- a/Versioning.md +++ b/Versioning.md @@ -68,8 +68,9 @@ Refer to the [ABI Policy](./docs/abi-policy.md) for more details. To summarise: * As an exception, small experimental features in otherwise stable signals/components mayn't necessarily be released under feature flag. These would be flagged as experimental by adding a `NOTE` in it's header file - either at the beginning of file, or as the comment for - the experimental API methods. As an example, the Semantic Conventions for - trace signal is experimental at the time of the writing, as mentioned [here](https://github.com/lalitb/opentelemetry-cpp/blob/semantic-conv-experimental/api/include/opentelemetry/trace/semantic_conventions.h#L4:L7). + the experimental API methods. Also, if the complete header is experimental, it would be prefixed + as `experimental_`. As an example, the semantic conventions for + trace signal is experimental at the time of the writing and is within `experimental_semantic_conventions.h` * GitHub releases will be made for all released versions. From 313821591ec1c213bbafcbfd651ee44749541691 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 9 Sep 2021 17:00:49 -0700 Subject: [PATCH 7/8] missing changes --- sdk/src/resource/resource.cc | 2 +- sdk/test/resource/resource_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index bdbbc91b13..930e8e6640 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -3,8 +3,8 @@ #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/resource/experimental_semantic_conventions.h" #include "opentelemetry/sdk/resource/resource_detector.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/sdk/test/resource/resource_test.cc b/sdk/test/resource/resource_test.cc index f426c23fe3..7f00ddaf48 100644 --- a/sdk/test/resource/resource_test.cc +++ b/sdk/test/resource/resource_test.cc @@ -5,8 +5,8 @@ #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/resource/experimental_semantic_conventions.h" #include "opentelemetry/sdk/resource/resource_detector.h" -#include "opentelemetry/sdk/resource/semantic_conventions.h" #include #include From 2aa875593cc15b44b940043567229b3204095f21 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 9 Sep 2021 17:20:37 -0700 Subject: [PATCH 8/8] fix bazel builg --- examples/grpc/BUILD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/grpc/BUILD b/examples/grpc/BUILD index 2ac65c226c..7de7049f36 100644 --- a/examples/grpc/BUILD +++ b/examples/grpc/BUILD @@ -32,7 +32,7 @@ cc_library( cc_binary( name = "client_grpc", srcs = [ - "client.cpp", + "client.cc", ], defines = ["BAZEL_BUILD"], deps = [ @@ -47,7 +47,7 @@ cc_binary( cc_binary( name = "server_grpc", srcs = [ - "server.cpp", + "server.cc", ], defines = ["BAZEL_BUILD"], deps = [