oob_backend_metric.h
Go to the documentation of this file.
1 //
2 // Copyright 2022 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_OOB_BACKEND_METRIC_H
18 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_OOB_BACKEND_METRIC_H
19 
21 
22 #include <memory>
23 
27 
28 namespace grpc_core {
29 
30 // Interface for LB policies to access out-of-band backend metric data
31 // from a subchannel. The data is reported from via an ORCA stream
32 // established on the subchannel whenever an LB policy registers a
33 // watcher.
34 //
35 // To use this, an LB policy will implement its own subclass of
36 // OobBackendMetricWatcher, which will receive backend metric data as it
37 // is sent by the server. It will then register that watcher with the
38 // subchannel like this:
39 // subchannel->AddDataWatcher(
40 // MakeOobBackendMetricWatcher(
41 // absl::make_unique<MyOobBackendMetricWatcherSubclass>(...)));
42 
44  public:
45  virtual ~OobBackendMetricWatcher() = default;
46 
47  virtual void OnBackendMetricReport(
48  const BackendMetricData& backend_metric_data) = 0;
49 };
50 
51 std::unique_ptr<SubchannelInterface::DataWatcherInterface>
53  std::unique_ptr<OobBackendMetricWatcher> watcher);
54 
55 } // namespace grpc_core
56 
57 #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_OOB_BACKEND_METRIC_H
grpc_core::BackendMetricData
Definition: backend_metric_data.h:31
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::OobBackendMetricWatcher
Definition: oob_backend_metric.h:43
subchannel_interface.h
backend_metric_data.h
grpc_core::MakeOobBackendMetricWatcher
std::unique_ptr< SubchannelInterface::DataWatcherInterface > MakeOobBackendMetricWatcher(Duration report_interval, std::unique_ptr< OobBackendMetricWatcher > watcher)
Definition: oob_backend_metric.cc:402
time.h
grpc_core::OobBackendMetricWatcher::OnBackendMetricReport
virtual void OnBackendMetricReport(const BackendMetricData &backend_metric_data)=0
watcher
ClusterWatcher * watcher
Definition: cds.cc:148
grpc_core::OobBackendMetricWatcher::~OobBackendMetricWatcher
virtual ~OobBackendMetricWatcher()=default
grpc_core::Duration
Definition: src/core/lib/gprpp/time.h:122
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:35