# gRPC Bazel BUILD file.
#
# 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(
    "//bazel:grpc_build_system.bzl",
    "grpc_cc_library",
)

licenses(["reciprocal"])

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

grpc_cc_library(
    name = "otel_plugin",
    srcs = [
        "otel_client_filter.cc",
        "otel_plugin.cc",
        "otel_server_call_tracer.cc",
    ],
    hdrs = [
        "key_value_iterable.h",
        "otel_call_tracer.h",
        "otel_client_filter.h",
        "otel_plugin.h",
        "otel_server_call_tracer.h",
        "//:include/grpcpp/ext/otel_plugin.h",
    ],
    external_deps = [
        "absl/base:core_headers",
        "absl/container:flat_hash_set",
        "absl/functional:any_invocable",
        "absl/status",
        "absl/status:statusor",
        "absl/strings",
        "absl/strings:str_format",
        "absl/time",
        "absl/types:optional",
        "absl/types:span",
        "otel/api",
    ],
    language = "c++",
    visibility = ["//:__subpackages__"],
    deps = [
        "//:config",
        "//:gpr",
        "//:gpr_platform",
        "//:grpc++",
        "//:grpc_base",
        "//:grpc_client_channel",
        "//:grpc_public_hdrs",
        "//:legacy_context",
        "//:tcp_tracer",
        "//src/core:arena",
        "//src/core:arena_promise",
        "//src/core:channel_args",
        "//src/core:channel_fwd",
        "//src/core:channel_stack_type",
        "//src/core:context",
        "//src/core:error",
        "//src/core:metadata_batch",
        "//src/core:slice",
        "//src/core:slice_buffer",
    ],
)
