ETW Tracer exporter#376
Conversation
Codecov Report
@@ Coverage Diff @@
## master #376 +/- ##
==========================================
+ Coverage 94.36% 94.37% +0.01%
==========================================
Files 189 189
Lines 8410 8410
==========================================
+ Hits 7936 7937 +1
+ Misses 474 473 -1
|
2a8d693 to
a79d56d
Compare
33fa87e to
e33130d
Compare
|
@pyohannes - I resolved your concern re. |
pyohannes
left a comment
There was a problem hiding this comment.
I'm giving this a first review (sorry for chiming in so late in the game). I put some thoughts and questions inline.
Ideally we'd get rid of the (30) TODOs, but I think it's planned to do that after merging this PR, to not prolong the process further.
|
|
||
| /// <summary> | ||
| /// stream::Tracer class that allows to send spans to ETW | ||
| /// </summary> |
There was a problem hiding this comment.
Could we adhere to the established format for doc comments?
There was a problem hiding this comment.
By default, the stub generation in Visual Studio for C++ is set to XML Doc Comments (///). I agree with your suggestion, but I'd like to clean it up in a separate PR, which will have no code changes other than cleaning up the comments from /// to /**.
There was a problem hiding this comment.
Doc strings should be brought in line with existing standards.
| { | ||
| // TODO: support attributes | ||
| UNREFERENCED_PARAMETER(attributes); | ||
| UNREFERENCED_PARAMETER(links); |
There was a problem hiding this comment.
The preferred way to avoid warning for unreferenced parameters is to use then unnamed:
virtual nostd::shared_ptr<trace::Span> StartSpan(
nostd::string_view name,
const common::KeyValueIterable & /*attributes */,
const trace::SpanContextKeyValueIterable & /*links */,
const trace::StartSpanOptions &options = {}) noexcept overrideThere was a problem hiding this comment.
This will be a problem for doxygen: https://stackoverflow.com/questions/55421894/how-do-i-doxygen-document-unnamed-parameters-of-a-function ... Since this module is Windows-specific, I believe UNREFERENCED_PARAMETER would be appropriate, esp. if we want to run doxygen on that code. Support for both parameters (attributes, links) will be added in a separate PR.. Thus, once these would be actually used, we'd safely remove the UNREFERENCED_PARAMETER macro (in a separate PR).
There was a problem hiding this comment.
I get your point.
We follow the pattern with unnamed parameters in other places, because it's true to ISO CPP standards. I also think that in most cases implementations of virtual methods in derived classes don't necessarily need documentation.
| @@ -0,0 +1,7 @@ | |||
| #ifdef _WIN32 | |||
|
|
|||
| # define HAVE_NO_TLD | |||
There was a problem hiding this comment.
Should this be defined here, when we also have it defined in a CMakeLists.txt file? Otherwise this will always override what comes from CMake.
There was a problem hiding this comment.
This is kept for now to keep Bazel build happy. This will be removed once we OSS the TraceLoggingDynamic.h header. Equivalent TLD functionality is available in Go, for example, here: https://godoc.org/github.com/microsoft/go-winio/pkg/etw .. so we will democratize the proper full support of ETW dynamic C++ events and this define will go away. Issue with Bazel is we are trying to avoid conditional compilation to full extent.... Path forward would be to completely eliminate HAVE_NO_TLD feature gate.
…ID, renaming uuid.hpp to uuid.h
|
|
||
| /// <summary> | ||
| /// stream::Tracer class that allows to send spans to ETW | ||
| /// </summary> |
There was a problem hiding this comment.
Doc strings should be brought in line with existing standards.
| /// <summary> | ||
| /// Provider Id (Name or GUID) | ||
| /// </summary> | ||
| std::string provId; |
There was a problem hiding this comment.
Usually for class data members we use lower case with underscores and a trailing underscore. This should be brought in line with existing standards for all occurrences.
https://google.github.io/styleguide/cppguide.html#Variable_Comments
| { | ||
| // TODO: support attributes | ||
| UNREFERENCED_PARAMETER(attributes); | ||
| UNREFERENCED_PARAMETER(links); |
There was a problem hiding this comment.
I get your point.
We follow the pattern with unnamed parameters in other places, because it's true to ISO CPP standards. I also think that in most cases implementations of virtual methods in derived classes don't necessarily need documentation.
| break; | ||
| } | ||
| #pragma warning(pop) | ||
| return nostd::shared_ptr<trace::Tracer>{new (std::nothrow) Tracer(*this, name, evtFmt)}; |
There was a problem hiding this comment.
I also just realized that the tracer name is used as ETW provider name. This is broken, for the same reasons given above.
| } | ||
|
|
||
| /* clang-format off */ | ||
| nlohmann::json jObj = |
There was a problem hiding this comment.
The logic for creating the JSON representation of a span should be refactored into its own method and unit tested.
| int64_t eventKBSize = (eventByteSize + 1024 - 1) / 1024; | ||
| // bool isLargeEvent = eventKBSize >= LargeEventSizeKB; | ||
|
|
||
| // TODO: extract |
There was a problem hiding this comment.
All TODO items need to be fixed.
|
|
||
| EXPECT_NO_THROW(span->AddEvent(eventName, event)); | ||
| EXPECT_NO_THROW(span->End()); | ||
| EXPECT_NO_THROW(tracer->CloseWithMicroseconds(0)); |
There was a problem hiding this comment.
It would be great to have an example application illustrating the usage of this exporter, ideally with some instructions on how to receive ETW events. This would help people to use, test and verify the functionality.
There was a problem hiding this comment.
I will commit the ETW listener (written in C#) to contrib repo. Maybe with example how to use this exporter as forward-channel to C#, that may itself then use OpenTelemetry C# to upload the incoming events.
Thanks for reviewing it @pyohannes - I am merging this PR and @maxgolov agreed to fix them in separate incremental PRs |
…eql-action-3.x Update github/codeql-action action to v3.29.1

The PR is the initial commit for the tracer exporter for ETW from the example written by @maxgolov. Issue #326
This PR adds:
Edit 1 (25/11/2020):
code has been updated as per the specification.
-- cc @maxgolov