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

Add OTLP Metric Exporter Factory and OtlpGrpcClient #1606

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Increment the:
## [Unreleased]

* [BUILD] Upgrade opentelemetry-proto to v0.19.0 [#1579](https://github.com/open-telemetry/opentelemetry-cpp/pull/1579)
* [METRICS EXPORTER] Add `OtlpGrpcMetricExporterFactory` and `OtlpHttpMetricExporterFactory`.
[#1606](https://github.com/open-telemetry/opentelemetry-cpp/pull/1606)
* [METRICS EXPORTER] Add `OtlpGrpcClient` [#1606](https://github.com/open-telemetry/opentelemetry-cpp/pull/1606)

## [1.6.0] 2022-08-15

Expand Down
2 changes: 2 additions & 0 deletions cmake/opentelemetry-cpp-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# opentelemetry-cpp::metrics - Imported target of opentelemetry-cpp::metrics
# opentelemetry-cpp::logs - Imported target of opentelemetry-cpp::logs
# opentelemetry-cpp::in_memory_span_exporter - Imported target of opentelemetry-cpp::in_memory_span_exporter
# opentelemetry-cpp::otlp_grpc_client - Imported target of opentelemetry-cpp::otlp_grpc_client
# opentelemetry-cpp::otlp_recordable - Imported target of opentelemetry-cpp::otlp_recordable
# opentelemetry-cpp::otlp_grpc_exporter - Imported target of opentelemetry-cpp::otlp_grpc_exporter
# opentelemetry-cpp::otlp_grpc_log_exporter - Imported target of opentelemetry-cpp::otlp_grpc_log_exporter
Expand Down Expand Up @@ -85,6 +86,7 @@ set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS
logs
in_memory_span_exporter
otlp_recordable
otlp_grpc_client
otlp_grpc_exporter
otlp_grpc_log_exporter
otlp_grpc_metrics_exporter
Expand Down
5 changes: 2 additions & 3 deletions examples/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(WITH_OTLP_GRPC)
add_executable(example_otlp_grpc grpc_main.cc)
target_link_libraries(
example_otlp_grpc ${CMAKE_THREAD_LIBS_INIT} common_foo_library
opentelemetry_trace opentelemetry_exporter_otlp_grpc gRPC::grpc++)
opentelemetry_trace opentelemetry_exporter_otlp_grpc)
if(WITH_LOGS_PREVIEW)
add_executable(example_otlp_grpc_log grpc_log_main.cc)
target_link_libraries(
Expand All @@ -16,8 +16,7 @@ if(WITH_OTLP_GRPC)
opentelemetry_trace
opentelemetry_logs
opentelemetry_exporter_otlp_grpc
opentelemetry_exporter_otlp_grpc_log
gRPC::grpc++)
opentelemetry_exporter_otlp_grpc_log)
endif()
endif()

Expand Down
138 changes: 114 additions & 24 deletions exporters/otlp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ cc_library(
],
)

cc_library(
name = "otlp_grpc_client",
srcs = [
"src/otlp_grpc_client.cc",
],
hdrs = [
"include/opentelemetry/exporters/otlp/otlp_environment.h",
"include/opentelemetry/exporters/otlp/otlp_grpc_client.h",
"include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h",
"include/opentelemetry/exporters/otlp/protobuf_include_prefix.h",
"include/opentelemetry/exporters/otlp/protobuf_include_suffix.h",
],
strip_include_prefix = "include",
tags = [
"otlp",
"otlp_grpc",
],
deps = [
"//ext:headers",
"//sdk/src/common:global_log_handler",
"@com_github_grpc_grpc//:grpc++",
"@com_github_opentelemetry_proto//:common_proto_cc",
],
)

