Skip to content

Commit

Permalink
option 'with_logs_preview' to enable experimental Logs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSparc authored Jan 5, 2023
1 parent 579ab46 commit 88c94d0
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 @@ -100,6 +102,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 @@ -190,6 +194,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 @@ -304,5 +316,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 88c94d0

Please sign in to comment.