0

Move SQL histograms into their own histograms.xml file

There's quite a bit of metrics work currently happening in the sql/
code, so it makes sense for the folks working on it to own the
associated histograms (and also reduces review load on storage/
histograms owners).

Change-Id: I7998faa2526c3abfbd8db9d322f12699cec0792c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6109794
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1399202}
This commit is contained in:
Anthony Vallée-Dubois
2024-12-20 08:37:12 -08:00
committed by Chromium LUCI CQ
parent dd81ffc261
commit eb60f1b7a0
6 changed files with 239 additions and 204 deletions

@ -7,7 +7,7 @@ import("//tools/metrics/generate_allowlist_from_histograms_file.gni")
generate_allowlist_from_histograms_file("sql_name_variants") {
namespace = "sql_metrics"
input_xml_file = "//tools/metrics/histograms/metadata/storage/histograms.xml"
input_xml_file = "//tools/metrics/histograms/metadata/sql/histograms.xml"
output_file = "sql_name_variants.h"
tag = "variant"
allow_list_name = "DatabaseTag"

@ -302,7 +302,7 @@ class COMPONENT_EXPORT(SQL) Database {
// NOTREACHED() is invalid in a consteval context so compilation will
// fail iff the string is invalid.
NOTREACHED() << "Invalid database tag. Did you add it to the "
"DatabaseTag variant in storage/histograms.xml?";
"DatabaseTag variant in sql/histograms.xml?";
}
}

