Make scenario results to include start and end time for a test scenario. (#29207)

This commit update the scenario results to include the start_timestamp
and end_timestamp. These two fields are used in prometheus range queries
to indicate the period we are pulling data for.
pull/23003/head
Wanlin Du 3 years ago committed by GitHub
parent ff3d51886b
commit d2aafef157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/proto/grpc/testing/BUILD
  2. 6
      src/proto/grpc/testing/control.proto
  3. 12
      test/cpp/qps/driver.cc

@ -42,6 +42,7 @@ grpc_proto_library(
name = "control_proto",
srcs = ["control.proto"],
has_services = False,
well_known_protos = True,
deps = [
"payloads_proto",
"stats_proto",
@ -277,6 +278,7 @@ proto_library(
deps = [
":payloads_descriptor",
":stats_descriptor",
"@com_google_protobuf//:timestamp_proto",
],
)

@ -16,6 +16,7 @@ syntax = "proto3";
import "src/proto/grpc/testing/payloads.proto";
import "src/proto/grpc/testing/stats.proto";
import "google/protobuf/timestamp.proto";
package grpc.testing;
@ -265,6 +266,11 @@ message ScenarioResultSummary
// Queries per CPU-sec over all servers or clients
double server_queries_per_cpu_sec = 17;
double client_queries_per_cpu_sec = 18;
// Start and end time for the test scenario
google.protobuf.Timestamp start_time = 19;
google.protobuf.Timestamp end_time =20;
}
// Results of a single benchmark scenario.

@ -25,6 +25,8 @@
#include <unordered_map>
#include <vector>
#include "google/protobuf/timestamp.pb.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -573,6 +575,9 @@ std::unique_ptr<ScenarioResult> RunScenario(
// Start a run
gpr_log(GPR_INFO, "Starting");
auto start_time = time(nullptr);
for (size_t i = 0; i < num_servers; i++) {
auto server = &servers[i];
if (!server->stream->Write(server_mark)) {
@ -624,6 +629,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
bool client_finish_first =
(client_config.rpc_type() != STREAMING_FROM_SERVER);
auto end_time = time(nullptr);
FinishClients(clients, client_mark);
if (!client_finish_first) {
@ -650,6 +657,11 @@ std::unique_ptr<ScenarioResult> RunScenario(
rrc->set_status_code(it->first);
rrc->set_count(it->second);
}
// Fill in start and end time for the test scenario
result->mutable_summary()->mutable_start_time()->set_seconds(start_time);
result->mutable_summary()->mutable_end_time()->set_seconds(end_time);
postprocess_scenario_result(result.get());
return result;
}

Loading…
Cancel
Save