• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("@rules_python//python:defs.bzl", "py_library")
17load("//bazel:cython_library.bzl", "pyx_library")
18
19package(default_visibility = ["//visibility:private"])
20
21cc_library(
22    name = "observability",
23    srcs = [
24        "client_call_tracer.cc",
25        "metadata_exchange.cc",
26        "observability_util.cc",
27        "python_observability_context.cc",
28        "rpc_encoding.cc",
29        "sampler.cc",
30        "server_call_tracer.cc",
31    ],
32    hdrs = [
33        "client_call_tracer.h",
34        "constants.h",
35        "metadata_exchange.h",
36        "observability_util.h",
37        "python_observability_context.h",
38        "rpc_encoding.h",
39        "sampler.h",
40        "server_call_tracer.h",
41    ],
42    includes = ["."],
43    deps = [
44        "//:grpc_base",
45    ],
46)
47
48pyx_library(
49    name = "cyobservability",
50    srcs = [
51        "_cyobservability.pxd",
52        "_cyobservability.pyx",
53    ],
54    deps = [
55        ":observability",
56    ],
57)
58
59# Since `opentelemetry-api` is non-hermetic,
60# pyobservability is for internal use only.
61py_library(
62    name = "_opentelemetry_observability",
63    srcs = [
64        "_open_telemetry_measures.py",
65        "_open_telemetry_observability.py",
66        "_open_telemetry_plugin.py",
67    ],
68    deps = [
69        requirement("opentelemetry-api"),
70    ],
71)
72
73py_library(
74    name = "pyobservability",
75    srcs = [
76        "__init__.py",
77        "_observability.py",
78    ],
79    imports = [
80        ".",
81        "../",
82    ],
83    srcs_version = "PY3ONLY",
84    visibility = [
85        "//:__subpackages__",
86    ],
87    deps = [
88        ":_opentelemetry_observability",
89        ":cyobservability",
90    ],
91)
92