diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index c5ea46aa1c..2334ced67b 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/api/include/opentelemetry/trace/semantic_conventions.h @@ -11,6 +11,18 @@ #pragma once #include "opentelemetry/version.h" +/* + * Special considerations for FaasDocumentOperationValues::DELETE. + * + * The winnt.h header file is known to define a DELETE symbol, + * which collides with FaasDocumentOperationValues::DELETE. + */ +#ifdef _WIN32 +# ifdef DELETE +# pragma message(__FILE__ ": removing define on DELETE") +# undef DELETE +# endif +#endif OPENTELEMETRY_BEGIN_NAMESPACE namespace trace diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index 48fc0ba0b2..9410c72eb6 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -35,6 +35,7 @@ docker run --rm \ -f /source code \ --template /templates/SemanticAttributes.h.j2 \ --output /output/semantic_conventions.h \ + -Dsemconv=trace \ -Dclass=SemanticConventions \ -DschemaUrl=$SCHEMA_URL \ -Dnamespace_open="namespace trace {" \ @@ -48,6 +49,7 @@ docker run --rm \ -f /source code \ --template /templates/SemanticAttributes.h.j2 \ --output /output/semantic_conventions.h \ + -Dsemconv=resource \ -Dclass=SemanticConventions \ -DschemaUrl=$SCHEMA_URL \ -Dnamespace_open="namespace sdk { namespace resource {" \ diff --git a/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 b/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 index 20da3cd659..c1bdd4afb4 100644 --- a/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 +++ b/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 @@ -41,6 +41,21 @@ #include "opentelemetry/version.h" +{%- if semconv == "trace" %} +/* + * Special considerations for FaasDocumentOperationValues::DELETE. + * + * The winnt.h header file is known to define a DELETE symbol, + * which collides with FaasDocumentOperationValues::DELETE. + */ +#ifdef _WIN32 +# ifdef DELETE +# pragma message(__FILE__ ": removing define on DELETE") +# undef DELETE +# endif +#endif +{% endif %} + OPENTELEMETRY_BEGIN_NAMESPACE {{namespace_open}} diff --git a/examples/grpc/client.cc b/examples/grpc/client.cc index 7e8034a51d..ea7c5053f9 100644 --- a/examples/grpc/client.cc +++ b/examples/grpc/client.cc @@ -11,18 +11,9 @@ #include #include #include -#include "tracer_common.h" - -#ifdef _WIN32 -# ifdef DELETE -// winnt.h defines DELETE -// Causes a build error with FaasDocumentOperationValues::DELETE -# pragma message(__FILE__ ": removing define on DELETE") -# undef DELETE -# endif -#endif #include "opentelemetry/trace/semantic_conventions.h" +#include "tracer_common.h" using grpc::Channel; using grpc::ClientContext; diff --git a/examples/grpc/server.cc b/examples/grpc/server.cc index 3e8c9c61e7..ee96edac4e 100644 --- a/examples/grpc/server.cc +++ b/examples/grpc/server.cc @@ -5,6 +5,7 @@ #endif #include "opentelemetry/trace/context.h" +#include "opentelemetry/trace/semantic_conventions.h" #include "opentelemetry/trace/span_context_kv_iterable_view.h" #include "tracer_common.h" @@ -20,17 +21,6 @@ #include #include -#ifdef _WIN32 -# ifdef DELETE -// winnt.h defines DELETE -// Causes a build error with FaasDocumentOperationValues::DELETE -# pragma message(__FILE__ ": removing define on DELETE") -# undef DELETE -# endif -#endif - -#include "opentelemetry/trace/semantic_conventions.h" - using grpc::Server; using grpc::ServerBuilder; using grpc::ServerContext; diff --git a/examples/http/client.cc b/examples/http/client.cc index 016d9b4f80..18763c241f 100644 --- a/examples/http/client.cc +++ b/examples/http/client.cc @@ -3,18 +3,8 @@ #include "opentelemetry/ext/http/client/http_client_factory.h" #include "opentelemetry/ext/http/common/url_parser.h" -#include "tracer_common.h" - -#ifdef _WIN32 -# ifdef DELETE -// winnt.h defines DELETE -// Causes a build error with FaasDocumentOperationValues::DELETE -# pragma message(__FILE__ ": removing define on DELETE") -# undef DELETE -# endif -#endif - #include "opentelemetry/trace/semantic_conventions.h" +#include "tracer_common.h" namespace { diff --git a/examples/http/server.cc b/examples/http/server.cc index 06920e2386..cf7e6bba51 100644 --- a/examples/http/server.cc +++ b/examples/http/server.cc @@ -3,23 +3,12 @@ #include "server.h" #include "opentelemetry/trace/context.h" - +#include "opentelemetry/trace/semantic_conventions.h" #include "tracer_common.h" #include #include -#ifdef _WIN32 -# ifdef DELETE -// winnt.h defines DELETE -// Causes a build error with FaasDocumentOperationValues::DELETE -# pragma message(__FILE__ ": removing define on DELETE") -# undef DELETE -# endif -#endif - -#include "opentelemetry/trace/semantic_conventions.h" - namespace {