<!--
Copyright 2022 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 Optimization 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>

<histogram name="BrowsingTopics.ApiActionType"
    enum="BrowsingTopicsApiActionType" expires_after="2024-03-17">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the action type of the request. Recorded when a topics request is
    handled in `BrowsingTopicsService`. Redirects (for fetch and xhr) will be
    counted as separate histogram entries.
  </summary>
</histogram>

<histogram name="BrowsingTopics.BrowsingTopicsState.LoadFinishStatus"
    enum="BooleanSuccess" expires_after="2024-03-24">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the load finish status of BrowsingTopicsState. Recored when the
    state is loaded from the file at the start of each browser session.
  </summary>
</histogram>

<histogram name="BrowsingTopics.EpochTopicsCalculation.CalculatorResultStatus"
    enum="BrowsingTopicsCalculatorResultStatus" expires_after="2024-03-24">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the browsing topics calculation result status (i.e. success, or the
    failure reason). Recored at the end of each (weekly) topics calculation.
  </summary>
</histogram>

<histogram
    name="BrowsingTopics.EpochTopicsCalculation.EligibleDistinctHistoryHostsCount"
    units="hosts" expires_after="2024-03-24">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the count of distinct history hosts that are eligible for topics
    calculation. Recorded during each (weekly) topics calculation after the
    observation domains are derived. In case of a calculation failure (e.g.
    permission denied, etc.), this metric won't be recorded.
  </summary>
</histogram>

<histogram name="BrowsingTopics.EpochTopicsCalculation.HistoryTopicsCount"
    units="topics" expires_after="2024-02-11">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the count of topics derived from history hosts in the past epoch
    (week). Recorded during each (weekly) topics calculation after the top
    topics are derived. In case of a calculation failure (e.g. permission
    denied, etc.), this metric won't be recorded.
  </summary>
</histogram>

<histogram
    name="BrowsingTopics.EpochTopicsCalculation.ObservationContextDomainsCountPerTopTopic"
    units="context domains" expires_after="2024-03-24">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the count of context domains for each of the calculated top topics.
    This won't exceed the cap number
    `kBrowsingTopicsMaxNumberOfApiUsageContextDomainsToKeepPerTopic`. Recorded
    once for each calculated top topics, during each (weekly) topics calculation
    after the observation domains are derived. In case of a calculation failure
    (e.g. permission denied; candidate topic was blocked; etc.), this metric
    won't be recorded.
  </summary>
</histogram>

<histogram name="BrowsingTopics.EpochTopicsCalculation.TimeBetweenCalculations"
    units="ms" expires_after="2024-02-20">
  <owner>abigailkatcoff@chromium.org</owner>
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the time between top topic calculations. Recorded when a topic
    calculation finishes and results from a prior epoch are available. This
    metric is recorded even in case of a calculation failure (e.g. permission
    denied, etc.).
  </summary>
</histogram>

<histogram
    name="BrowsingTopics.EpochTopicsCalculation.TopTopicsCountBeforePadding"
    units="topics" expires_after="2024-03-17">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the count of derived top topics before random ones are padded.
    Recorded during each (weekly) topics calculation after the top topics are
    derived. In case of a calculation failure (e.g. permission denied, etc.),
    this metric won't be recorded.
  </summary>
</histogram>

<histogram name="BrowsingTopics.JavaScriptAPI.TimeToResolve" units="ms"
    expires_after="2024-03-17">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the time it takes for document.browsingTopics() to resolve. Recorded
    each time the promise is resolved.
  </summary>
</histogram>

<histogram name="BrowsingTopics.OverrideList.FileLoadResult"
    enum="BrowsingTopicsOverrideListFileLoadResult" expires_after="2024-04-24">
  <owner>robertogden@chromium.org</owner>
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    The result of a single attempt to load the override list from disk, and
    parse it into a native object. Recorded once for every attempted load. Note
    that if an attempt fails it will not be re-attempted for the same file until
    the next browsing session, but a successful load will be recorded one or
    more times during a browsing session.
  </summary>
</histogram>

<histogram name="BrowsingTopics.OverrideList.UsedOverride" enum="Boolean"
    expires_after="2024-04-24">
  <owner>robertogden@chromium.org</owner>
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    When the override list is checked, whether it contained the given input.
  </summary>
</histogram>

<histogram name="BrowsingTopics.Result.FakeTopicCount" units="topics"
    expires_after="2024-03-01">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    When retrieving topics is a success, the number of those topics that were
    returned (weren't filtered) that were fake (noised).
  </summary>
</histogram>

<histogram name="BrowsingTopics.Result.FilteredTopicCount" units="topics"
    expires_after="2024-03-01">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    When retrieving topics is a success, the number of those topics that were
    not returned because they were filtered due to the caller not having
    observed the user on a site about that topic recently.
  </summary>
</histogram>

<histogram name="BrowsingTopics.Result.RealTopicCount" units="topics"
    expires_after="2024-03-01">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    When retrieving topics is a success, the number of those topics that were
    returned (weren't filtered) that were real topics (as opposed to noised).
  </summary>
</histogram>

<histogram name="BrowsingTopics.Result.Status"
    enum="BrowsingTopicsApiAccessResult" expires_after="2024-03-01">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records the result of attempts to retrieve the user's Topics (either via
    javascript or headers). The result is either success or an error.
  </summary>
</histogram>

<histogram name="BrowsingTopics.SiteDataStorage.InitStatus"
    enum="BooleanSuccess" expires_after="2024-01-21">
  <owner>yaoxia@chromium.org</owner>
  <owner>jkarlin@chromium.org</owner>
  <summary>
    Records initialization status of BrowsingTopics SiteDataStorage database.
    Recored when the database is lazily initialised when the first operation is
    encountered.
  </summary>
</histogram>

</histograms>

</histogram-configuration>
