Skip to content
Open
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
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "prometheus-cpp", version = "1.3.0", repo_name = "com_github_jupp0r_prometheus_cpp")
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rapidyaml", version = "0.9.0")
bazel_dep(name = "rules_cc", version = "0.2.9")
bazel_dep(name = "rules_proto", version = "7.0.2")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")

Expand Down
22 changes: 22 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@

workspace(name = "io_opentelemetry_cpp")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "platforms",
sha256 = "3384eb1c30762704fbe38e440204e114154086c8fc8a8c2e3e28441028c019a8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz",
],
)

http_archive(
name = "bazel_features",
sha256 = "adc8ddf121917f197f75c5245dfa8d7b1619f10a1002e25062b093b7957f2798",
strip_prefix = "bazel_features-1.37.0",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.37.0/bazel_features-v1.37.0.tar.gz",
)

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

# Load our direct dependencies.
load("//bazel:repository.bzl", "opentelemetry_cpp_deps")

Expand Down
1 change: 1 addition & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag", "string_flag")
load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

Expand Down
1 change: 1 addition & 0 deletions api/test/baggage/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")

cc_test(
Expand Down
2 changes: 1 addition & 1 deletion api/test/baggage/propagation/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "baggage_propagator_test",
Expand Down
1 change: 1 addition & 0 deletions api/test/common/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")

otel_cc_benchmark(
Expand Down
2 changes: 1 addition & 1 deletion api/test/context/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "context_test",
Expand Down
2 changes: 1 addition & 1 deletion api/test/context/propagation/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "composite_propagator_test",
Expand Down
2 changes: 2 additions & 0 deletions api/test/core/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "timestamp_test",
srcs = [
Expand Down
2 changes: 1 addition & 1 deletion api/test/logs/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "provider_test",
Expand Down
2 changes: 1 addition & 1 deletion api/test/metrics/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "noop_sync_instrument_test",
Expand Down
2 changes: 2 additions & 0 deletions api/test/nostd/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "function_ref_test",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions api/test/plugin/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "dynamic_load_test",
srcs = [
Expand Down
4 changes: 4 additions & 0 deletions api/test/singleton/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

# gcc and clang, assumed to be used on this platform
DEFAULT_NOWIN_COPTS = [
"-fvisibility=default",
Expand Down
1 change: 1 addition & 0 deletions api/test/trace/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")

cc_test(
Expand Down
2 changes: 1 addition & 1 deletion api/test/trace/propagation/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "http_text_format_test",
Expand Down
2 changes: 1 addition & 1 deletion api/test/trace/propagation/detail/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_test(
name = "hex_test",
Expand Down
7 changes: 7 additions & 0 deletions bazel/extra_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@com_github_jupp0r_prometheus_cpp//bazel:repositories.bzl", "prometheus_cpp_repositories")
load("@platforms//host:extension.bzl", "host_platform_repo")
load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")

def opentelemetry_extra_deps():
rules_cc_dependencies()
rules_cc_toolchains()
compatibility_proxy_repo()
prometheus_cpp_repositories()
bazel_skylib_workspace()
host_platform_repo(name = "host_platform")
7 changes: 5 additions & 2 deletions bazel/otel_cc_benchmark.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

def otel_cc_benchmark(name, srcs, deps, tags = [""]):
"""
Creates targets for the benchmark and related targets.
Expand All @@ -22,7 +25,7 @@ def otel_cc_benchmark(name, srcs, deps, tags = [""]):

# This is the benchmark as a binary, it can be run manually, and is used
# to generate the _result below.
native.cc_binary(
cc_binary(
name = name,
srcs = srcs,
deps = deps + ["@com_github_google_benchmark//:benchmark"],
Expand All @@ -42,7 +45,7 @@ def otel_cc_benchmark(name, srcs, deps, tags = [""]):

# This is run as part of "bazel test ..." to smoke-test benchmarks. It's
# meant to complete quickly rather than get accurate results.
native.cc_test(
cc_test(
name = name + "_smoketest",
srcs = srcs,
deps = deps + ["@com_github_google_benchmark//:benchmark"],
Expand Down
13 changes: 10 additions & 3 deletions bazel/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def opentelemetry_cpp_deps():
"""Loads dependencies need to compile the opentelemetry-cpp library."""
maybe(
http_archive,
name = "rules_cc",
sha256 = "ae244f400218f4a12ee81658ff246c0be5cb02c5ca2de5519ed505a6795431e9",
strip_prefix = "rules_cc-0.2.0",
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.2.0/rules_cc-0.2.0.tar.gz",
)

# Google Benchmark library.
# Only needed for benchmarks, not to build the OpenTelemetry library.
Expand Down Expand Up @@ -76,10 +83,10 @@ def opentelemetry_cpp_deps():
maybe(
http_archive,
name = "com_github_grpc_grpc",
sha256 = "f40bde4ce2f31760f65dc49a2f50876f59077026494e67dccf23992548b1b04f",
strip_prefix = "grpc-1.62.0",
sha256 = "eacf07e6354b6a30056b0338027b20c7f5a1da556a674d108cea1b8938d7abec",
strip_prefix = "grpc-1.66.0",
urls = [
"https://github.com/grpc/grpc/archive/refs/tags/v1.62.0.tar.gz",
"https://github.com/grpc/grpc/archive/refs/tags/v1.66.0.tar.gz",
],
)

Expand Down
2 changes: 2 additions & 0 deletions examples/batch/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_simple",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/common/foo_library/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

cc_library(
Expand Down
2 changes: 2 additions & 0 deletions examples/common/logs_foo_library/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

cc_library(
Expand Down
2 changes: 2 additions & 0 deletions examples/common/metrics_foo_library/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

cc_library(
Expand Down
2 changes: 2 additions & 0 deletions examples/configuration/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_yaml",
srcs = glob(["*.cc"]) + glob(["*.h"]),
Expand Down
2 changes: 2 additions & 0 deletions examples/etw_threads/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_etw_threads",
srcs = [
Expand Down
3 changes: 3 additions & 0 deletions examples/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# SPDX-License-Identifier: Apache-2.0

load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

package(default_visibility = ["//visibility:public"])
Expand Down
2 changes: 2 additions & 0 deletions examples/http/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_http_client",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/logs_simple/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_logs_simple",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/metrics_simple/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "metrics_ostream_example",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/multi_processor/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_multi_processor",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/multithreaded/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_multithreaded",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/otlp/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_otlp_grpc",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin/load/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "load_plugin",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin/plugin/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_plugin.so",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/prometheus/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "prometheus_example",
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions examples/simple/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
name = "example_simple",
srcs = [
Expand Down
Loading
Loading