Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fixes to build all with Visual Studio 2015 #840

Merged
merged 7 commits into from
Jun 9, 2021
Merged

Conversation

maxgolov
Copy link
Contributor

@maxgolov maxgolov commented Jun 8, 2021

These are all the changes needed to compile OpenTelemetry C++ SDK with Visual Studio 2015.
I manually tested ad-hoc that the entire SDK works well with all optional component included.
Fixing warnings, errors, and warnings treated as errors.

Fixes #756

Partially addresses #215 , manually tested ad-hoc. No CI yet. CI loop (scripts, no code changes) will be added in #839

Changes

  • CMAKE_VERSION check was not properly working on very OLD cmake lower than 3.3.

  • b3_propagator.h triggers an error about narrowing cast of kTraceIdHexStrLength. Add explicit static cast to size_t.

  • nostd::variant_alternative_t test does not compile in Visual Studio 2015. I suspect we are missing one of the headers. The rest of it works. And it's a lower priority - since we do not use any comparison of variant type in SDK, there should be no decrease in code coverage by disabling that test.

  • ETW exporter: vs2015/C++ has no __has_include feature. And since TraceLoggingDynamic.h is now always available - Microsoft open-sourced it under friendly license, we unconditionally include it. It's the best and standard compact binary protocol we should use on Windows for ETW, that can be easily decoded out-of-proc by .NET listener, for example.

  • ETW exporter: using behavior in C++11 triggers ambiguity when the same class name is being aliased as using vs something else that is imported via using namespace. That doesn't happen on more recent versions of compilers. Explicitly assume that the ETW-specific wrapper classes (Properties,PropertyValue,PropertyValueMap) get imported via using namespace instead of alias, then it all works great.

  • ETW exporter: avoid using std::copy since older compilers were picky about this due to Secure Lifecycle Development process. New compilers are more relaxed. But, unfortunately, we strive to run with zero compliance warnings on old compiler.

  • __cplusplus flag is not supported by old Visual Studio 2015. Add version check to avoid 'unknown flag` warning.

@maxgolov maxgolov requested a review from a team June 8, 2021 20:51
@maxgolov
Copy link
Contributor Author

maxgolov commented Jun 8, 2021

Appears like this test is occasionally tripping:

//exporters/otlp:otlp_grpc_exporter_test                                 FAILED in 0.3s
  /home/runner/.cache/bazel/e6b8d6759295e14b76bc8cb98b604748/execroot/io_opentelemetry_cpp/bazel-out/k8-tsan-fastbuild/testlogs/exporters/otlp/otlp_grpc_exporter_test/test.log

Doesn't appear to be related to my change. Rerunning it.

@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #840 (6f49b95) into main (1060f88) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #840      +/-   ##
==========================================
- Coverage   95.50%   95.50%   -0.00%     
==========================================
  Files         156      156              
  Lines        6619     6614       -5     
==========================================
- Hits         6321     6316       -5     
  Misses        298      298              
Impacted Files Coverage Δ
api/test/nostd/variant_test.cc 100.00% <ø> (ø)
...de/opentelemetry/trace/propagation/b3_propagator.h 96.50% <100.00%> (ø)

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lalitb
Copy link
Member

lalitb commented Jun 9, 2021

Appears like this test is occasionally tripping:

//exporters/otlp:otlp_grpc_exporter_test                                 FAILED in 0.3s
  /home/runner/.cache/bazel/e6b8d6759295e14b76bc8cb98b604748/execroot/io_opentelemetry_cpp/bazel-out/k8-tsan-fastbuild/testlogs/exporters/otlp/otlp_grpc_exporter_test/test.log

Doesn't appear to be related to my change. Rerunning it.

Yes, it's failing frequently now. Need to check if it's coming from any latest merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove std::copy from ETW exporter
3 participants