cc_library(
name = "otlp_grpc_exporter",
srcs = [
Expand All @@ -67,12 +92,12 @@ cc_library(
],
deps = [
":otlp_recordable",
":otlp_grpc_client",
"//ext:headers",
"//sdk/src/trace",

# For gRPC
"@com_github_opentelemetry_proto//:trace_service_grpc_cc",
"@com_github_grpc_grpc//:grpc++",
],
)

Expand Down Expand Up @@ -141,40 +166,47 @@ cc_library(
)

cc_library(
name = "otlp_http_log_exporter",
name = "otlp_grpc_metric_exporter",
srcs = [
"src/otlp_http_log_exporter.cc",
"src/otlp_http_log_exporter_factory.cc",
"src/otlp_grpc_metric_exporter.cc",
"src/otlp_grpc_metric_exporter_factory.cc",
],
hdrs = [
"include/opentelemetry/exporters/otlp/otlp_environment.h",
"include/opentelemetry/exporters/otlp/otlp_http_log_exporter.h",
"include/opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h",
"include/opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h",
"include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h",
"include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h",
"include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h",
"include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h",
"include/opentelemetry/exporters/otlp/protobuf_include_prefix.h",
"include/opentelemetry/exporters/otlp/protobuf_include_suffix.h",
],
strip_include_prefix = "include",
tags = [
"otlp",
"otlp_http_log",
"otlp_grpc_metric",
],
deps = [
":otlp_http_client",
":otlp_recordable",
"//sdk/src/logs",
"@com_github_opentelemetry_proto//:logs_service_proto_cc",
":otlp_grpc_client",
"//ext:headers",
"//sdk/src/metrics",

# For gRPC
"@com_github_opentelemetry_proto//:metrics_service_grpc_cc",
],
)

cc_library(
name = "otlp_http_metric_exporter",
srcs = [
"src/otlp_http_metric_exporter.cc",
"src/otlp_http_metric_exporter_factory.cc",
],
hdrs = [
"include/opentelemetry/exporters/otlp/otlp_environment.h",
"include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h",
"include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h",
"include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h",
"include/opentelemetry/exporters/otlp/protobuf_include_prefix.h",
"include/opentelemetry/exporters/otlp/protobuf_include_suffix.h",
],
Expand All @@ -191,6 +223,33 @@ cc_library(
],
)

cc_library(
name = "otlp_http_log_exporter",
srcs = [
"src/otlp_http_log_exporter.cc",
"src/otlp_http_log_exporter_factory.cc",
],
hdrs = [
"include/opentelemetry/exporters/otlp/otlp_environment.h",
"include/opentelemetry/exporters/otlp/otlp_http_log_exporter.h",
"include/opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h",
"include/opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h",
"include/opentelemetry/exporters/otlp/protobuf_include_prefix.h",
"include/opentelemetry/exporters/otlp/protobuf_include_suffix.h",
],
strip_include_prefix = "include",
tags = [
"otlp",
"otlp_http_log",
],
deps = [
":otlp_http_client",
":otlp_recordable",
"//sdk/src/logs",
"@com_github_opentelemetry_proto//:logs_service_proto_cc",
],
)

cc_library(
name = "otlp_grpc_log_exporter",
srcs = [
Expand All @@ -212,12 +271,12 @@ cc_library(
],
deps = [
":otlp_recordable",
":otlp_grpc_client",
"//ext:headers",
"//sdk/src/logs",
"@com_github_opentelemetry_proto//:logs_service_proto_cc",
# For gRPC
"@com_github_opentelemetry_proto//:logs_service_grpc_cc",
"@com_github_grpc_grpc//:grpc++",
],
)

Expand Down Expand Up @@ -346,24 +405,24 @@ cc_test(
)

cc_test(
name = "otlp_http_metric_exporter_test",
srcs = ["test/otlp_http_metric_exporter_test.cc"],
name = "otlp_grpc_log_exporter_test",
srcs = ["test/otlp_grpc_log_exporter_test.cc"],
tags = [
"otlp",
"otlp_http_metric",
"otlp_grpc_log",
"test",
],
deps = [
":otlp_http_metric_exporter",
":otlp_grpc_log_exporter",
"//api",
"//ext/src/http/client/nosend:http_client_nosend",
"//sdk/src/logs",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "otlp_grpc_log_exporter_test",
srcs = ["test/otlp_grpc_log_exporter_test.cc"],
name = "otlp_grpc_log_exporter_factory_test",
srcs = ["test/otlp_grpc_log_exporter_factory_test.cc"],
tags = [
"otlp",
"otlp_grpc_log",
Expand All @@ -378,17 +437,48 @@ cc_test(
)

cc_test(
name = "otlp_grpc_log_exporter_factory_test",
srcs = ["test/otlp_grpc_log_exporter_factory_test.cc"],
name = "otlp_grpc_metric_exporter_factory_test",
srcs = ["test/otlp_grpc_metric_exporter_factory_test.cc"],
tags = [
"otlp",
"otlp_grpc_log",
"otlp_grpc_metric",
"test",
],
deps = [
":otlp_grpc_log_exporter",
":otlp_grpc_metric_exporter",
"//api",
"//sdk/src/logs",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "otlp_http_metric_exporter_test",
srcs = ["test/otlp_http_metric_exporter_test.cc"],
tags = [
"otlp",
"otlp_http_metric",
"test",
],
deps = [
":otlp_http_metric_exporter",
"//api",
"//ext/src/http/client/nosend:http_client_nosend",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "otlp_http_metric_exporter_factory_test",
srcs = ["test/otlp_http_metric_exporter_factory_test.cc"],
tags = [
"otlp",
"otlp_http_metric",
"test",
],
deps = [
":otlp_http_metric_exporter",
"//api",
"//ext/src/http/client/nosend:http_client_nosend",
"@com_google_googletest//:gtest_main",
],
)
Expand Down
Loading