chromium/tools/metrics/histograms/metadata/ai/histograms.xml

<!--
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 AI 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
[email protected].
-->

<histogram-configuration>

<histograms>

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

<variants name="SessionType">
  <variant name="Assistant" summary="AI assistant session"/>
  <variant name="Rewriter" summary="AI rewriter session"/>
  <variant name="Summarizer" summary="AI summarizer session"/>
  <variant name="Writer" summary="AI writer session"/>
</variants>

<!-- LINT.ThenChange(//third_party/blink/renderer/modules/ai/ai_metrics.h:AISessionType) -->

<histogram name="AI.Session.{SessionType}.PromptRequestSize" units="bytes"
    expires_after="2025-02-10">
  <owner>[email protected]</owner>
  <owner>[email protected]</owner>
  <summary>
    Measures the size of the prompt request in bytes. This is recorded each time
    when the model is executed.
  </summary>
  <token key="SessionType" variants="SessionType"/>
</histogram>

<histogram name="AI.Session.{SessionType}.PromptResponseCallbackCount"
    units="times" expires_after="2025-02-10">
  <owner>[email protected]</owner>
  <owner>[email protected]</owner>
  <summary>
    Measures the number of times that the callback is triggered in one prompt
    request. This is recorded each time when the model execution completes.
  </summary>
  <token key="SessionType" variants="SessionType"/>
</histogram>

<histogram name="AI.Session.{SessionType}.PromptResponseSize" units="bytes"
    expires_after="2024-12-11">
  <owner>[email protected]</owner>
  <owner>[email protected]</owner>
  <summary>
    Measures the size of the prompt response in bytes. This is recorded each
    time when the model execution completes.
  </summary>
  <token key="SessionType" variants="SessionType"/>
</histogram>

<histogram name="AI.Session.{SessionType}.PromptResponseStatus"
    enum="AIModelStreamingResponseStatus" expires_after="2025-02-10">
  <owner>[email protected]</owner>
  <owner>[email protected]</owner>
  <summary>
    Records the final response status for each prompt request. This is recorded
    each time when the stream completes or encounters errors.
  </summary>
  <token key="SessionType" variants="SessionType"/>
</histogram>

<histogram name="AI.{SessionType}.APIUsage" enum="AIAPI"
    expires_after="2024-12-11">
  <owner>[email protected]</owner>
  <owner>[email protected]</owner>
  <summary>
    This is recorded each time when the prompt JavaScript API is invoked. This
    can be used to measure the number of calls of each API within a particular
    time period.
  </summary>
  <token key="SessionType" variants="SessionType"/>
</histogram>

<histogram name="AI.{SessionType}.Availability" enum="AICapabilityAvailability"
    expires_after="2025-02-10">
  <owner>[email protected]</owner>
  <owner>[email protected]</owner>
  <summary>
    Records the availability of model execution as returned in methods like
    `ai.canCreateTextSession()`.
  </summary>
  <token key="SessionType" variants="SessionType"/>
</histogram>

</histograms>

</histogram-configuration>