Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
grpc::experimental::CallMetricRecorder Class Reference

#include <call_metric_recorder.h>

Public Member Functions

 CallMetricRecorder (grpc_core::Arena *arena)
 
CallMetricRecorderRecordCpuUtilizationMetric (double value)
 
CallMetricRecorderRecordMemoryUtilizationMetric (double value)
 
CallMetricRecorderRecordRequestCostMetric (string_ref name, double value)
 
CallMetricRecorderRecordUtilizationMetric (string_ref name, double value)
 
 ~CallMetricRecorder ()
 

Private Member Functions

absl::optional< std::string > CreateSerializedReport ()
 

Private Attributes

internal::Mutex mu_
 
grpc_core::BackendMetricData *backend_metric_data_ ABSL_GUARDED_BYmu_
 

Friends

class experimental::OrcaServerInterceptor
 

Detailed Description

Records call metrics for the purpose of load balancing. During an RPC, call ServerContext::ExperimentalGetCallMetricRecorder() method to retrive the recorder for the current call.

Definition at line 52 of file call_metric_recorder.h.

Constructor & Destructor Documentation

◆ CallMetricRecorder()

grpc::experimental::CallMetricRecorder::CallMetricRecorder ( grpc_core::Arena arena)
explicit

Definition at line 40 of file call_metric_recorder.cc.

◆ ~CallMetricRecorder()

grpc::experimental::CallMetricRecorder::~CallMetricRecorder ( )

Definition at line 43 of file call_metric_recorder.cc.

Member Function Documentation

◆ CreateSerializedReport()

absl::optional< std::string > grpc::experimental::CallMetricRecorder::CreateSerializedReport ( )
private

Definition at line 77 of file call_metric_recorder.cc.

◆ RecordCpuUtilizationMetric()

CallMetricRecorder & grpc::experimental::CallMetricRecorder::RecordCpuUtilizationMetric ( double  value)

Records a call metric measurement for CPU utilization. Multiple calls to this method will override the stored value.

Definition at line 47 of file call_metric_recorder.cc.

◆ RecordMemoryUtilizationMetric()

CallMetricRecorder & grpc::experimental::CallMetricRecorder::RecordMemoryUtilizationMetric ( double  value)

Records a call metric measurement for memory utilization. Multiple calls to this method will override the stored value.

Definition at line 54 of file call_metric_recorder.cc.

◆ RecordRequestCostMetric()

CallMetricRecorder & grpc::experimental::CallMetricRecorder::RecordRequestCostMetric ( grpc::string_ref  name,
double  value 
)

Records a call metric measurement for request cost. Multiple calls to this method with the same name will override the corresponding stored value. The lifetime of the name string needs to be longer than the lifetime of the RPC itself, since it's going to be sent as trailers after the RPC finishes. It is assumed the strings are common names that are global constants.

Definition at line 69 of file call_metric_recorder.cc.

◆ RecordUtilizationMetric()

CallMetricRecorder & grpc::experimental::CallMetricRecorder::RecordUtilizationMetric ( grpc::string_ref  name,
double  value 
)

Records a call metric measurement for utilization. Multiple calls to this method with the same name will override the corresponding stored value. The lifetime of the name string needs to be longer than the lifetime of the RPC itself, since it's going to be sent as trailers after the RPC finishes. It is assumed the strings are common names that are global constants.

Definition at line 61 of file call_metric_recorder.cc.

Friends And Related Function Documentation

◆ experimental::OrcaServerInterceptor

Definition at line 88 of file call_metric_recorder.h.

Member Data Documentation

◆ mu_ [1/2]

internal::Mutex grpc::experimental::CallMetricRecorder::mu_
private

Definition at line 86 of file call_metric_recorder.h.

◆ mu_ [2/2]

grpc_core::BackendMetricData* backend_metric_data_ ABSL_GUARDED_BY& grpc::experimental::CallMetricRecorder::mu_
private

Definition at line 87 of file call_metric_recorder.h.


The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:32