<!--
Copyright 2026 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 Skills 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>

<!-- LINT.IfChange(SkillsManagementPage) -->

<variants name="Page">
  <variant name="BrowseSkills" summary="Browse skills page"/>
  <variant name="ErrorPage" summary="Error page"/>
  <variant name="YourSkills" summary="Your skills page"/>
</variants>

<!-- LINT.ThenChange(//components/skills/public/skill_metrics.mojom:SkillsManagementPage) -->

<!-- LINT.IfChange(SkillsDialogEntryPointAndState) -->

<variants name="SkillsDialogEntryPointAndState">
  <variant name="" summary="all entry points (aggregate)"/>
  <variant name=".ManagementPage.Blank"
      summary="the Management Page (+ Add button, empty fields)"/>
  <variant name=".ManagementPage.Prefilled"
      summary="the Management Page (editing a user skill)"/>
  <variant name=".ManagementPage.Remix"
      summary="the Management Page (editing a 1P template)"/>
  <variant name=".Unknown" summary="an Unknown entry point"/>
  <variant name=".WebClient.Blank"
      summary="the WebClient (+ button, empty fields)"/>
  <variant name=".WebClient.Prefilled"
      summary="the WebClient (save as skill / editing user skill)"/>
  <variant name=".WebClient.Remix"
      summary="the WebClient (editing a 1P template)"/>
</variants>

<!-- LINT.ThenChange(//components/skills/public/skills_metrics.h:SkillsDialogEntryPoint) -->

<!-- LINT.IfChange(SkillsLoadingStage) -->

<variants name="SkillsLoadingStage">
  <variant name="COOKIE_SYNC"
      summary="Time spent copying cookies from main profile."/>
  <variant name="GUEST_DATA_FETCH"
      summary="Time spent fetching initial skills data from Contrib service."/>
  <variant name="GUEST_FRAMEWORK"
      summary="Time to bootstrap the Angular framework."/>
  <variant name="GUEST_WEB_CLIENT"
      summary="Time to load and render initial skills data."/>
  <variant name="HANDSHAKE"
      summary="Time to establish postMessage connection."/>
  <variant name="NAVIGATION"
      summary="Time for webview to load and commit URL."/>
</variants>

<!-- LINT.ThenChange(//chrome/browser/resources/skills/v2/skills_webview_bridge_constants.ts:LoadingStage) -->

<histogram name="Skills.Dialog.PromptRefinementOutcome"
    enum="SkillsPromptRefinementOutcome" expires_after="2027-02-01">
  <owner>howardcha@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records whether a user saved a skill using the refined prompt, reverted it,
    or saved without refinement. This is tracked using undo/redo click counts at
    the time of save.

    This is a rough estimate. If the user manually edits the prompt after
    refinement without clicking undo, it is counted as using the refined prompt
    as it served as the base.
  </summary>
</histogram>

<histogram name="Skills.Dialog.{DialogType}{EntryPointAndState}.Action"
    enum="SkillsDialogAction" expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records user actions (e.g., Save, Cancel, Refine) specifically within the
    Skills {DialogType} dialog. Invoked from {EntryPointAndState}.
  </summary>
  <token key="DialogType">
    <variant name="Creation" summary="Creation dialog for new skills"/>
    <variant name="Edit" summary="Edit dialog for existing skills"/>
  </token>
  <token key="EntryPointAndState" variants="SkillsDialogEntryPointAndState"/>
</histogram>

<histogram name="Skills.Downloader.FirstParty.FetchResult"
    enum="SkillsFetchResult" expires_after="2027-02-01">
  <owner>aashnas@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the result status (success, network error, parse error, etc.) of a
    first-party skills download attempt.
  </summary>
</histogram>

<histogram name="Skills.Downloader.FirstParty.HttpResponseCode"
    enum="HttpResponseCode" expires_after="2027-02-01">
  <owner>aashnas@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>The HTTP response code received when downloading skills.</summary>
</histogram>

<histogram name="Skills.Invoke.Action" enum="SkillsInvokeAction"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records executions of Skills, categorized by the skill source.
  </summary>
</histogram>

<histogram name="Skills.Invoke.Result" enum="SkillsInvokeResult"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the terminal outcome (success or specific error state) of invoking a
    Skill via the Glic panel. This metric is used to calculate availability and
    reliability SLOs. Specific failure states include panel timeouts and
    requests for skills that no longer exist (e.g., deleted via sync).
  </summary>
</histogram>

<histogram name="Skills.Management.Error" enum="SkillsManagementError"
    expires_after="2027-02-01">
  <owner>aashnas@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records errors encountered during skills management operations (e.g.,
    service not ready, skill not found).
  </summary>
</histogram>

<histogram name="Skills.Management.FirstParty.DownloadRequestStatus"
    enum="SkillsDownloadRequestStatus" expires_after="2027-02-01">
  <owner>aashnas@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the status of a skills download request (success, already running,
    timeout).
  </summary>
</histogram>

<histogram name="Skills.Management.{Page}.Action" enum="SkillsManagementAction"
    expires_after="2027-02-01">
  <owner>aashnas@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records user actions on the Skills {Page}, such as adding, editing,
    deleting, or searching skills.
  </summary>
  <token key="Page" variants="Page"/>
</histogram>

<histogram name="Skills.Refine.Latency" units="ms" expires_after="2027-02-01">
  <owner>howardcha@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the end-to-end latency (in milliseconds) of a Skills prompt
    refinement request, from initiation to result parsing.

    This metric is recorded for both successful model executions and
    asynchronous model failures, but not for synchronous local validation
    failures.
  </summary>
</histogram>

<histogram name="Skills.Refine.Result" enum="SkillsRefineResult"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the terminal outcome of refining a Skill prompt using a server-side
    ML model. Tracks successful execution, model failures, protobuf parse
    errors, and cases where the model returns an empty suggestion list. Used to
    monitor feature health and model reliability.
  </summary>
</histogram>

<histogram name="Skills.Save.DerivedSource" enum="SkillsDerivedSource"
    expires_after="2027-02-01">
  <owner>esalma@google.com</owner>
  <owner>austinzzr@google.com</owner>
  <owner>cbe-productivity-eng@google.com</owner>
  <summary>
    Records the source of a derived skill when it is successfully saved. Emitted
    in SkillsServiceImpl::SetAndSaveSkill when the skill is derived from an
    Enterprise or First Party skill.
  </summary>
</histogram>

<histogram name="Skills.Save.Result" enum="SkillsSaveResult"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the terminal outcome of saving a new Skill or updating an existing
    one. Failure states differentiate between database/sync errors,
    initialization states (service not ready), and cases where the UI context is
    lost (dialog closed) before the save operation completes.
  </summary>
</histogram>

<histogram name="Skills.UserSkills.Count" units="skills"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the total number of skills a user possesses per profile. Used to
    measure adoption depth over time. This metric is recorded, potentially
    multiple times (once per profile) with every UMA log by
    SkillsMetricsProvider.
  </summary>
</histogram>

<histogram name="Skills.Webview.Handshake.Result" enum="Boolean"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records whether the postMessage handshake between the Skills host and guest
    Webview succeeded or timed out (after 5 seconds).
  </summary>
</histogram>

<histogram name="Skills.Webview.LoadingStageDuration.{Stage}" units="ms"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the duration of the {Stage} loading stage for the Skills Webview V2.
  </summary>
  <token key="Stage" variants="SkillsLoadingStage"/>
</histogram>

<histogram name="Skills.Webview.TotalInitLatency" units="ms"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the total initialization latency of the Skills Webview V2 on
    startup, from the beginning of init() to handshake completion.
  </summary>
</histogram>

<histogram name="Skills.Webview.WriteLatency" units="ms"
    expires_after="2027-02-01">
  <owner>michelleabreo@google.com</owner>
  <owner>skills-eng@google.com</owner>
  <summary>
    Records the time taken for the guest Webview to successfully save/update a
    skill over the network.
  </summary>
</histogram>

</histograms>

</histogram-configuration>
