Skip to content

Commit

Permalink
Revert "Revert "server: introduce ServerMetricRecorder API and move p…
Browse files Browse the repository at this point in the history
…er-call reporting from a C++ interceptor to a C-core filter (#32106)" (#32272)" (#32279)

* Revert "Revert "server: introduce ServerMetricRecorder API and move per-call reporting from a C++ interceptor to a C-core filter (#32106)" (#32272)"

This reverts commit deb1e25.

* Fix by caching call metric recording stuff in async request

PR #32106 caused msan errors in some tests while de-referencing the
server object where async calls are active after the server is
destroyed. Instead cache the ServerMetricRecorder pointer.

* copyright headers fixed

* clang fixes.
  • Loading branch information
yousukseung committed Feb 3, 2023
1 parent 6943c18 commit 4475e74
Show file tree
Hide file tree
Showing 43 changed files with 1,194 additions and 634 deletions.
37 changes: 21 additions & 16 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ grpc_cc_library(
"grpc_base",
# standard plugins
"census",
"//src/core:grpc_backend_metric_filter",
"//src/core:grpc_deadline_filter",
"//src/core:grpc_client_authority_filter",
"//src/core:grpc_lb_policy_grpclb",
Expand Down Expand Up @@ -1823,6 +1824,7 @@ grpc_cc_library(
"grpc_security_base",
"grpc_service_config_impl",
"grpc_trace",
"grpcpp_backend_metric_recorder",
"grpcpp_call_metric_recorder",
"grpcpp_status",
"iomgr_timer",
Expand All @@ -1838,6 +1840,7 @@ grpc_cc_library(
"//src/core:error",
"//src/core:gpr_atm",
"//src/core:gpr_manual_constructor",
"//src/core:grpc_backend_metric_provider",
"//src/core:grpc_service_config",
"//src/core:grpc_transport_inproc",
"//src/core:json",
Expand Down Expand Up @@ -1890,6 +1893,7 @@ grpc_cc_library(
"grpc_service_config_impl",
"grpc_trace",
"grpc_unsecure",
"grpcpp_backend_metric_recorder",
"grpcpp_call_metric_recorder",
"grpcpp_status",
"iomgr_timer",
Expand All @@ -1901,6 +1905,7 @@ grpc_cc_library(
"//src/core:error",
"//src/core:gpr_atm",
"//src/core:gpr_manual_constructor",
"//src/core:grpc_backend_metric_provider",
"//src/core:grpc_insecure_credentials",
"//src/core:grpc_service_config",
"//src/core:grpc_transport_inproc",
Expand Down Expand Up @@ -1978,45 +1983,42 @@ grpc_cc_library(

grpc_cc_library(
name = "grpcpp_call_metric_recorder",
srcs = [
"src/cpp/server/orca/call_metric_recorder.cc",
],
external_deps = [
"absl/strings",
"absl/types:optional",
"upb_lib",
],
language = "c++",
public_hdrs = [
"include/grpcpp/ext/call_metric_recorder.h",
],
visibility = ["@grpc:public"],
deps = [
"grpc++_public_hdrs",
"xds_orca_upb",
"//src/core:arena",
"//src/core:grpc_backend_metric_data",
],
deps = ["grpc++_public_hdrs"],
)

grpc_cc_library(
name = "grpcpp_orca_interceptor",
name = "grpcpp_backend_metric_recorder",
srcs = [
"src/cpp/server/orca/orca_interceptor.cc",
"src/cpp/server/backend_metric_recorder.cc",
],
hdrs = [
"src/cpp/server/orca/orca_interceptor.h",
"src/cpp/server/backend_metric_recorder.h",
],
external_deps = [
"absl/base:core_headers",
"absl/strings",
"absl/types:optional",
],
language = "c++",
public_hdrs = [
"include/grpcpp/ext/server_metric_recorder.h",
],
visibility = ["@grpc:public"],
deps = [
"grpc++",
"grpc_base",
"gpr",
"grpc++_public_hdrs",
"grpc_trace",
"grpcpp_call_metric_recorder",
"//src/core:grpc_backend_metric_data",
"//src/core:grpc_backend_metric_provider",
],
)

Expand All @@ -2027,6 +2029,7 @@ grpc_cc_library(
],
external_deps = [
"absl/base:core_headers",
"absl/strings",
"absl/time",
"absl/types:optional",
"upb_lib",
Expand All @@ -2042,11 +2045,13 @@ grpc_cc_library(
"gpr",
"grpc++",
"grpc_base",
"grpcpp_backend_metric_recorder",
"protobuf_duration_upb",
"ref_counted_ptr",
"xds_orca_service_upb",
"xds_orca_upb",
"//src/core:default_event_engine",
"//src/core:grpc_backend_metric_data",
"//src/core:ref_counted",
"//src/core:time",
],
Expand Down
33 changes: 12 additions & 21 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4475e74

Please sign in to comment.