xref: /aosp_15_r20/external/grpc-grpc/src/python/grpcio_observability/grpc_observability/BUILD.bazel (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1# Copyright 2023 gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@grpc_python_dependencies//:requirements.bzl", "requirement")
16load("//bazel:cython_library.bzl", "pyx_library")
17
18package(default_visibility = ["//visibility:private"])
19
20cc_library(
21    name = "observability",
22    srcs = [
23        "client_call_tracer.cc",
24        "observability_util.cc",
25        "python_census_context.cc",
26        "rpc_encoding.cc",
27        "sampler.cc",
28        "server_call_tracer.cc",
29    ],
30    hdrs = [
31        "client_call_tracer.h",
32        "constants.h",
33        "observability_util.h",
34        "python_census_context.h",
35        "rpc_encoding.h",
36        "sampler.h",
37        "server_call_tracer.h",
38    ],
39    includes = ["."],
40    deps = [
41        "//:grpc_base",
42    ],
43)
44
45pyx_library(
46    name = "cyobservability",
47    srcs = [
48        "_cyobservability.pxd",
49        "_cyobservability.pyx",
50    ],
51    deps = [
52        ":observability",
53    ],
54)
55
56# Since `opentelemetry-sdk` and `opentelemetry-api` are non-hermetic,
57# pyobservability is for internal use only.
58py_library(
59    name = "_opentelemetry_observability",
60    srcs = [
61        "_open_telemetry_measures.py",
62        "_open_telemetry_observability.py",
63        "_open_telemetry_plugin.py",
64    ],
65    deps = [
66        requirement("opentelemetry-sdk"),
67        requirement("opentelemetry-api"),
68    ],
69)
70
71py_library(
72    name = "pyobservability",
73    srcs = [
74        "__init__.py",
75        "_observability.py",
76    ],
77    imports = [
78        ".",
79        "../",
80    ],
81    srcs_version = "PY3ONLY",
82    visibility = [
83        "//:__subpackages__",
84    ],
85    deps = [
86        ":_opentelemetry_observability",
87        ":cyobservability",
88    ],
89)
90