| # Copyright 2023 gRPC authors. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| load("@grpc_python_dependencies//:requirements.bzl", "requirement") | |
| load("@rules_python//python:defs.bzl", "py_library") | |
| load("//bazel:cython_library.bzl", "pyx_library") | |
| package( | |
| default_visibility = ["//visibility:private"], | |
| features = [ | |
| "layering_check", | |
| "parse_headers", | |
| ], | |
| ) | |
| cc_library( | |
| name = "observability", | |
| srcs = [ | |
| "client_call_tracer.cc", | |
| "metadata_exchange.cc", | |
| "observability_util.cc", | |
| "python_observability_context.cc", | |
| "rpc_encoding.cc", | |
| "sampler.cc", | |
| "server_call_tracer.cc", | |
| ], | |
| hdrs = [ | |
| "client_call_tracer.h", | |
| "constants.h", | |
| "metadata_exchange.h", | |
| "observability_util.h", | |
| "python_observability_context.h", | |
| "rpc_encoding.h", | |
| "sampler.h", | |
| "server_call_tracer.h", | |
| ], | |
| # TODO:(rishesh) - Remove this once the layering check for this file is fixed. | |
| features = ["-layering_check"], | |
| includes = ["."], | |
| deps = [ | |
| "//:grpc_base", | |
| "//src/core:grpc_check", | |
| ], | |
| ) | |
| pyx_library( | |
| name = "cyobservability", | |
| srcs = [ | |
| "_cyobservability.pxd", | |
| "_cyobservability.pyx", | |
| ], | |
| deps = [ | |
| ":observability", | |
| "//:call_tracer", | |
| ], | |
| ) | |
| # Since `opentelemetry-api` is non-hermetic, | |
| # pyobservability is for internal use only. | |
| py_library( | |
| name = "_opentelemetry_observability", | |
| srcs = [ | |
| "_open_telemetry_measures.py", | |
| "_open_telemetry_observability.py", | |
| "_open_telemetry_plugin.py", | |
| ], | |
| deps = [ | |
| requirement("opentelemetry-api"), | |
| ], | |
| ) | |
| py_library( | |
| name = "pyobservability", | |
| srcs = [ | |
| "__init__.py", | |
| "_observability.py", | |
| ], | |
| imports = [ | |
| ".", | |
| "../", | |
| ], | |
| srcs_version = "PY3ONLY", | |
| visibility = [ | |
| "//:__subpackages__", | |
| ], | |
| deps = [ | |
| ":_opentelemetry_observability", | |
| ":cyobservability", | |
| ], | |
| ) |