Go to the documentation of this file.
25 #include "src/proto/grpc/testing/metrics.grpc.pb.h"
26 #include "src/proto/grpc/testing/metrics.pb.h"
49 long duration_secs = time_diff.
tv_sec > 0 ? time_diff.
tv_sec : 1;
58 std::lock_guard<std::mutex> lock(
mu_);
62 resp.set_long_value(
it->second->Get());
72 std::lock_guard<std::mutex> lock(
mu_);
85 std::lock_guard<std::mutex> lock(
mu_);
87 std::shared_ptr<QpsGauge> qps_gauge(
new QpsGauge());
94 *already_present = !p.second;
95 return p.first->second;
109 std::unique_ptr<grpc::Server>
server(
builder.BuildAndStart());
110 gpr_log(
GPR_INFO,
"Metrics server %s started. Ready to receive requests..",
std::map< string, std::shared_ptr< QpsGauge > > qps_gauges_
grpc::Status GetAllGauges(ServerContext *context, const EmptyMessage *request, ServerWriter< GaugeResponse > *writer) override
grpc::Status GetGauge(ServerContext *context, const GaugeRequest *request, GaugeResponse *response) override
std::unique_ptr< grpc::Server > StartServer(int port)
std::shared_ptr< QpsGauge > CreateQpsGauge(const std::string &name, bool *already_present)
A builder class for the creation and startup of grpc::Server instances.
GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
static const Status & OK
An OK pre-defined instance.
def server(thread_pool, handlers=None, interceptors=None, options=None, maximum_concurrent_rpcs=None, compression=None, xds=False)
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
std::mutex num_queries_mu_
static bool to_string(zval *from)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:40