Skip to content

Commit

Permalink
Add quick answers logging for the length of the selected text.
Browse files Browse the repository at this point in the history
QuickAnswers.SelectedContent.Length is recorded to learn about users
usage pattern.

Bug: 1051751
Test: Manual
Change-Id: Iba7c9ecf605cf39cc7d65864eb54d9ff6ef12be3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2053288
Commit-Queue: Li Lin <llin@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Alex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741583}
  • Loading branch information
Li Lin authored and Commit Bot committed Feb 14, 2020
1 parent c8aaa25 commit 7dbe21f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chromeos/components/quick_answers/quick_answers_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "base/strings/stringprintf.h"
#include "chromeos/components/quick_answers/quick_answers_model.h"
#include "chromeos/components/quick_answers/utils/quick_answers_metrics.h"
#include "chromeos/constants/chromeos_features.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "third_party/re2/src/re2/re2.h"
Expand Down Expand Up @@ -97,6 +98,8 @@ void QuickAnswersClient::OnAssistantStateDestroyed() {

void QuickAnswersClient::SendRequest(
const QuickAnswersRequest& quick_answers_request) {
RecordSelectedTextLength(quick_answers_request.selected_text.length());

search_result_loader_ = CreateSearchResultLoader();

// Preprocess the request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const char kQuickAnswerClick[] = "QuickAnswers.Click";
const char kQuickAnswerResult[] = "QuickAnswers.Result";
const char kQuickAnswerLoadingStatus[] = "QuickAnswers.Loading.Status";
const char kQuickAnswerLoadingDuration[] = "QuickAnswers.Loading.Duration";
const char kQuickAnswerSelectedContentLength[] =
"QuickAnswers.SelectedContent.Length";
const char kDurationSuffix[] = ".Duration";

std::string ResultTypeToString(ResultType result_type) {
Expand Down Expand Up @@ -71,5 +73,9 @@ void RecordClick(ResultType result_type, const base::TimeDelta duration) {
/*is_medium_bucketization=*/true);
}

void RecordSelectedTextLength(int length) {
base::UmaHistogramCounts1000(kQuickAnswerSelectedContentLength, length);
}

} // namespace quick_answers
} // namespace chromeos
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ void RecordResult(ResultType result_type, const base::TimeDelta duration);
// fetch finish and user clicks.
void RecordClick(ResultType result_type, const base::TimeDelta duration);

// Record selected text length to learn about usage pattern.
void RecordSelectedTextLength(int length);

} // namespace quick_answers
} // namespace chromeos

Expand Down
10 changes: 10 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126622,6 +126622,16 @@ uploading your change for review.
</summary>
</histogram>

<histogram name="QuickAnswers.SelectedContent.Length" units="characters"
expires_after="2020-12-10">
<owner>llin@google.com</owner>
<owner>croissant-eng@chromium.org</owner>
<summary>
For every quick answer request, records the length of the selected text that
is being considered for fetching quick answers. ChromeOS only.
</summary>
</histogram>

<histogram name="Quickoffice.csvFormattedCellCount" units="units"
expires_after="2020-02-29">
<owner>snopanen@google.com</owner>
Expand Down

0 comments on commit 7dbe21f

Please sign in to comment.