• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The 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_binary")
17load("@rules_proto//proto:defs.bzl", "proto_library")
18load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
19
20# TODO(xuanwn): Instead of using Bazel build, we should pip install all dependencies
21# once we have a released version of grpcio-csm-observability.
22
23proto_library(
24    name = "helloworld_proto",
25    srcs = ["helloworld.proto"],
26)
27
28py_proto_library(
29    name = "helloworld_py_pb2",
30    deps = [":helloworld_proto"],
31)
32
33py_grpc_library(
34    name = "helloworld_py_pb2_grpc",
35    srcs = [":helloworld_proto"],
36    deps = [":helloworld_py_pb2"],
37)
38
39py_binary(
40    name = "csm_greeter_client",
41    srcs = ["csm_greeter_client.py"],
42    python_version = "PY3",
43    deps = [
44        ":helloworld_py_pb2",
45        ":helloworld_py_pb2_grpc",
46        "//src/python/grpcio/grpc:grpcio",
47        "//src/python/grpcio_csm_observability/grpc_csm_observability:csm_observability",
48        requirement("opentelemetry-exporter-prometheus"),
49    ],
50)
51
52py_binary(
53    name = "csm_greeter_server",
54    srcs = ["csm_greeter_server.py"],
55    python_version = "PY3",
56    deps = [
57        ":helloworld_py_pb2",
58        ":helloworld_py_pb2_grpc",
59        "//src/python/grpcio/grpc:grpcio",
60        "//src/python/grpcio_csm_observability/grpc_csm_observability:csm_observability",
61        requirement("opentelemetry-exporter-prometheus"),
62    ],
63)
64