|
|
|
@ -389,11 +389,6 @@ class XdsLb : public LoadBalancingPolicy { |
|
|
|
|
PickResult Pick(PickArgs args); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
static void RecordCallCompletion( |
|
|
|
|
void* arg, grpc_error* error, |
|
|
|
|
LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, |
|
|
|
|
LoadBalancingPolicy::CallState* call_state); |
|
|
|
|
|
|
|
|
|
UniquePtr<SubchannelPicker> picker_; |
|
|
|
|
RefCountedPtr<XdsClientStats::LocalityStats> locality_stats_; |
|
|
|
|
}; |
|
|
|
@ -728,25 +723,20 @@ LoadBalancingPolicy::PickResult XdsLb::PickerWrapper::Pick( |
|
|
|
|
// Record a call started.
|
|
|
|
|
locality_stats_->AddCallStarted(); |
|
|
|
|
// Intercept the recv_trailing_metadata op to record call completion.
|
|
|
|
|
result.recv_trailing_metadata_ready = RecordCallCompletion; |
|
|
|
|
result.recv_trailing_metadata_ready_user_data = |
|
|
|
|
XdsClientStats::LocalityStats* locality_stats = |
|
|
|
|
locality_stats_->Ref(DEBUG_LOCATION, "LocalityStats+call").release(); |
|
|
|
|
result.recv_trailing_metadata_ready = |
|
|
|
|
// Note: This callback does not run in either the control plane
|
|
|
|
|
// combiner or in the data plane mutex.
|
|
|
|
|
[locality_stats](grpc_error* error, MetadataInterface* metadata, |
|
|
|
|
CallState* call_state) { |
|
|
|
|
const bool call_failed = error != GRPC_ERROR_NONE; |
|
|
|
|
locality_stats->AddCallFinished(call_failed); |
|
|
|
|
locality_stats->Unref(DEBUG_LOCATION, "LocalityStats+call"); |
|
|
|
|
}; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Note that the following callback does not run in either the control plane
|
|
|
|
|
// combiner or the data plane combiner.
|
|
|
|
|
void XdsLb::PickerWrapper::RecordCallCompletion( |
|
|
|
|
void* arg, grpc_error* error, |
|
|
|
|
LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, |
|
|
|
|
LoadBalancingPolicy::CallState* call_state) { |
|
|
|
|
XdsClientStats::LocalityStats* locality_stats = |
|
|
|
|
static_cast<XdsClientStats::LocalityStats*>(arg); |
|
|
|
|
const bool call_failed = error != GRPC_ERROR_NONE; |
|
|
|
|
locality_stats->AddCallFinished(call_failed); |
|
|
|
|
locality_stats->Unref(DEBUG_LOCATION, "LocalityStats+call"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// XdsLb::Picker
|
|
|
|
|
//
|
|
|
|
|