Skip to content

Commit 758fd4c

Browse files
authored
[CONFIGURATION] File configuration - bazel build (#3654)
1 parent b0fc083 commit 758fd4c

File tree

9 files changed

+452
-4
lines changed

9 files changed

+452
-4
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_o
1818
bazel_dep(name = "platforms", version = "0.0.11")
1919
bazel_dep(name = "prometheus-cpp", version = "1.3.0", repo_name = "com_github_jupp0r_prometheus_cpp")
2020
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
21+
bazel_dep(name = "rapidyaml", version = "0.9.0")
2122
bazel_dep(name = "rules_proto", version = "7.0.2")
2223
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
2324

ci/do_ci.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,11 @@ EOF
536536
examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null
537537
exit 0
538538
elif [[ "$1" == "bazel.no_bzlmod.test" ]]; then
539-
bazel $BAZEL_STARTUP_OPTIONS build --enable_bzlmod=false $BAZEL_OPTIONS //...
540-
bazel $BAZEL_STARTUP_OPTIONS test --enable_bzlmod=false $BAZEL_TEST_OPTIONS //...
539+
# Rapidyaml 0.9.0 as is does not support bazel,
540+
# modules in bazel central repository required
541+
# to build configuration.
542+
bazel $BAZEL_STARTUP_OPTIONS build --enable_bzlmod=false $BAZEL_OPTIONS -- //... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
543+
bazel $BAZEL_STARTUP_OPTIONS test --enable_bzlmod=false $BAZEL_TEST_OPTIONS -- //... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
541544
exit 0
542545
elif [[ "$1" == "bazel.test" ]]; then
543546
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS $BAZEL_WITH_PREVIEW //...
@@ -564,8 +567,8 @@ elif [[ "$1" == "bazel.noexcept" ]]; then
564567
# there are some exceptions and error handling code from the Prometheus Client
565568
# as well as Opentracing shim (due to some third party code in its Opentracing dependency)
566569
# that make this test always fail. Ignore these packages in the noexcept test here.
567-
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/...
568-
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/...
570+
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
571+
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
569572
exit 0
570573
elif [[ "$1" == "bazel.nortti" ]]; then
571574
# there are some exceptions and error handling code from the Prometheus Client

examples/configuration/BUILD

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cc_binary(
5+
name = "example_yaml",
6+
srcs = glob(["*.cc"]) + glob(["*.h"]),
7+
defines = [
8+
"OTEL_HAVE_OTLP_HTTP",
9+
"OTEL_HAVE_OTLP_GRPC",
10+
"OTEL_HAVE_OTLP_FILE",
11+
"OTEL_HAVE_ZIPKIN",
12+
"OTEL_HAVE_PROMETHEUS",
13+
],
14+
tags = [
15+
"test",
16+
"yaml",
17+
],
18+
deps = [
19+
"//api",
20+
"//examples/common/logs_foo_library:common_logs_foo_library",
21+
"//examples/common/metrics_foo_library:common_metrics_foo_library",
22+
"//exporters/ostream:ostream_log_record_exporter_builder",
23+
"//exporters/ostream:ostream_metric_exporter_builder",
24+
"//exporters/ostream:ostream_span_exporter_builder",
25+
"//exporters/otlp:otlp_file_log_record_exporter_builder",
26+
"//exporters/otlp:otlp_file_metric_exporter_builder",
27+
"//exporters/otlp:otlp_file_span_exporter_builder",
28+
"//exporters/otlp:otlp_grpc_log_record_exporter_builder",
29+
"//exporters/otlp:otlp_grpc_metric_exporter_builder",
30+
"//exporters/otlp:otlp_grpc_span_exporter_builder",
31+
"//exporters/otlp:otlp_http_log_record_exporter_builder",
32+
"//exporters/otlp:otlp_http_metric_exporter_builder",
33+
"//exporters/otlp:otlp_http_span_exporter_builder",
34+
"//exporters/prometheus:prometheus_exporter_builder",
35+
"//exporters/zipkin:zipkin_exporter_builder",
36+
"//sdk:headers",
37+
"//sdk/src/configuration",
38+
"//sdk/src/logs",
39+
"//sdk/src/metrics",
40+
"//sdk/src/trace",
41+
"@com_google_googletest//:gtest_main",
42+
],
43+
)

exporters/ostream/BUILD

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ cc_library(
2121
],
2222
)
2323

24+
cc_library(
25+
name = "ostream_log_record_exporter_builder",
26+
srcs = [
27+
"src/console_log_record_builder.cc",
28+
],
29+
hdrs = [
30+
"include/opentelemetry/exporters/ostream/console_log_record_builder.h",
31+
],
32+
strip_include_prefix = "include",
33+
tags = ["ostream"],
34+
deps = [
35+
":ostream_log_record_exporter",
36+
],
37+
)
38+
2439
cc_test(
2540
name = "ostream_log_test",
2641
srcs = ["test/ostream_log_test.cc"],
@@ -55,6 +70,24 @@ cc_library(
5570
],
5671
)
5772

73+
cc_library(
74+
name = "ostream_metric_exporter_builder",
75+
srcs = [
76+
"src/console_push_metric_builder.cc",
77+
],
78+
hdrs = [
79+
"include/opentelemetry/exporters/ostream/console_push_metric_builder.h",
80+
],
81+
strip_include_prefix = "include",
82+
tags = [
83+
"metrics",
84+
"ostream",
85+
],
86+
deps = [
87+
":ostream_metric_exporter",
88+
],
89+
)
90+
5891
cc_test(
5992
name = "ostream_metric_test",
6093
srcs = ["test/ostream_metric_test.cc"],
@@ -86,6 +119,21 @@ cc_library(
86119
],
87120
)
88121

122+
cc_library(
123+
name = "ostream_span_exporter_builder",
124+
srcs = [
125+
"src/console_span_builder.cc",
126+
],
127+
hdrs = [
128+
"include/opentelemetry/exporters/ostream/console_span_builder.h",
129+
],
130+
strip_include_prefix = "include",
131+
tags = ["ostream"],
132+
deps = [
133+
":ostream_span_exporter",
134+
],
135+
)
136+
89137
cc_library(
90138
name = "ostream_capture",
91139
hdrs = [

0 commit comments

Comments
 (0)