From fd1a20a667fc2cfdfe2afd8a8d54cb3f5438b5df Mon Sep 17 00:00:00 2001
From: Siddharth Rakesh <sidrakesh@google.com>
Date: Tue, 30 Jun 2015 16:38:32 -0700
Subject: [PATCH] Changes introduced for passing hashed user id instead of
 access token

---
 test/cpp/qps/perf_db.proto        | 2 +-
 test/cpp/qps/perf_db_client.cc    | 6 +++---
 test/cpp/qps/perf_db_client.h     | 2 +-
 test/cpp/qps/report.cc            | 2 +-
 test/cpp/qps/report.h             | 6 +++---
 test/cpp/util/benchmark_config.cc | 4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/test/cpp/qps/perf_db.proto b/test/cpp/qps/perf_db.proto
index 7a550f83c6..60e038406a 100644
--- a/test/cpp/qps/perf_db.proto
+++ b/test/cpp/qps/perf_db.proto
@@ -57,7 +57,7 @@ message Metrics {
 
 // Request for storing a single user's data
 message SingleUserRecordRequest {
-  string access_token = 1;
+  string hashed_id = 1;
   string test_name = 2;
   string sys_info = 3;
   string tag = 4;
diff --git a/test/cpp/qps/perf_db_client.cc b/test/cpp/qps/perf_db_client.cc
index 5ec87e150c..0996ea2b27 100644
--- a/test/cpp/qps/perf_db_client.cc
+++ b/test/cpp/qps/perf_db_client.cc
@@ -39,7 +39,7 @@ namespace testing {
 // sets the client and server config information
 void PerfDbClient::setConfigs(const ClientConfig& client_config,
                               const ServerConfig& server_config) {
-  this->client_config_ = client_config;
+  client_config_ = client_config;
   this->server_config_ = server_config;
 }
 
@@ -76,13 +76,13 @@ void PerfDbClient::setTimes(double server_system_time, double server_user_time,
 }
 
 // sends the data to the performance database server
-bool PerfDbClient::sendData(std::string access_token, std::string test_name,
+bool PerfDbClient::sendData(std::string hashed_id, std::string test_name,
                             std::string sys_info, std::string tag) {
   // Data record request object
   SingleUserRecordRequest single_user_record_request;
 
   // setting access token, name of the test and the system information
-  single_user_record_request.set_access_token(access_token);
+  single_user_record_request.set_hashed_id(hashed_id);
   single_user_record_request.set_test_name(test_name);
   single_user_record_request.set_sys_info(sys_info);
   single_user_record_request.set_tag(tag);
diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h
index a22426bced..ce7a88bbff 100644
--- a/test/cpp/qps/perf_db_client.h
+++ b/test/cpp/qps/perf_db_client.h
@@ -91,7 +91,7 @@ class PerfDbClient {
                 double client_system_time, double client_user_time);
 
   // sends the data to the performance database server
-  bool sendData(std::string access_token, std::string test_name,
+  bool sendData(std::string hashed_id, std::string test_name,
                 std::string sys_info, std::string tag);
 
  private:
diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc
index da1dea62ae..ff01ec1501 100644
--- a/test/cpp/qps/report.cc
+++ b/test/cpp/qps/report.cc
@@ -172,7 +172,7 @@ void PerfDbReporter::ReportTimes(const ScenarioResult& result) {
 void PerfDbReporter::SendData() {
   // send data to performance database
   bool data_state =
-      perf_db_client_.sendData(access_token_, test_name_, sys_info_, tag_);
+      perf_db_client_.sendData(hashed_id_, test_name_, sys_info_, tag_);
 
   // check state of data sending
   if (data_state) {
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index 88707bea38..aec3cbe80a 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -107,11 +107,11 @@ class GprLogReporter : public Reporter {
 /** Reporter for performance database tool */
 class PerfDbReporter : public Reporter {
  public:
-  PerfDbReporter(const string& name, const string& access_token,
+  PerfDbReporter(const string& name, const string& hashed_id,
                  const string& test_name, const string& sys_info,
                  const string& server_address, const string& tag)
       : Reporter(name),
-        access_token_(access_token),
+        hashed_id_(hashed_id),
         test_name_(test_name),
         sys_info_(sys_info),
         tag_(tag) {
@@ -122,7 +122,7 @@ class PerfDbReporter : public Reporter {
 
  private:
   PerfDbClient perf_db_client_;
-  std::string access_token_;
+  std::string hashed_id_;
   std::string test_name_;
   std::string sys_info_;
   std::string tag_;
diff --git a/test/cpp/util/benchmark_config.cc b/test/cpp/util/benchmark_config.cc
index 030cb28c32..91fbbf9677 100644
--- a/test/cpp/util/benchmark_config.cc
+++ b/test/cpp/util/benchmark_config.cc
@@ -39,7 +39,7 @@ DEFINE_bool(enable_log_reporter, true,
 
 DEFINE_bool(report_metrics_db, false, "True if metrics to be reported to performance database");
 
-DEFINE_string(access_token, "", "Authorizing JSON string for leaderboard");
+DEFINE_string(hashed_id, "", "Hash of the user id");
 
 DEFINE_string(test_name, "", "Name of the test being executed");
 
@@ -71,7 +71,7 @@ static std::shared_ptr<Reporter> InitBenchmarkReporters() {
   }
   if(FLAGS_report_metrics_db) {
     composite_reporter->add(
-      std::unique_ptr<Reporter>(new PerfDbReporter("PerfDbReporter", FLAGS_access_token, FLAGS_test_name, 
+      std::unique_ptr<Reporter>(new PerfDbReporter("PerfDbReporter", FLAGS_hashed_id, FLAGS_test_name, 
         FLAGS_sys_info, FLAGS_server_address, FLAGS_tag)));
   }
 
-- 
GitLab