-
Notifications
You must be signed in to change notification settings - Fork 438
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
Add OTLP/HTTP+JSON Protocol exporter #810
Conversation
Codecov Report
@@ Coverage Diff @@
## main #810 +/- ##
=======================================
Coverage 95.50% 95.50%
=======================================
Files 156 156
Lines 6619 6619
=======================================
Hits 6321 6321
Misses 298 298 |
exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h
Outdated
Show resolved
Hide resolved
I agree we should rename OtlpExporter into OtlpGrpcExporter. We are not GA yet, so breaking changes are expected, and should be acceptable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the contribution :)
/** | ||
* Create an OtlpHttpExporter using the given options. | ||
*/ | ||
OtlpHttpExporter(const OtlpHttpExporterOptions &options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - can we make this explicit
. I think this is missing for OtlpGrpcExporter
too which also should be modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My negligence. I will add explicit
later and add some tests.
urls = [ | ||
"https://github.com/grpc/grpc/archive/v1.28.0.tar.gz", | ||
"https://github.com/grpc/grpc/archive/v1.33.2.tar.gz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why upgrade this to 1.33? I think 1.34 is used in our CI.
opentelemetry-cpp/ci/setup_grpc.sh
Line 16 in 0f6199f
git clone --depth=1 -b v1.34.0 https://github.com/grpc/grpc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 1.33 is the only version support both bazel 4+ and legacy gcc 4.8.
setup_grpc.sh
is only used when using cmake, not bazel.
I found grpc 1.34 upgrade abseil-cpp to 2020923.2
and it uses something gcc 4.8 do not support.
I submit another PR #666 and try to upgrade gRPC but failed on legacy toolchain. Maybe some one can help to switch the
grpc to old version or just disable OTLP Exporters when using bazel?I'm not familar with bazel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume for Windows, while eventually getting to prebuilt DLL / SDK, we can most likely use whatever recent version of gRPC from vcpkg? Mine right now is 1.37.0
C:\work\opentelemetry-cpp\tools\vcpkg>vcpkg list grpc
grpc:x64-windows 1.37.0#2 An RPC library and framework
I hope that one works with Visual Studio 2015 Update 2 and above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested several toolchains with different versions of gRPC, and here is the result:
- When using bazel to build opentelemetry-cpp
- gRPC 1.33(which upgrade protobuf to 1.34) support bazel 4
- gRPC 1.28-1.32 only support bazel 3
- gRPC 1.28-1.33 support legacy gcc 4.8 while 1.34 or upper (which upgrade abseil to 20200923.X) don't
- When using cmake to build opentelemetry-cpp
- Just like bazel, and the official support of vcpkg is gcc 6+.
- The protobuf (3.15) in the latest release of vcpkg(2021.05.12) do not support the latest MSVC 1929(VS 16.10)
Maybe we need wait for newer version to work with MSVC 1929(VS 16.10) or upper.
Related toopentelemetry::proto::common::v1::_KeyValue_default_instance_
: illegal initialization ofconstinit
entity with a non-constant expression (C++20) #819 Fixes to compile SDK with Visual Studio 2019 Update 16.10 (C++20) #820
Right now, we have legacy gcc 4.8 in CI matrix, so I just update gRPC in bazel to 1.33 for compatiability. Maybe it can be upgraded to newer version in the future and in another PR.
examples/otlp/README.md
Outdated
@@ -42,7 +43,8 @@ docker run --rm -it -p 4317:4317 -v "%cd%/examples/otlp":/cfg otel/opentelemetry | |||
|
|||
Note that the OTLP exporter connects to the Collector at `localhost:4317` by | |||
default. This can be changed with first argument from command-line, for example: | |||
`./example_otlp gateway.docker.internal:4317`. | |||
`./example_otlp_grpc gateway.docker.internal:4317` and | |||
`./example_otlp_http gateway.docker.internal:4317`.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 2 dots at the end of line 47.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -1,4 +1,4 @@ | |||
if(WITH_OTLP) | |||
if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need that level of granularity, can one flag build both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is rare for one build to have both, so 2 flags make sense. Or we could introduce a third flag WITH_OTLP
to include both but then it seems over complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes we want only either WITH_OTLP_GRPC
or WITH_OTLP_HTTP
.
Set WITH_OTLP=ON
will try to turn WITH_OTLP_GRPC
on when grpc is found and turn WITH_OTLP_HTTP
on when both libcurl and nlohmann_json are found in this PR.
The WITH_OTLP
option is just for backward compatibility, and the actually options take effect is WITH_OTLP_GRPC
and WITH_OTLP_HTTP
now.
All jobs done, could you please review the changes again? @maxgolov @ThomsonTan @lalitb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for adding the tests.
Signed-off-by: owent <[email protected]>
…tlp_exporter.cpp` to `OtlpGrpcExporter`, `OtlpGrpcExporterOptions`, `otlp_grpc_exporter.h`, `otlp_grpc_exporter.cpp` + Update gRPC to 1.33.2(which is the first version support bazel 4+ and the last version support gcc 4.8) Signed-off-by: owent <[email protected]>
Signed-off-by: owent <[email protected]>
Signed-off-by: owent <[email protected]>
Signed-off-by: owent <[email protected]>
Signed-off-by: owent <[email protected]>
Signed-off-by: owent <[email protected]>
Signed-off-by: owent [email protected]
Fixes # 803
Changes
Implementation of HTTP(OTLP/HTTP+JSON Protocol) exporter.
This is a uncompleted PR and it's used to discuss the details of API and changes for now. I will add tests and CHANGELOG some time later.Almost finished.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes