Commit ec7d88d0 authored by Bryan McQuade's avatar Bryan McQuade Committed by Commit Bot

Fix UKM serialized source count histogram, and add breakouts.

The existing implementation for UKM.Sources.SerializedCount ends
up counting some sources that don't get serialized.

This change fixes that, versions the histogram to reflect the change,
and adds SourceIdType-specific breakouts for this histogram.

The SourceIdType-specific breakouts are useful because navigation id
sources are a more stable representation of the number of distinct
navigations being tracked by UKM.

Change-Id: I958bc36f6a37a2e7f2e02b6ba05dee939b711298
Reviewed-on: https://chromium-review.googlesource.com/c/1291594Reviewed-by: default avatarRobert Kaplow (sloooow) <rkaplow@chromium.org>
Commit-Queue: Bryan McQuade <bmcquade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601575}
parent 8181174d
...@@ -276,6 +276,7 @@ void UkmRecorderImpl::StoreRecordingsInReport(Report* report) { ...@@ -276,6 +276,7 @@ void UkmRecorderImpl::StoreRecordingsInReport(Report* report) {
std::vector<std::unique_ptr<UkmSource>> unsent_sources; std::vector<std::unique_ptr<UkmSource>> unsent_sources;
int unmatched_sources = 0; int unmatched_sources = 0;
std::unordered_map<ukm::SourceIdType, int> serialized_source_type_counts;
for (auto& kv : recordings_.sources) { for (auto& kv : recordings_.sources) {
// If the source id is not whitelisted, don't send it unless it has // If the source id is not whitelisted, don't send it unless it has
// associated entries and the URL matches a URL of a whitelisted source. // associated entries and the URL matches a URL of a whitelisted source.
...@@ -299,6 +300,8 @@ void UkmRecorderImpl::StoreRecordingsInReport(Report* report) { ...@@ -299,6 +300,8 @@ void UkmRecorderImpl::StoreRecordingsInReport(Report* report) {
kv.second->PopulateProto(proto_source); kv.second->PopulateProto(proto_source);
if (!ShouldRecordInitialUrl()) if (!ShouldRecordInitialUrl())
proto_source->clear_initial_url(); proto_source->clear_initial_url();
serialized_source_type_counts[GetSourceIdType(kv.first)]++;
} }
for (const auto& event_and_aggregate : recordings_.event_aggregations) { for (const auto& event_and_aggregate : recordings_.event_aggregations) {
if (event_and_aggregate.second.metrics.empty()) if (event_and_aggregate.second.metrics.empty())
...@@ -340,13 +343,29 @@ void UkmRecorderImpl::StoreRecordingsInReport(Report* report) { ...@@ -340,13 +343,29 @@ void UkmRecorderImpl::StoreRecordingsInReport(Report* report) {
} }
} }
} }
int num_serialized_sources = 0;
for (const auto& entry : serialized_source_type_counts) {
num_serialized_sources += entry.second;
}
UMA_HISTOGRAM_COUNTS_1000("UKM.Sources.SerializedCount", UMA_HISTOGRAM_COUNTS_1000("UKM.Sources.SerializedCount2",
recordings_.sources.size() - unsent_sources.size()); num_serialized_sources);
UMA_HISTOGRAM_COUNTS_100000("UKM.Entries.SerializedCount2", UMA_HISTOGRAM_COUNTS_100000("UKM.Entries.SerializedCount2",
recordings_.entries.size()); recordings_.entries.size());
UMA_HISTOGRAM_COUNTS_1000("UKM.Sources.UnsentSourcesCount", UMA_HISTOGRAM_COUNTS_1000("UKM.Sources.UnsentSourcesCount",
unsent_sources.size()); unsent_sources.size());
UMA_HISTOGRAM_COUNTS_1000("UKM.Sources.UnmatchedSourcesCount",
unmatched_sources);
UMA_HISTOGRAM_COUNTS_1000(
"UKM.Sources.SerializedCount2.Ukm",
serialized_source_type_counts[ukm::SourceIdType::UKM]);
UMA_HISTOGRAM_COUNTS_1000(
"UKM.Sources.SerializedCount2.Navigation",
serialized_source_type_counts[ukm::SourceIdType::NAVIGATION_ID]);
UMA_HISTOGRAM_COUNTS_1000(
"UKM.Sources.SerializedCount2.App",
serialized_source_type_counts[ukm::SourceIdType::APP_ID]);
Report::SourceCounts* source_counts_proto = report->mutable_source_counts(); Report::SourceCounts* source_counts_proto = report->mutable_source_counts();
source_counts_proto->set_observed(recordings_.source_counts.observed); source_counts_proto->set_observed(recordings_.source_counts.observed);
......
...@@ -111841,11 +111841,29 @@ uploading your change for review. ...@@ -111841,11 +111841,29 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="UKM.Sources.SerializedCount" units="sources"> <histogram name="UKM.Sources.SerializedCount" units="sources">
<obsolete>
Deprecated 10/2018 by UKM.Sources.SerializedCount2.
</obsolete>
<owner>holte@chromium.org</owner>
<owner>rkaplow@chromium.org</owner>
<summary>Number of serialized UKM sources when storing a UKM log.</summary>
</histogram>
<histogram name="UKM.Sources.SerializedCount2" units="sources">
<owner>holte@chromium.org</owner> <owner>holte@chromium.org</owner>
<owner>rkaplow@chromium.org</owner> <owner>rkaplow@chromium.org</owner>
<summary>Number of serialized UKM sources when storing a UKM log.</summary> <summary>Number of serialized UKM sources when storing a UKM log.</summary>
</histogram> </histogram>
<histogram name="UKM.Sources.UnmatchedSourcesCount" units="sources">
<owner>bmcquade@chromium.org</owner>
<owner>rkaplow@chromium.org</owner>
<summary>
Number of UKM sources that were not sent because they did not match a
navigation source URL.
</summary>
</histogram>
<histogram name="UKM.Sources.UnsentSourcesCount" units="sources"> <histogram name="UKM.Sources.UnsentSourcesCount" units="sources">
<owner>asvitkine@chromium.org</owner> <owner>asvitkine@chromium.org</owner>
<owner>bmcquade@chromium.org</owner> <owner>bmcquade@chromium.org</owner>
...@@ -135005,6 +135023,13 @@ uploading your change for review. ...@@ -135005,6 +135023,13 @@ uploading your change for review.
name="TrafficStatsAmortizer.PreAmortizationRunDataUseBytes"/> name="TrafficStatsAmortizer.PreAmortizationRunDataUseBytes"/>
</histogram_suffixes> </histogram_suffixes>
<histogram_suffixes name="UkmSourceIdTypes" separator=".">
<suffix name="App" label="Restricted to app source id types."/>
<suffix name="Navigation" label="Restricted to navigation source id types."/>
<suffix name="Ukm" label="Restricted to UKM source id types."/>
<affected-histogram name="UKM.Sources.SerializedCount2"/>
</histogram_suffixes>
<histogram_suffixes name="UnackedPackets" separator="."> <histogram_suffixes name="UnackedPackets" separator=".">
<obsolete> <obsolete>
Deprecated as of 08/2016. Deprecated as of 08/2016.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment