Skip to content

Commit

Permalink
(conan-io#15198) opentelemetry-cpp: option 'with_logs_preview' to ena…
Browse files Browse the repository at this point in the history
…ble experimental Logs

Co-authored-by: Ariel Machado <[email protected]>
  • Loading branch information
2 people authored and sabelka committed Feb 12, 2023
1 parent 7b1fee9 commit 6bfd709
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions recipes/opentelemetry-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ class OpenTelemetryCppConan(ConanFile):
options = {
"fPIC": [True, False],
"shared": [True, False],
"with_logs_preview": [True, False],
}
default_options = {
"fPIC": True,
"shared": False,
"with_logs_preview": False,
}
short_paths = True

Expand Down Expand Up @@ -104,6 +106,8 @@ def generate(self):
tc.variables["WITH_JAEGER"] = True
tc.variables["WITH_OTLP"] = True
tc.variables["WITH_ZIPKIN"] = True
if self.options.with_logs_preview:
tc.variables["WITH_LOGS_PREVIEW"] = True
tc.generate()

tc = CMakeDeps(self)
Expand Down Expand Up @@ -194,6 +198,14 @@ def _otel_libraries(self):
if Version(self.version) >= "1.7.0":
libraries.append("opentelemetry_exporter_otlp_grpc_client")

if self.options.with_logs_preview:
libraries.extend([
"opentelemetry_logs",
"opentelemetry_exporter_ostream_logs",
"opentelemetry_exporter_otlp_grpc_log",
"opentelemetry_exporter_otlp_http_log",
])

if self.settings.os == "Windows":
libraries.extend([
"opentelemetry_exporter_etw",
Expand Down Expand Up @@ -308,5 +320,25 @@ def package_info(self):
"opentelemetry_resources",
])

if self.options.with_logs_preview:
self.cpp_info.components["opentelemetry_logs"].requires.extend([
"opentelemetry_resources",
"opentelemetry_common",
])

self.cpp_info.components["opentelemetry_exporter_ostream_logs"].requires.extend([
"opentelemetry_logs",
])

self.cpp_info.components["opentelemetry_exporter_otlp_grpc_log"].requires.extend([
"opentelemetry_otlp_recordable",
"opentelemetry_exporter_otlp_grpc_client",
])

self.cpp_info.components["opentelemetry_exporter_otlp_http_log"].requires.extend([
"opentelemetry_otlp_recordable",
"opentelemetry_exporter_otlp_http_client",
])

if self.settings.os in ("Linux", "FreeBSD"):
self.cpp_info.components["opentelemetry_common"].system_libs.extend(["pthread"])

0 comments on commit 6bfd709

Please sign in to comment.