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 |
I agree we should rename OtlpExporter into OtlpGrpcExporter. We are not GA yet, so breaking changes are expected, and should be acceptable. |
lalitb
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution :)
| /** | ||
| * Create an OtlpHttpExporter using the given options. | ||
| */ | ||
| OtlpHttpExporter(const OtlpHttpExporterOptions &options); |
There was a problem hiding this comment.
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.
My negligence. I will add explicit later and add some tests.
| strip_prefix = "grpc-1.33.2", | ||
| 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.
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
There was a problem hiding this comment.
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.
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 frameworkI hope that one works with Visual Studio 2015 Update 2 and above.
There was a problem hiding this comment.
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 ofconstinitentity 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.
| 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.
nit: 2 dots at the end of line 47.
| @@ -1,4 +1,4 @@ | |||
| if(WITH_OTLP) | |||
| if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP) | |||
There was a problem hiding this comment.
Do we really need that level of granularity, can one flag build both?
There was a problem hiding this comment.
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.
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 |
lalitb
left a comment
There was a problem hiding this comment.
LGTM. Thanks for adding the tests.
Signed-off-by: owent <admin@owent.net>
…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 <admin@owent.net>
Signed-off-by: owent <admin@owent.net>
Signed-off-by: owent <admin@owent.net>
Signed-off-by: owent <admin@owent.net>
Signed-off-by: owent <admin@owent.net>
Signed-off-by: owent <admin@owent.net>
Signed-off-by: owent admin@owent.net
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.mdupdated for non-trivial changes