@ -240,6 +240,7 @@ histograms_xml_files = [
"//tools/metrics/histograms/metadata/signin/enums.xml",
"//tools/metrics/histograms/metadata/signin/histograms.xml",
"//tools/metrics/histograms/metadata/simple/histograms.xml",
"//tools/metrics/histograms/metadata/sql/histograms.xml",
"//tools/metrics/histograms/metadata/stability/enums.xml",
"//tools/metrics/histograms/metadata/stability/histograms.xml",
"//tools/metrics/histograms/metadata/startup/enums.xml",

@ -0,0 +1,7 @@
per-file OWNERS=file://tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS
# Prefer sending CLs to the owners listed below.
# Use chromium-metrics-reviews@google.com as a backup.
anthonyvd@chromium.org
olivierli@chromium.org

@ -0,0 +1,229 @@
<!--
Copyright 2024 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!--
This file is used to generate a comprehensive list of SQL histograms
along with a detailed description for each histogram.
For best practices on writing histogram descriptions, see
https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md
Please follow the instructions in the OWNERS file in this directory to find a
reviewer. If no OWNERS file exists, please consider signing up at
go/reviewing-metrics (Googlers only), as all subdirectories are expected to
have an OWNERS file. As a last resort you can send the CL to
chromium-metrics-reviews@google.com.
-->
<histogram-configuration>
<histograms>
<variants name="DatabaseTag">
<variant name="Activity" summary="Activity"/>
<variant name="Affiliation" summary="Affiliation"/>
<variant name="AggregationService" summary="AggregationService"/>
<variant name="AnnotationStorage" summary="AnnotationStorage"/>
<variant name="BackgroundRequestQueue" summary="BackgroundRequestQueue"/>
<variant name="BrowsingTopics" summary="BrowsingTopics"/>
<variant name="CdmStorage" summary="CdmStorage"/>
<variant name="Conversions" summary="Conversions"/>
<variant name="Cookie" summary="Cookie"/>
<variant name="DatabaseTracker" summary="DatabaseTracker"/>
<variant name="DataSharingGroupStorage" summary="DataSharingGroupStorage"/>
<variant name="DBSCSessions" summary="DBSCSessions"/>
<variant name="DIPS" summary="DIPS"/>
<variant name="FileIndexService" summary="FileIndexService"/>
<variant name="FirefoxImporter" summary="FirefoxImporter"/>
<variant name="FirstPartySets" summary="FirstPartySets"/>
<variant name="FSPContextDatabase" summary="FSPContextDatabase"/>
<variant name="History" summary="History"/>
<variant name="HistoryEmbeddings" summary="HistoryEmbeddings"/>
<variant name="HistoryInMemoryDB" summary="HistoryInMemoryDB"/>
<variant name="InterestGroups" summary="InterestGroups"/>
<variant name="InterestGroupStorage" summary="InterestGroupStorage"/>
<variant name="KAnonymityService" summary="KAnonymityService"/>
<variant name="LocalTraces" summary="LocalTraces"/>
<variant name="MediaDeviceSalts" summary="MediaDeviceSalts"/>
<variant name="MediaLicense" summary="MediaLicense"/>
<variant name="OfflinePageMetadata" summary="OfflinePageMetadata"/>
<variant name="OptOutBlacklist" summary="OptOutBlacklist"/>
<variant name="Passwords" summary="Passwords"/>
<variant name="PermissionAuditingLogs" summary="PermissionAuditingLogs"/>
<variant name="PowerBookmarks" summary="PowerBookmarks"/>
<variant name="Predictor" summary="Predictor"/>
<variant name="PrivateAggregation" summary="PrivateAggregation"/>
<variant name="Quota" summary="Quota"/>
<variant name="RazeNullDB" summary="RazeNullDB"/>
<variant name="Recovery" summary="Recovery"/>
<variant name="ReportingAndNEL" summary="ReportingAndNEL"/>
<variant name="ServerCertificate" summary="ServerCertificate"/>
<variant name="SharedDictionary" summary="SharedDictionary"/>
<variant name="SharedStorage" summary="SharedStorage"/>
<variant name="Shortcuts" summary="Shortcuts"/>
<variant name="SQLiteDiagnostics" summary="SQLiteDiagnostics"/>
<variant name="Test" summary="Test"/>
<variant name="Thumbnail" summary="Thumbnail"/>
<variant name="TopSites" summary="TopSites"/>
<variant name="TrustTokens" summary="TrustTokens"/>
<variant name="UKMMetrics" summary="UKMMetrics"/>
<variant name="UserAnnotations" summary="UserAnnotations"/>
<variant name="UserNotes" summary="UserNotes"/>
<variant name="Web" summary="Web"/>
</variants>
<histogram name="Sql.Database.Open.FirstAttempt.Error.{DatabaseTag}"
enum="SqliteResultCode" expires_after="2025-12-03">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports sqlite errors triggered during the first attempt at opening the
{DatabaseTag} database.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Database.Open.SecondAttempt.Error.{DatabaseTag}"
enum="SqliteResultCode" expires_after="2025-12-03">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports sqlite errors triggered during the second attempt at opening the
{DatabaseTag} database. Databases can sometimes trigger a second open
attempt if the caller-provided error callback razes the database on open
failure.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Database.Success.OpenInternalTime.{DatabaseTag}"
units="microseconds" expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the time spent in OpenInternal, in microseconds, when opening the
{DatabaseTag} database.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Database.Success.SqliteOpenTime.{DatabaseTag}"
units="microseconds" expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the time spent in the sqlite3_open_v2 library call, in microseconds,
when opening the {DatabaseTag} database.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Recovery.Result" enum="SqlRecoveryResult"
expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-catan@google.com</owner>
<summary>
Outcome of attempting to recover a database with sql::Recovery.
</summary>
</histogram>
<histogram name="Sql.Recovery.Result.{DatabaseTag}" enum="SqlRecoveryResult"
expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-catan@google.com</owner>
<summary>
Outcome of attempting to recover the {DatabaseTag} database with
sql::Recovery.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Recovery.ResultCode" enum="SqliteLoggedResultCode"
expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-catan@google.com</owner>
<summary>
SQLite result code from attempting to recover a database with sql::Recovery.
Note that kNoError does not necessarily indicate that recovery succeeded
(see Sql.Recovery.Result for that information), since not all recoveries
fail due to SQLite errors (e.g. if a version number could not be read from
the meta table).
</summary>
</histogram>
<histogram name="Sql.Recovery.ResultCode.{DatabaseTag}"
enum="SqliteLoggedResultCode" expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-catan@google.com</owner>
<summary>
SQLite result code from attempting to recover the {DatabaseTag} database
with sql::Recovery. Note that kNoError does not necessarily indicate that
recovery succeeded (see Sql.Recovery.Result for that information), since not
all recoveries fail due to SQLite errors (e.g. if a version number could not
be read from the meta table).
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Statement.ExecutionTime.{DatabaseTag}"
units="microseconds" expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the total time spent stepping for a given statement in database
{DatabaseTag}, in microseconds. Recorded when the statement is
reset/destructed, but only includes the time spent in `StepInternal` since
the statement's last reset.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Statement.StepTime.{DatabaseTag}" units="microseconds"
expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the time of a single step of a statement running against
{DatabaseTag}, in microseconds. Recorded every time `Step` is called.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Statement.{DatabaseTag}.VMSteps" units="count"
expires_after="2025-04-13">
<owner>etienneb@chromium.org</owner>
<owner>estade@chromium.org</owner>
<owner>chrome-catan@google.com</owner>
<summary>
The number of virtual machine operations executed for {DatabaseTag}
database. It is reported once per statement. It can be used as a proxy of
total work done by queries executed over the database.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.vfs.SyncTime" units="ms" expires_after="2025-04-13">
<owner>etienneb@chromium.org</owner>
<owner>estade@chromium.org</owner>
<owner>chrome-catan@google.com</owner>
<summary>
The time it takes to sync SQLite data to disk. The metric is recorded once
per flush. A SQLite operation may require multiple sync operation to ensure
database consistency.
</summary>
</histogram>
</histograms>
</histogram-configuration>

@ -22,59 +22,6 @@ chromium-metrics-reviews@google.com.
<histograms>
<variants name="DatabaseTag">
<variant name="Activity" summary="Activity"/>
<variant name="Affiliation" summary="Affiliation"/>
<variant name="AggregationService" summary="AggregationService"/>
<variant name="AnnotationStorage" summary="AnnotationStorage"/>
<variant name="BackgroundRequestQueue" summary="BackgroundRequestQueue"/>
<variant name="BrowsingTopics" summary="BrowsingTopics"/>
<variant name="CdmStorage" summary="CdmStorage"/>
<variant name="Conversions" summary="Conversions"/>
<variant name="Cookie" summary="Cookie"/>
<variant name="DatabaseTracker" summary="DatabaseTracker"/>
<variant name="DataSharingGroupStorage" summary="DataSharingGroupStorage"/>
<variant name="DBSCSessions" summary="DBSCSessions"/>
<variant name="DIPS" summary="DIPS"/>
<variant name="FileIndexService" summary="FileIndexService"/>
<variant name="FirefoxImporter" summary="FirefoxImporter"/>
<variant name="FirstPartySets" summary="FirstPartySets"/>
<variant name="FSPContextDatabase" summary="FSPContextDatabase"/>
<variant name="History" summary="History"/>
<variant name="HistoryEmbeddings" summary="HistoryEmbeddings"/>
<variant name="HistoryInMemoryDB" summary="HistoryInMemoryDB"/>
<variant name="InterestGroups" summary="InterestGroups"/>
<variant name="InterestGroupStorage" summary="InterestGroupStorage"/>
<variant name="KAnonymityService" summary="KAnonymityService"/>
<variant name="LocalTraces" summary="LocalTraces"/>
<variant name="MediaDeviceSalts" summary="MediaDeviceSalts"/>
<variant name="MediaLicense" summary="MediaLicense"/>
<variant name="OfflinePageMetadata" summary="OfflinePageMetadata"/>
<variant name="OptOutBlacklist" summary="OptOutBlacklist"/>
<variant name="Passwords" summary="Passwords"/>
<variant name="PermissionAuditingLogs" summary="PermissionAuditingLogs"/>
<variant name="PowerBookmarks" summary="PowerBookmarks"/>
<variant name="Predictor" summary="Predictor"/>
<variant name="PrivateAggregation" summary="PrivateAggregation"/>
<variant name="Quota" summary="Quota"/>
<variant name="RazeNullDB" summary="RazeNullDB"/>
<variant name="Recovery" summary="Recovery"/>
<variant name="ReportingAndNEL" summary="ReportingAndNEL"/>
<variant name="ServerCertificate" summary="ServerCertificate"/>
<variant name="SharedDictionary" summary="SharedDictionary"/>
<variant name="SharedStorage" summary="SharedStorage"/>
<variant name="Shortcuts" summary="Shortcuts"/>
<variant name="SQLiteDiagnostics" summary="SQLiteDiagnostics"/>
<variant name="Test" summary="Test"/>
<variant name="Thumbnail" summary="Thumbnail"/>
<variant name="TopSites" summary="TopSites"/>
<variant name="TrustTokens" summary="TrustTokens"/>
<variant name="UKMMetrics" summary="UKMMetrics"/>
<variant name="UserAnnotations" summary="UserAnnotations"/>
<variant name="UserNotes" summary="UserNotes"/>
<variant name="Web" summary="Web"/>
</variants>
<variants name="InterestGroupStorageProtoType">
<variant name="AdProtos" summary="AdProtos"/>
<variant name="BiddingAndAuctionServerKeyProtos"
@ -499,155 +446,6 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>
<histogram name="Sql.Database.Open.FirstAttempt.Error.{DatabaseTag}"
enum="SqliteResultCode" expires_after="2025-12-03">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports sqlite errors triggered during the first attempt at opening the
{DatabaseTag} database.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Database.Open.SecondAttempt.Error.{DatabaseTag}"
enum="SqliteResultCode" expires_after="2025-12-03">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports sqlite errors triggered during the second attempt at opening the
{DatabaseTag} database. Databases can sometimes trigger a second open
attempt if the caller-provided error callback razes the database on open
failure.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Database.Success.OpenInternalTime.{DatabaseTag}"
units="microseconds" expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the time spent in OpenInternal, in microseconds, when opening the
{DatabaseTag} database.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Database.Success.SqliteOpenTime.{DatabaseTag}"
units="microseconds" expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the time spent in the sqlite3_open_v2 library call, in microseconds,
when opening the {DatabaseTag} database.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Recovery.Result" enum="SqlRecoveryResult"
expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-owp-storage@google.com</owner>
<summary>
Outcome of attempting to recover a database with sql::Recovery.
</summary>
</histogram>
<histogram name="Sql.Recovery.Result.{DatabaseTag}" enum="SqlRecoveryResult"
expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-owp-storage@google.com</owner>
<summary>
Outcome of attempting to recover the {DatabaseTag} database with
sql::Recovery.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Recovery.ResultCode" enum="SqliteLoggedResultCode"
expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-owp-storage@google.com</owner>
<summary>
SQLite result code from attempting to recover a database with sql::Recovery.
Note that kNoError does not necessarily indicate that recovery succeeded
(see Sql.Recovery.Result for that information), since not all recoveries
fail due to SQLite errors (e.g. if a version number could not be read from
the meta table).
</summary>
</histogram>
<histogram name="Sql.Recovery.ResultCode.{DatabaseTag}"
enum="SqliteLoggedResultCode" expires_after="2025-09-15">
<owner>asully@chromium.org</owner>
<owner>chrome-owp-storage@google.com</owner>
<summary>
SQLite result code from attempting to recover the {DatabaseTag} database
with sql::Recovery. Note that kNoError does not necessarily indicate that
recovery succeeded (see Sql.Recovery.Result for that information), since not
all recoveries fail due to SQLite errors (e.g. if a version number could not
be read from the meta table).
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Statement.ExecutionTime.{DatabaseTag}"
units="microseconds" expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the total time spent stepping for a given statement in database
{DatabaseTag}, in microseconds. Recorded when the statement is
reset/destructed, but only includes the time spent in `StepInternal` since
the statement's last reset.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Statement.StepTime.{DatabaseTag}" units="microseconds"
expires_after="2025-11-15">
<owner>anthonyvd@chromium.org</owner>
<owner>etienneb@chromium.org</owner>
<summary>
Reports the time of a single step of a statement running against
{DatabaseTag}, in microseconds. Recorded every time `Step` is called.
Only reported for clients with high-resolution clocks.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.Statement.{DatabaseTag}.VMSteps" units="count"
expires_after="2025-04-13">
<owner>etienneb@chromium.org</owner>
<owner>estade@chromium.org</owner>
<owner>chrome-owp-storage@google.com</owner>
<summary>
The number of virtual machine operations executed for {DatabaseTag}
database. It is reported once per statement. It can be used as a proxy of
total work done by queries executed over the database.
</summary>
<token key="DatabaseTag" variants="DatabaseTag"/>
</histogram>
<histogram name="Sql.vfs.SyncTime" units="ms" expires_after="2025-04-13">
<owner>etienneb@chromium.org</owner>
<owner>estade@chromium.org</owner>
<owner>chrome-owp-storage@google.com</owner>
<summary>
The time it takes to sync SQLite data to disk. The metric is recorded once
per flush. A SQLite operation may require multiple sync operation to ensure
database consistency.
</summary>
</histogram>
<histogram name="Storage.Blob.FileReaderLoader.DataPipeNotReadableMojoError"
enum="FileReaderLoaderMojoResult" expires_after="2025-02-16">
<owner>estade@chromium.org</owner>