<!--
Copyright 2020 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 Service 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="EmbeddedWorkerInitialStatus">
  <variant name="" summary=""/>
  <variant name=".RUNNING"
      summary="The service worker was in RUNNING state when
               ServiceWorkerMainResourceLoader was created."/>
  <variant name=".STARTING"
      summary="The service worker was in STARTING state when
               ServiceWorkerMainResourceLoader was created."/>
  <variant name=".STOPPED"
      summary="The service worker was in STOPPED state when
               ServiceWorkerMainResourceLoader was created."/>
  <variant name=".STOPPING"
      summary="The service worker was in STOPPING state when
               ServiceWorkerMainResourceLoader was created."/>
  <variant name=".WARMED_UP"
      summary="The service worker was in WARMED_UP state when
               ServiceWorkerMainResourceLoader was created."/>
  <variant name=".WARMING_UP"
      summary="The service worker was in WARMING_UP state when
               ServiceWorkerMainResourceLoader was created."/>
</variants>

<variants name="NavigationType">
  <variant name="" summary=""/>
  <variant name=".AnyOriginNavigation"
      summary="This is recorded for both cross-origin and same-origin
               navigation."/>
  <variant name=".CrossOriginNavigation"
      summary="This is only recorded when navigation is cross origin
               navigation."/>
  <variant name=".SameOriginNavigation"
      summary="This is only recorded when navigation is same origin
               navigation."/>
</variants>

<variants name="ServiceWorker_StartSituation2">
  <variant name=".DuringStartup"
      summary="The worker started up during browser startup."/>
  <variant name=".ExistingReadyProcess"
      summary="An existing ready process was used for the worker."/>
  <variant name=".ExistingUnreadyProcess"
      summary="An existing unready process was used for the worker."/>
  <variant name=".NewProcess"
      summary="A new process was created for the worker."/>
</variants>

<variants name="ServiceWorker_StartSituationDoNotUse">
  <variant name="_Any" summary="Includes any start situations."/>
  <variant name="_DuringStartup"
      summary="The worker started up during browser startup."/>
  <variant name="_ExistingReadyProcess"
      summary="An existing ready process was used for the worker."/>
  <variant name="_ExistingUnreadyProcess"
      summary="An existing unready process was used for the worker."/>
  <variant name="_NewProcess"
      summary="A new process was created for the worker."/>
</variants>

<variants name="ServiceWorkerCacheClientType">
  <variant name="Cache" summary="Collected from a CacheStorageCache instance"/>
  <variant name="CacheStorage"
      summary="Collected from a CacheStorage instance"/>
</variants>

<variants name="ServiceWorkerCacheProcessType">
  <variant name="Browser"
      summary="Measurements taken in the browser process on the IO thread"/>
  <variant name="Renderer"
      summary="Measurements taken in the renderer process on the javascript
               thread"/>
</variants>

<variants name="ServiceWorkerCacheSchedulerOpClientType">
  <variant name="Cache" summary="Collected from a CacheStorageCache instance"/>
  <variant name="CacheStorage"
      summary="Collected from a CacheStorage instance"/>
</variants>

<variants name="ServiceWorkerEventType">
  <variant name="ACTIVATE"/>
  <variant name="BACKGROUND_FETCH_ABORT"/>
  <variant name="BACKGROUND_FETCH_CLICK"/>
  <variant name="BACKGROUND_FETCH_FAIL"/>
  <variant name="BACKGROUND_FETCH_SUCCESS"/>
  <variant name="COOKIE_CHANGE"/>
  <variant name="FETCH_FENCED_FRAME"/>
  <variant name="FETCH_MAIN_FRAME"/>
  <variant name="FETCH_SHARED_WORKER"/>
  <variant name="FETCH_SUB_FRAME"/>
  <variant name="FETCH_SUB_RESOURCE"/>
  <variant name="INSTALL"/>
  <variant name="LONG_RUNNING_MESSAGE"/>
  <variant name="MESSAGE"/>
  <variant name="NAVIGATION_HINT"/>
  <variant name="NOTIFICATION_CLICK"/>
  <variant name="NOTIFICATION_CLOSE"/>
  <variant name="PUSH"/>
  <variant name="SYNC"/>
  <variant name="UNKNOWN"/>
</variants>

<variants name="ServiceWorkerFetchEventResult">
  <variant name="GOT_RESPONSE"/>
  <variant name="SHOULD_FALLBACK"/>
</variants>

<variants name="ServiceWorkerFetchResponseFromName">
  <variant name="ServiceWorker"/>
  <variant name="WithoutServiceWorker"/>
</variants>

<variants name="ServiceWorkerResponseSource">
  <variant name="" summary=""/>
  <variant name=".CacheStorage" summary="The response came from CacheStorage."/>
  <variant name=".HttpCache" summary="The response came from HttpCache."/>
  <variant name=".Network" summary="The response directly came from network."/>
  <variant name=".Unspecified"
      summary="The source of a response was unspecified."/>
</variants>

<variants name="ServiceWorkerSchedulerOp">
  <variant name="Close"/>
  <variant name="Delete"/>
  <variant name="GetAllMatched"/>
  <variant name="Has"/>
  <variant name="Init"/>
  <variant name="Keys"/>
  <variant name="Match"/>
  <variant name="MatchAll"/>
  <variant name="Open"/>
  <variant name="Put"/>
  <variant name="Size"/>
  <variant name="SizeThenClose"/>
  <variant name="WriteIndex"/>
  <variant name="WriteSideData"/>
</variants>

<histogram name="ServiceWorker.ActivateEvent.Time2" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Execution time of ServiceWorkerGlobalScope.onactivate. Includes the time for
    waitUntil() promise to settle.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.ActivateEventStatus{ServiceWorker_ShutdownStatus}"
    enum="ServiceWorkerStatusCode" expires_after="2025-11-30">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of dispatching the activate event to the worker. This is recorded
    to both ServiceWorker.ActivateEventStatus and whichever of
    ServiceWorker.ActivateEventStatus_InShutdown
    ServiceWorker.ActivateEventStatus_NotInShutdown is appropriate. (InShutdown
    means the context was null or ServiceWorkerProcessManger::Shutdown was
    called.) {ServiceWorker_ShutdownStatus}
  </summary>
  <token key="ServiceWorker_ShutdownStatus">
    <variant name=""/>
    <variant name="_InShutdown" summary="Browser shutdown started."/>
    <variant name="_NotInShutdown" summary="Browser shutdown has not started."/>
  </token>
</histogram>

<histogram name="ServiceWorker.AddNonWindowClient.SharedWorkerScript.IsBlob"
    enum="Boolean" expires_after="2025-09-12">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    True if Clients.matchAll() captures SharedWorker with blob URL.

    This is recorded when Clients.matchAll() is called and SharedWorker is found
    as a client. The entry will we added per SharedWorker entries regardless of
    its number.
  </summary>
</histogram>

<histogram name="ServiceWorker.AutoPreload.Dispatched" enum="Boolean"
    expires_after="2027-06-01">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether ServiceWorkerAutoPreload is dispatched or not.

    This metric is recorded for the main resource.
  </summary>
</histogram>

<histogram name="ServiceWorker.AutoPreload.DispatchResult"
    enum="ServiceWorkerAutoPreloadDispatchResult" expires_after="2027-06-01">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the result of attempting to dispatch ServiceWorkerAutoPreload. If it
    was not dispatched, records the specific reason why it was blocked.

    This metric is recorded for the main resource.
  </summary>
</histogram>

<histogram name="ServiceWorker.CacheStorageInstalledScript.CachedMetadataSize"
    units="bytes" expires_after="2026-07-05">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The length of cached metadata of scripts which are stored to the
    CacheStorage by the installing service worker.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.CacheStorageInstalledScript.CachedMetadataTotalSize"
    units="bytes" expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The total length of cached metadata of scripts which are stored to the
    CacheStorage by the installing service worker.
  </summary>
</histogram>

<histogram name="ServiceWorker.CacheStorageInstalledScript.Count" units="count"
    expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The counts of scripts which are stored to the CacheStorage by the installing
    service worker.
  </summary>
</histogram>

<histogram name="ServiceWorker.CacheStorageInstalledScript.ScriptSize"
    units="bytes" expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The length of scripts which are stored to the CacheStorage by the installing
    service worker.
  </summary>
</histogram>

<histogram name="ServiceWorker.CacheStorageInstalledScript.ScriptTotalSize"
    units="bytes" expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The total length of scripts which are stored to the CacheStorage by the
    installing service worker.
  </summary>
</histogram>

<histogram name="ServiceWorker.ChromeExtensionUpdateIPAddressSpace"
    enum="ServiceWorkerIPAddressSpace" expires_after="2027-01-24">
  <owner>hchao@chromium.org</owner>
  <owner>cthomp@chromium.org</owner>
  <owner>chrome-secure-web-and-net@google.com</owner>
  <summary>
    How many times we need to update the address space for an extensions service
    worker to kLoopback. Value of histogram is what address space was saved in
    the service worker registration database when the registration was loaded.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.ContainerHostForClient.AllowServiceWorkerCallTime"
    units="microseconds" expires_after="2026-09-06">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Time spent to check ServiceWorker allowed on the context. Recorded when
    ServiceWorker is registered, updated, or deleted for non-ServiceWorker
    client.

    Note: The metrics is reported from all clients. Some of clients may not have
    high resolution timer that can send metrics with microseconds precision.
  </summary>
</histogram>

<histogram name="ServiceWorker.CorsExemptHeaderListSize" units="count"
    expires_after="2027-01-17">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-loading@google.com</owner>
  <summary>
    The size of `cors_exempt_header_list` passed from the browser in the
    ServiceWorker startup.

    This is recorded in `WebServiceWorkerFetchContext::Create()`, in order to
    ensure the fix for crbug.com/40753993 doesn't introduce any changes to the
    given `cors_exempt_header_list` used in the ServiceWorker.
  </summary>
</histogram>

<histogram name="ServiceWorker.CountUse.CallerInterface"
    enum="WorkerOrWorkletInterfaceNameType" expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    When WorkerOrWorkletGlobalScope::CountUse() is called, this UMA records the
    current object's interface name. This UMA is for investigating
    crbug.com/40918057.
  </summary>
</histogram>

<histogram name="ServiceWorker.CountUse.DedicatedWorker.WebFeature"
    units="WebFeature" expires_after="2026-03-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    When WorkerOrWorkletGlobalScope::CountUse() is called for a dedicated
    worker, this UMA records the WebFeature to be recorded with the CountUse().
    Metrics that does not limit to the dedicated worker caller exists as
    ServiceWorker.CountUse.WebFeature. This UMA is for investigating
    crbug.com/40918057.
  </summary>
</histogram>

<histogram name="ServiceWorker.CountUse.WebFeature" units="WebFeature"
    expires_after="2027-01-17">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    When WorkerOrWorkletGlobalScope::CountUse() is called for a dedicated
    worker, this UMA records the WebFeature to be recorded with the CountUse().
    This UMA is for investigating crbug.com/40918057.
  </summary>
</histogram>

<histogram name="ServiceWorker.Database.DestroyDatabaseResult"
    enum="ServiceWorkerDatabaseStatus" expires_after="2027-01-03">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of destroy database operations in ServiceWorkerDatabase.
  </summary>
</histogram>

<histogram name="ServiceWorker.Database.OpenResult"
    enum="ServiceWorkerDatabaseStatus" expires_after="never">
<!-- expires-never: core storage metric; consumed in separate dashboard (go/chrome-storage-dashboard) -->

  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of opening a database for ServiceWorkerDatabase.
  </summary>
</histogram>

<histogram name="ServiceWorker.Database.ReadResult"
    enum="ServiceWorkerDatabaseStatus" expires_after="2027-01-03">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>Records result of read operations in ServiceWorkerDatabase.</summary>
</histogram>

<histogram name="ServiceWorker.Database.WriteResult"
    enum="ServiceWorkerDatabaseStatus" expires_after="2027-01-03">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of write operations in ServiceWorkerDatabase.
  </summary>
</histogram>

<histogram name="ServiceWorker.DiskCache.InitResult" units="units"
    expires_after="2024-08-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of opening a disk cache for ServiceWorkerDiskCache.
  </summary>
</histogram>

<histogram name="ServiceWorker.DiskCache.ReadResponseResult"
    enum="ServiceWorkerReadResponseResult" expires_after="2023-12-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of reading response from ServiceWorkerDiskCache.
  </summary>
</histogram>

<histogram name="ServiceWorker.DiskCache.WriteResponseResult"
    enum="ServiceWorkerWriteResponseResult" expires_after="2024-10-28">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of writing response into ServiceWorkerDiskCache. This is not
    recorded when response has no body. Note that this is recorded on every
    write operation, and can there can be multiple write operations for the same
    response if it is large enough.
  </summary>
</histogram>

<histogram name="ServiceWorker.EvaluateTopLevelScript.{ResultStatus}.Time"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    Execution time of the service worker's top level script. The metric is
    recorded for each startup of service workers. Recorded only when the
    evaluation was {ResultStatus}.
  </summary>
  <token key="ResultStatus">
    <variant name="Failed" summary="failed"/>
    <variant name="Succeeded" summary="succeeded"/>
  </token>
</histogram>

<histogram name="ServiceWorker.ExtendableMessageEvent.Time" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken between dispatching an ExtendableMessageEvent to a Service
    Worker and receiving a message that it finished handling the event. Includes
    the time for the waitUntil() promise to settle.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchEvent.Fallback.Time" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken between dispatching a FetchEvent to a Service Worker and
    receiving a fallback-to-network reply.

    This histogram was expired between roughly 2021-08-01 and 2021-09-30.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchEvent.HasResponse.Time" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken between dispatching a FetchEvent to a Service Worker and
    receiving a response. Includes the time for the respondWith() promise to
    settle.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchEvent.MainResource.Status"
    enum="ServiceWorkerStatusCode" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of dispatching a fetch event to a Service Worker for a main
    resource request (i.e., a request for a navigation or a shared worker).
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchEvent.QueuingTime" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time that a fetch event was queued. The start time is when the event is
    created on the service worker thread and added to the
    ServiceWorkerEventQueue. The end time is when the event is dequeued and the
    event handler starts to execute.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchEvent.Subresource.Status"
    enum="ServiceWorkerStatusCode" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of dispatching a fetch event to a Service Worker for a
    subresource request (i.e., not a navigation or a shared worker request).
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchEvent.{Resource}.FetchResponseFrom"
    enum="ServiceWorkerFetchResponseFrom" expires_after="2027-02-14">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of the RaceNetworkRequest. RaceNetworkRequest runs a race between
    the network request which bypasses ServiceWorker, and the other request
    which goes through the fetch handler. This metric is recorded for
    {Resource}.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.FetchEvent.{Resource}.RaceNetworkRequest.CloneResponseForFetchHandlerCancelled"
    enum="Boolean" expires_after="2027-01-31">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Recorded as true when the data cloning from the original response to the
    data pipe for the fetch handler is cancelled not to pause the data transfer
    for the network request.

    This metric is recorded per {Resource}. Recorded only when
    `ServiceWorkerStaticRouterRaceNetworkRequestPerformanceImprovement` is
    disabled, and recorded in the destructor of
    `ServiceWorkerRaceNetworkRequestURLLoaderClient`.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.FetchEvent.{Resource}.RaceNetworkRequest.DataTransferResult"
    enum="RaceNetworkRequestDataTransferResult" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Recorded the result of data transfer from the original netowrk response to
    the data pipes for both the network and the fetch handler.

    This metric is recorded per {Resource}. Recorded only when
    `ServiceWorkerStaticRouterRaceNetworkRequestPerformanceImprovement` is
    enabled, and recorded in the destructor of
    `ServiceWorkerRaceNetworkRequestURLLoaderClient`.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.FetchEvent.{Resource}.RaceNetworkRequest.ForwardedFactory.CreateLoaderAndStart.MultipleCalls"
    enum="Boolean" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Recorded when
    ServiceWorkerForwardedRaceNetworkRequestURLLoaderFactory::CreateLoaderAndStart()
    is called. It is recorded as false for the first call, and true for any
    subsequent calls. This is to measure how often this method is called
    multiple times, which is not expected for a legitimate renderer.

    This metric is recorded per {Resource}.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.FetchEvent.{Resource}.RaceNetworkRequest.IsCloningDataFinishedBeforeResponseComplete"
    enum="Boolean" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Recorded as true when the data cloning from the original response to the
    data pipe for the fetch handler is completed, but still the completion
    status via `ServiceWorkerRaceNetworkRequestURLLoaderClient::OnComplete()` is
    not invoked.

    This metric is recorded per {Resource}.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.FetchEvent.{Resource}.RaceNetworkRequest.Redirect"
    enum="Boolean" expires_after="2026-12-20">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result if the RaceNetworkRequest received a redirect response.
    RaceNetworkRequest runs a race between the network request which bypasses
    ServiceWorker, and the other request which goes through the fetch handler.
    This metric is recorded for {Resource}.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram name="ServiceWorker.FetchHandler.SkipReason"
    enum="ServiceWorkerFetchHandlerSkipReason" expires_after="2025-05-11">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The reason why the service worker fetch handler has been skipped. If the
    fetch handler has not been skipped for any reasons, it is just recorded as
    not skipped instead.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchHandler.TypeAtContinueWithActivatedVersion"
    enum="ServiceWorkerFetchHandlerType" expires_after="2024-09-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The type of the fetch handler recorded just before dispatching the fetch
    handler. This represent the fetch handler type, and does not represent if
    the fetch handler is skipped or not.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FetchInFetchHandler.PostRespondWithRaceFetchNetError"
    enum="NetErrorCodes" expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records net::Error code (as a positive integer) when a Service Worker fetch
    request with a race network request token fails after its matching
    respondWith observer has already settled/been erased. Note that this
    includes requests that fell back to the regular network loader (e.g. due to
    pipe disconnection).
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FetchInFetchHandler.PostRespondWithRaceURLLoaderNetError"
    enum="NetErrorCodes" expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records net::Error code (as a positive integer) when a Service Worker fetch
    fails after its matching respondWith observer has already settled/been
    erased, specifically when the RaceNetworkRequest URLLoaderFactory (the pipe
    to the browser process) was actually used for the fetch.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchInFetchHandler.RaceFetchNetError"
    enum="NetErrorCodes" expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records net::Error code (as a positive integer, where 0 is net::OK for
    success) when any Service Worker fetch request with a race network request
    token completes (both during and after respondWith). Note that this includes
    requests that fell back to the regular network loader (e.g. due to pipe
    disconnection).
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FetchInFetchHandler.RaceNetworkRequestLoaderState"
    enum="ServiceWorkerRaceNetworkRequestLoaderState"
    expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the loader state (e.g. race loader used, or reason for fallback)
    when a fetch request with a Service Worker race network request token is
    initiated in the Service Worker fetch handler.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FetchInFetchHandler.RaceNetworkRequestLoaderState.Failure"
    enum="ServiceWorkerRaceNetworkRequestLoaderState"
    expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the loader state when a fetch request with a Service Worker race
    network request token fails.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FetchInFetchHandler.RaceNetworkRequestLoaderState.Success"
    enum="ServiceWorkerRaceNetworkRequestLoaderState"
    expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the loader state when a fetch request with a Service Worker race
    network request token completes successfully.
  </summary>
</histogram>

<histogram name="ServiceWorker.FetchInFetchHandler.RaceURLLoaderNetError"
    enum="NetErrorCodes" expires_after="2027-07-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records net::Error code (as a positive integer, where 0 is net::OK for
    success) when a Service Worker fetch request completes (both during and
    after respondWith), specifically when the RaceNetworkRequest
    URLLoaderFactory (the pipe to the browser process) was actually used for the
    fetch.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FindRegistrationForClientUrl.IsCalledForNavigation"
    enum="Boolean" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether FindRegistrationForClientUrl() is called for navigation or not. This
    is recorded when FindRegistrationForClientUrl() function is called.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.FindRegistrationForClientUrl.SkippedMojoCall.OnNavigation2{StorageKeyIsFirstParty}"
    enum="BooleanSkipped" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether FindRegistrationForClientUrl() could skip calling mojo API. This is
    recorded only when FindRegistrationForClientUrl() is used for navigation,
    and when the {StorageKeyIsFirstParty}.
  </summary>
  <token key="StorageKeyIsFirstParty">
    <variant name="" summary="StorageKey is a first-party or third-party"/>
    <variant name=".StorageKeyIsFirstParty"
        summary="StorageKey is a first-party"/>
  </token>
</histogram>

<histogram name="ServiceWorker.FindRegistrationForClientUrl.Time" units="ms"
    expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    Execution time of FindRegistrationForClientUrl until continuation is called.
    The metric is not recorded during startup.
  </summary>
</histogram>

<histogram name="ServiceWorker.FoundServiceWorkerRegistrationOnNavigation"
    enum="BooleanFound" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether ServiceWorkerControlleeRequestHandler::MaybeCreateLoader found a
    service worker registration after looking up the registration by using
    FindRegistrationForClientUrl.
  </summary>
</histogram>

<histogram name="ServiceWorker.GetClient.SharedWorkerScript.IsBlob"
    enum="Boolean" expires_after="2026-05-24">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    True if Clients.match() looks up the SharedWorker client and it is a blob
    URL client.

    This will be recorded when the Clients.match() is called, and SharedWorker
    matches.
  </summary>
</histogram>

<histogram name="ServiceWorker.GetClients.ExtensionController.{type}"
    units="clients" expires_after="2026-08-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The number of clients controlled by the Chrome Extension. It has been
    measured when `Clients.matchAll()` is called by the Extension ServiceWorker.
    This is a metrics that is counted for {type}.
  </summary>
  <token key="type">
    <variant name="AllClients" summary="all clients"/>
    <variant name="WindowClients" summary="window clients"/>
  </token>
</histogram>

<histogram name="ServiceWorker.InstallEvent.All.FetchCount" units="fetches"
    expires_after="2023-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The number of network fetches performed by the install event handler.
  </summary>
</histogram>

<histogram name="ServiceWorker.InstallEvent.{type}.Status"
    enum="ServiceWorkerStatusCode" expires_after="2023-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of dispatching the install event to the worker. This histogram
    includes data for {type}.
  </summary>
  <token key="type">
    <variant name="All" summary="all install events"/>
    <variant name="WithFetch"
        summary="install events that made network fetches"/>
  </token>
</histogram>

<histogram name="ServiceWorker.InstallEvent.{type}.Time" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken between dispatching an InstallEvent to a Service Worker and
    receiving a message that it finished handling the event. Includes the time
    for the waitUntil() promise to settle. This histogram includes data for
    {type}.
  </summary>
  <token key="type">
    <variant name="All" summary="all install events"/>
    <variant name="WithFetch"
        summary="install events that made network fetches"/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.AutoPreloadResponseReceivedToFetchHandlerEnd.{ServiceWorkerFetchResponseFromName}"
    units="ms" expires_after="2027-01-31">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the response of the AutoPreload is received, to (b)
    the fetch handler execution is completed.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler, the fetch event was successfully dispatched to the
    service worker, and ServiceWorkerAutoPreload is enabled.

    This is recorded even in the case when (b) is faster than (a). In this case
    the value will be 0.

    The response is from {ServiceWorkerFetchResponseFromName}
  </summary>
  <token key="ServiceWorkerFetchResponseFromName"
      variants="ServiceWorkerFetchResponseFromName"/>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerEndToFallbackNetwork{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) renderer process sends an IPC message to notify that
    a resource loading request needs to be fall back to network, to (b) browser
    process received the IPC. Recorded when no fetch event handler provided a
    response to the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerEndToResponseReceived{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2026-05-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) renderer process sends an IPC message to notify that
    a promise of respondWith() is settled, to (b) browser process received the
    IPC message. Recorded when a fetch event handler handled the request and
    provided a response to the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerStartToFetchHandlerEndByFetchResult_{ServiceWorkerFetchEventResult}"
    units="ms" expires_after="2026-05-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) a fetch event is dispatched, to (b) respondWith() is
    settled for the fetch event, or fetch event dispatch is finished without
    respondWith() being called.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    The records are breakdown by FetchEventResult.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FetchHandlerStartToFetchHandlerEnd{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) a fetch event is dispatched, to (b) respondWith() is
    settled for the fetch event, or fetch event dispatch is finished without
    respondWith() being called.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FindRegistrationToCompleted{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the start of finding service worker registration, to
    (b) reading response body is completed. Recorded when a fetch event handler
    handled the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
  <token key="EmbeddedWorkerInitialStatus"
      variants="EmbeddedWorkerInitialStatus"/>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FindRegistrationToFallbackNetwork{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the start of finding service worker registration, to
    (b) browser process received the IPC. Recorded when no fetch event handler
    provided a response to the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.FindRegistrationToRequestStart{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the start of finding service worker registration, to
    (b) the start of a navigation request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.ForwardServiceWorkerToWorkerReady2{EmbeddedWorkerInitialStatus}{NavigationType}"
    units="ms" expires_after="2027-02-07">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) a resource loading request is routed to service
    worker path, to (b) a service worker is ready to handle the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    Please note that this histogram has accidentally changed the bucket
    definition from 117.0.5874.0. Previously,
    DEPRECATED_UMA_HISTOGRAM_MEDIUM_TIMES() was used, and it was replaced with
    base::UmaHistogramMediumTimes(). DEPRECATED_UMA_HISTOGRAM_MEDIUM_TIMES()
    starts the bucket from 10ms whereas base::UmaHistogramMediumTimes() starts
    the bucket from 1ms.

    {EmbeddedWorkerInitialStatus}{NavigationType}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.InitialServiceWorkerStatus{NavigationType}{FrameTreeNodeType}{BrowserStartupCompleted}"
    enum="InitialServiceWorkerStatus" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The initial service worker status.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {NavigationType}{FrameTreeNodeType}{BrowserStartupCompleted}

    This histogram was skewed between roughly 2024-05-07 and 2024-09-03.
  </summary>
  <token key="NavigationType" variants="NavigationType"/>
  <token key="FrameTreeNodeType">
    <variant name="" summary=""/>
    <variant name=".NotOutermostMainFrame"
        summary="Navigation is only recorded when it occurs in the non
                 outermost main frame."/>
    <variant name=".OutermostMainFrame"
        summary="Navigation is only recorded when it occurs in the outermost
                 main frame."/>
    <variant name=".Unknown"
        summary="Navigation is recorded only when it is not possible to
                 determine whether it occurs in the outermost main frame or
                 not."/>
  </token>
  <token key="BrowserStartupCompleted">
    <variant name="" summary=""/>
    <variant name=".BrowserStartupCompleted"
        summary="The browser startup has been completed already."/>
    <variant name=".BrowserStartupNotCompleted"
        summary="The browser startup has not been completed yet."/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.ResponseReceivedToCompleted2{ServiceWorkerResponseSource}{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) response headers from service worker are received,
    to (b) reading response body is completed. Recorded when a fetch event
    handler handled the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {ServiceWorkerResponseSource} {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.ServiceWorkerIsStopped.WaitingForWarmUp"
    enum="Boolean" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Record true if the service worker is waiting for being warmed up. Otherwise
    record false.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and service worker is a STOPPED state.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.StartToCompleted{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the start of a navigation request, to (b) reading
    response body is completed. Recorded when a fetch event handler handled the
    request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.StartToFallbackNetwork{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the start of a navigation request, to (b) browser
    process received the IPC. Recorded when no fetch event handler provided a
    response to the request.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.StartToForwardServiceWorker{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the start of a navigation request, to (b) the
    request is forwarded to a service worker code path.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.MainFrame.MainResource.WorkerReadyToFetchHandlerStart{EmbeddedWorkerInitialStatus}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) browser process sends an IPC message to dispatch a
    fetch event, to (b) a renderer process received the IPC message and is about
    to dispatch a fetch event.

    Recorded for each navigation request (including redirects) where there is a
    fetch event handler and the fetch event was successfully dispatched to the
    service worker.

    {EmbeddedWorkerInitialStatus}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.Subresource.AutoPreloadResponseReceivedToFetchHandlerEnd.{ServiceWorkerFetchResponseFromName}"
    units="ms" expires_after="2026-05-01">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) the response of the AutoPreload is received, to (b)
    the fetch handler execution is completed.

    Recorded for each subresource request where there is a fetch event handler,
    the fetch event was successfully dispatched to the service worker, and
    ServiceWorkerAutoPreload is enabled.

    This is recorded even in the case when (b) is faster than (a). In this case
    the value will be 0.

    The response is from {ServiceWorkerFetchResponseFromName}
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.Subresource.FetchHandlerEndToFallbackNetwork"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) service worker sends a mojo message to notify that a
    resource loading request needs to be fall back to network, to (b) the mojo
    message is received on the other side of mojo endpoint (a background thread
    executing subresource loading). Recorded when no fetch event handler
    provided a response to the request.

    Recorded for each subresource request where there is a fetch event handler
    and the fetch event was successfully dispatched to the service worker.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.Subresource.FetchHandlerEndToResponseReceived"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) service worker sends a mojo message to notify that a
    promise of respondWith() is settled, to (b) the mojo message is received on
    the other side of mojo endpoint (a background thread executing subresource
    loading). Recorded when a fetch event handler handled the request and
    provided a response to the request.

    Recorded for each subresource request where there is a fetch event handler
    and the fetch event was successfully dispatched to the service worker.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.Subresource.ForwardServiceWorkerToWorkerReady"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) a subresource request is routed to the URLLoader (on
    a background thread) for service worker controlled loads starts handling a
    subresource request, to (b) a service worker is ready to handle the request.

    Recorded for each subresource request where there is a fetch event handler
    and the fetch event was successfully dispatched to the service worker.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.Subresource.ResponseReceivedToCompleted2{ServiceWorkerResponseSource}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) response headers from service worker are received,
    to (b) reading response body is completed. Only recorded when a fetch event
    handler handled the request.

    Recorded for each subresource request where there is a fetch event handler
    and the fetch event was successfully dispatched to the service worker.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTiming.Subresource.WorkerReadyToFetchHandlerEnd"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The time taken from (a) a fetch event is dispatched, to (b) respondWith() is
    settled for the fetch event, or fetch event dispatch is finished without
    respondWith() being called.

    Recorded for each subresource request where there is a fetch event handler
    and the fetch event was successfully dispatched to the service worker.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.LoadTopLevelScript.{ResultStatus}.{WhetherAlreadyInstalledOrNot}.Time"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    Loading time of the service worker's top level script. The metric is
    recorded for each startup of service workers. Recorded only when the loading
    was {ResultStatus}, and the service worker scripts were
    {WhetherAlreadyInstalledOrNot}.
  </summary>
  <token key="WhetherAlreadyInstalledOrNot">
    <variant name="AlreadyInstalled" summary="already installed"/>
    <variant name="NewlyInstalled" summary="newly installed"/>
  </token>
  <token key="ResultStatus">
    <variant name="FailedToFetchClassicScript"
        summary="failed to fetch classic script"/>
    <variant name="FailedToFetchModuleScript"
        summary="failed to fetch module script"/>
    <variant name="Succeeded" summary="succeeded"/>
  </token>
</histogram>

<histogram name="ServiceWorker.MainFrame.MainResource.FetchResult"
    enum="ServiceWorkerFetchEventResult" expires_after="2026-12-27">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the fetch result after the fetch handler has been dispatched. This
    is recorded after dispatching the fetch event handler to a service worker,
    and it executed the handler without error (i.e. abort or timeout).
  </summary>
</histogram>

<histogram name="ServiceWorker.MainScriptUrlValidationResult"
    enum="ServiceWorkerMainScriptUrlValidationResult"
    expires_after="2026-10-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the result of validating a service worker main script request in the
    browser process. A &quot;forged&quot; result indicates that the renderer
    process (potentially compromised) sent a request that does not match the
    expected script URL, destination, or mode.
  </summary>
</histogram>

<histogram name="ServiceWorker.MaybeStartWorker.Purpose"
    enum="ServiceWorkerMetrics.EventType" expires_after="2025-12-14">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the purpose for potentially starting a service worker. This is
    recorded every time a running worker is required whether it needs to be
    started or not in the ServiceWorkerVersion::RunAfterStartWorker() method.
  </summary>
</histogram>

<histogram name="ServiceWorker.MaybeStartWorker.RunningStatus"
    enum="EmbeddedWorkerStatus" expires_after="2027-02-07">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Record the current status of a service worker when we need it to be running
    for some purpose. If the status is STOPPED or STOPPING then the service
    worker will be started. This is recorded from
    ServiceWorkerVersion::RunAfterStartWorker().

    See also ServiceWorker.MaybeStartWorker.RunningStatusByPurpose_* for the
    breakdown by event type.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.MaybeStartWorker.RunningStatusByPurpose_{ServiceWorkerEventType}"
    enum="EmbeddedWorkerStatus" expires_after="2026-08-02">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Record the current status of a service worker when we need it to be running
    broken down by the purpose for needing a worker. If the status is STOPPED or
    STOPPING then the service worker will be started. This is recorded from
    ServiceWorkerVersion::RunAfterStartWorker(). (see
    ServiceWorker.MaybeStartWorker.RunningStatus for all attempts).
  </summary>
  <token key="ServiceWorkerEventType" variants="ServiceWorkerEventType"/>
</histogram>

<histogram name="ServiceWorker.MessageDispatch.ContextValidation"
    enum="ServiceWorkerMessageDispatchContextValidationResult"
    expires_after="2026-10-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the result of context validation when dispatching an extendable
    message event to a service worker or client. Recorded every time a message
    is dispatched.
  </summary>
</histogram>

<histogram name="ServiceWorker.NumberOfRegisteredFetchHandlers"
    units="handlers" expires_after="2024-02-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The number of fetch handlers registered in a service worker script. This
    metrics is recorded every time a service worker starts and only includes
    fetch event handlers registered at script evaluation time.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.OnBrowserStartup.FirstFindRegistrationForClientUrl.Time"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    Execution time of FindRegistrationForClientUrl until continuation is called.
    It is recorded only once on browser startup.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.OnBrowserStartup.SkipServiceWorkerOnFirstNavigation"
    enum="BooleanSkipped" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether the first navigation requires checking the existence of service
    worker registration in DB. It is recorded only once on browser startup.
  </summary>
</histogram>

<histogram name="ServiceWorker.OnStarted.UpdatedFetchHandlerType"
    enum="ServiceWorkerFetchHandlerType" expires_after="2027-01-17">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The type of the fetch handler type to be stored in the database for update.

    During the start of ServiceWorker, the fetch handler type is decided, and
    sent via OnStarted. If the fetch handler type is different from the fetch
    handler type already recognized and stored before, it will eventually be
    updated when it is read from the database next time.

    This metrics records the name of the new fetch handler detected.
    ServiceWorker.OnStarted.UpdatedFetchHandlerTypeBySourceType_* for the
    breakdown by the source fetch handler type.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.OnStarted.UpdatedFetchHandlerTypeBySourceType_{SourceType}"
    enum="ServiceWorkerFetchHandlerType" expires_after="2026-09-06">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The type of the fetch handler type to be stored in the database for update
    per the source fetch handler type {SourceType} (See
    ServiceWorker.OnStarted.UpdatedFetchHandlerType for all attenpts).

    During the start of ServiceWorker, the fetch handler type is decided, and
    sent via OnStarted. If the fetch handler type is different from the fetch
    handler type already recognized and stored before, it will eventually be
    updated when it is read from the database next time.

    This metrics records the name of the new fetch handler detected.
  </summary>
  <token key="SourceType">
    <variant name="EMPTY_FETCH_HANDLER"
        summary="skippable empty fetch handler"/>
    <variant name="NO_HANDLER" summary="no fetch handler"/>
    <variant name="NOT_SKIPPABLE" summary="not skippable fetch handler"/>
  </token>
</histogram>

<histogram name="ServiceWorker.OpenWindow.UrlScheme" enum="OpenWindowUrlScheme"
    expires_after="2026-10-31">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The URL scheme of Clients.openWindow()'s URL argument. This is recorded when
    the openWindow() is called.
  </summary>
</histogram>

<histogram name="ServiceWorker.PaymentHandler.DisconnectTimeout"
    enum="BooleanTimedOut" expires_after="2026-12-27">
  <owner>smcgruer@chromium.org</owner>
  <owner>perryuwang@gmail.com</owner>
  <owner>chrome-payments-eng@google.com</owner>
  <summary>
    Records whether a payment handler connection was disconnected due to a
    timeout. True indicates the disconnect was due to the 20-minute timeout
    firing, false indicates an external disconnect (e.g., the payment handler
    window was closed by the user or the payment was completed). This is
    recorded each time the payment_handler_connected_ flag is set to false.
  </summary>
</histogram>

<histogram name="ServiceWorker.PaymentRequestEvent.Time" units="ms"
    expires_after="2027-07-16">
  <owner>rouslan@chromium.org</owner>
  <owner>chrome-payments-eng@google.com</owner>
  <owner>zino@chromium.org</owner>
  <summary>
    The time taken between dispatching an PaymentRequestEvent to a Service
    Worker and receiving a message that it finished handling the event. Includes
    the time for the waitUntil() promise to settle.
  </summary>
</histogram>

<histogram name="ServiceWorker.PeriodicBackgroundSyncEvent.Time" units="ms"
    expires_after="2023-10-01">
  <owner>nator@chromium.org</owner>
  <owner>platform-capabilities@chromium.org</owner>
  <summary>
    The time taken between dispatching a PeriodicSyncEvent to a Service Worker
    and receiving a message that it finished handling the event. Includes the
    time for the waitUntil() promise to settle.
  </summary>
</histogram>

<histogram name="ServiceWorker.RegisteredStorageKeyCount" units="origins"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The number of StorageKeys that have a service worker registration. Recorded
    near browser startup, when the service worker storage system is initialized.
  </summary>
</histogram>

<histogram name="ServiceWorker.Registration.Delete.Initiator"
    enum="ServiceWorkerRegistrationDeleteInitiator" expires_after="2026-09-27">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The initiator of a service worker registration deletion. This is recorded
    when a deletion is triggered.
  </summary>
</histogram>

<histogram name="ServiceWorker.Registration.Delete.Result.{DeleteInitiator}"
    enum="ServiceWorkerStatusCode" expires_after="2026-10-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of deleting a service worker registration. This is recorded when
    the deletion from the database is complete. The histogram is broken down by
    the initiator of the deletion.
  </summary>
  <token key="DeleteInitiator">
    <variant name="ByContentPublicApi"
        summary="Triggered via the public C++ API
                 (ServiceWorkerContext::UnregisterServiceWorker and
                 ServiceWorkerContext::UnregisterServiceWorkerImmediately),
                 typically by extensions or DevTools."/>
    <variant name="ByDeleteForStorageKey"
        summary="Triggered by clearing site data."/>
    <variant name="ByForceDelete"
        summary="Triggered by an emergency force-delete mechanism (e.g., when
                 the script can't be read from the disk)."/>
    <variant name="ByRegistrationFailure"
        summary="Triggered by a registration failure (e.g., when a
                 resurrected uninstalling registration fails to be
                 re-registered)."/>
    <variant name="ByTest" summary="Triggered from a test."/>
    <variant name="ByUnregister"
        summary="Triggered by an explicit call to
                 navigator.serviceWorker.unregister()."/>
    <variant name="ByWebUI"
        summary="Triggered by a user action on the
                 chrome://serviceworker-internals page."/>
  </token>
</histogram>

<histogram name="ServiceWorker.ResourceChecksumMatch" enum="Boolean"
    expires_after="2027-02-14">
  <owner>elkurin@chromium.org</owner>
  <owner>chrome-storage-team-tokyo@google.com</owner>
  <summary>
    Records whether the checksum of a service worker resource matches the
    expected checksum. This is used to detect data corruption.

    Recorded after a service worker resource has been read from the disk, to
    indicate whether the resource's checksum matches the expected checksum.
  </summary>
</histogram>

<histogram name="ServiceWorker.RouterEvaluator.Error"
    enum="ServiceWorkerRouterEvaluatorErrorEnums" expires_after="2027-02-14">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    An error that happens in ServiceWorkerRouterEvaluator setup. For calculating
    an error ratio, no error case is also recorded. This metrics will be
    recorded per ServiceWorkerRouterEvaluator instance.
  </summary>
</histogram>

<histogram name="ServiceWorker.RouterEvaluator.EvaluationTime"
    units="microseconds" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Time spent for the router evaluation to handle a request. Recorded when the
    service worker has associated routing info, and the browser or renderer is
    processing requests. Both main resource and subresource record this metric
    when being processed.

    This histogram only records metrics on machines with high-resolution clocks.
  </summary>
</histogram>

<histogram name="ServiceWorker.RouterEvaluator.MatchedFirstSourceType"
    enum="ServiceWorkerRouterSourceType" expires_after="2026-12-27">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of the router evaluation of the ServiceWorker Static Routing API.
    This indicates which source type is used to get the resource. This will be
    recorded only when the router has matched the incoming resource.
  </summary>
</histogram>

<histogram name="ServiceWorker.RouterEvaluator.RuleCount" units="count"
    expires_after="2027-01-03">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The sum of registered router rules with the ServiceWorker Static Routing
    API. Recorded when the service worker, which has associated routing info, is
    activated. This was broken from 2024-02-07 to 2024-04-07.
  </summary>
</histogram>

<histogram name="ServiceWorker.RouterEvaluator.SubresourceTotalEvaluationTime"
    units="microseconds" expires_after="2027-09-06">
  <owner>suzukikeita@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Total time spent for the router evaluation to handle a request for the
    subresources. Recorded when the service worker has associated routing info
    at the end of each page load or when the page is navigated away, the browser
    is closed, or on Android when the browser is backgrounded.

    This histogram only records metrics on machines with high-resolution clocks.
  </summary>
</histogram>

<histogram name="ServiceWorker.SharedWorker.ResourceFetch.FromBlob"
    enum="Boolean" expires_after="2026-06-07">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether a resource fetch initiated inside a blob script SharedWorker uses
    ServiceWorker.

    This is recorded when an URLLoader is created to fetch resources inside
    SharedWorker.
  </summary>
</histogram>

<histogram name="ServiceWorker.SharedWorker.ResourceFetch.UseServiceWorker"
    enum="Boolean" expires_after="2026-06-07">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether a resource fetch initiated inside a SharedWorker uses ServiceWorker.

    This is recorded when an URLLoader is created to fetch resources inside
    SharedWorker.
  </summary>
</histogram>

<histogram name="ServiceWorker.SharedWorkerScript.IsBlob" enum="Boolean"
    expires_after="2026-06-07">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether a SharedWorker script got via a ServiceWorker is a blob URL or not.
    This metrics is recorded in the main resource loader intereceptor during the
    script loading.
  </summary>
</histogram>

<histogram name="ServiceWorker.SkipCallingFindRegistrationForClientUrl"
    enum="BooleanSkipped" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Whether the navigation requires checking the existence of service worker
    registration by using FindRegistrationForClientUrl(). This metric is not
    recorded during startup.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartNewWorker.Time" units="ms"
    expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken to start a Service Worker that has not yet installed, from
    process allocation to ACK of started from the renderer (which occurs after
    script execution). This may include script download time. The metric is not
    recorded if DevTools was ever attached to the Service Worker during startup.
    See also ServiceWorker.StartWorker.Time for installed workers.

    This histogram was expired between approximately Feb through Sep 2021.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.StartTiming.ClockConsistency{ServiceWorker_StartSituation2}"
    enum="CrossProcessTimeDelta" expires_after="2026-09-27">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Recorded on each successful service worker startup.
    ServiceWorker.StartTiming.* uses timing data from both the renderer process
    and browser process. This histogram describes whether the clocks are known
    to be accurate and consistent accross processes, and whether the actual
    timing data for this worker startup was consistent, i.e., TimeTicks did not
    go backwards.

    If the clocks and timing were inconsistent, ServiceWorker.StartTiming.*
    metrics (other than this one) are not recorded.

    This histogram was expired between roughly 2021-07-30 and 2021-09-31.
    {ServiceWorker_StartSituation2}
  </summary>
  <token key="ServiceWorker_StartSituation2"
      variants="ServiceWorker_StartSituation2">
    <variant name=""/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.StartTiming.Duration{ServiceWorker_StartSituation2}"
    units="ms" expires_after="2026-01-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken to start a service worker that is already installed, from
    start of the start sequence (finding a renderer) to ACK of started from the
    renderer (which occurs after script execution). The metric is not recorded
    if DevTools was ever attached to the Service Worker during startup. It does
    not include time, if any, waiting for the service worker to finish stopping
    before asking it to start, if that occurred.

    This histogram was expired between roughly 2021-07-30 and 2021-09-31.
    {ServiceWorker_StartSituation2}
  </summary>
  <token key="ServiceWorker_StartSituation2"
      variants="ServiceWorker_StartSituation2">
    <variant name=""/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.StartTiming.ReceivedStartWorkerToScriptEvaluationStart"
    units="ms" expires_after="2025-12-31">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) the renderer receiving the start worker IPC message,
    to (b) initial JavaScript evaluation starting on the worker thread. Recorded
    when ServiceWorker.StartTiming.Duration is recorded.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartTiming.ScriptEvaluationEndToEnd" units="ms"
    expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) initial JavaScript evaluation finishing on the
    worker thread, to (b) the browser receiving the worker started IPC message
    (the final step of worker startup). Recorded when
    ServiceWorker.StartTiming.Duration is recorded.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.StartTiming.ScriptEvaluationStartToScriptEvaluationEnd"
    units="ms" expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) initial JavaScript evaluation starting on the worker
    thread, to (b) initial JavaScript evaluation finishing on the worker thread.
    Recorded when ServiceWorker.StartTiming.Duration is recorded.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.StartTiming.SentStartWorkerToReceivedStartWorker"
    units="ms" expires_after="2024-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) the browser sending the start worker IPC message, to
    (b) the renderer receiving the start worker IPC message. Recorded when
    ServiceWorker.StartTiming.Duration is recorded.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartTiming.StartToReceivedStartWorker"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) the start of service worker startup, to (b) the
    renderer receiving the start worker IPC message. Recorded when
    ServiceWorker.StartTiming.Duration is recorded.

    This histogram was expired between roughly 2021-07-30 and 2021-09-31.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartTiming.StartToScriptEvaluationEnd"
    units="ms" expires_after="2025-12-31">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) the start of service worker startup, to (b) initial
    JavaScript evaluation finishing on the worker thread. Recorded when
    ServiceWorker.StartTiming.Duration is recorded.

    This histogram was expired between roughly 2021-07-30 and 2021-09-31.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartTiming.StartToScriptEvaluationStart"
    units="ms" expires_after="2025-12-31">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) the start of service worker startup, to (b) initial
    JavaScript evaluation starting on the worker thread. Recorded when
    ServiceWorker.StartTiming.Duration is recorded.

    This histogram was expired between roughly 2021-07-30 and 2021-09-31.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartTiming.StartToSentStartWorker" units="ms"
    expires_after="2025-12-31">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken from (a) the start of service worker startup, to (b) the
    browser sending the start worker IPC message. Recorded when
    ServiceWorker.StartTiming.Duration is recorded.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartWorker.ContextValidationDifference"
    enum="ServiceWorkerStartWorkerContextValidationDifference"
    expires_after="2026-10-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the difference between the legacy scope-based validation and the
    newer StorageKey-based validation when starting a service worker. Recorded
    every time IsStartWorkerAllowed is evaluated.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartWorker.Purpose"
    enum="ServiceWorkerMetrics.EventType" expires_after="2026-01-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The purpose for starting up a service worker. Recorded only for installed
    workers.

    This histogram was expired between approximately Feb through Sep 2021.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartWorker.Status"
    enum="ServiceWorkerStatusCode" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of trying to start a Service Worker that is already installed.
    See also ServiceWorker.StartNewWorker.Status for new workers. See also
    ServiceWorker.StartWorker.StatusByPurpose_* for the breakdown by event type.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.StartWorker.StatusByPurpose_{ServiceWorkerEventType}"
    enum="ServiceWorkerStatusCode" expires_after="2026-01-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of trying to start a service worker for the event type
    {ServiceWorkerEventType} (see ServiceWorker.StartWorker.Status for all start
    attempts). Only recorded for installed workers.
  </summary>
  <token key="ServiceWorkerEventType" variants="ServiceWorkerEventType"/>
</histogram>

<histogram name="ServiceWorker.StartWorker.Timeout.StartPurpose"
    enum="ServiceWorkerMetrics.EventType" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the start purpose for a service worker that timed out while starting
    up. Recorded only for installed workers.

    This histogram was expired between approximately Feb through Sep 2021.
  </summary>
</histogram>

<histogram name="ServiceWorker.StartWorker.TimeoutPhase"
    enum="EmbeddedWorkerStartingPhase" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The phase the ServiceWorker was in when ServiceWorker startup timed out.

    This histogram was expired between approximately Feb through Sep 2021.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.StartWorker.Time{ServiceWorker_StartSituationDoNotUse}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken to start a Service Worker that is already installed, from
    process allocation to ACK of started from the renderer (which occurs after
    script execution). The metric is not recorded if DevTools was ever attached
    to the Service Worker during startup. See also
    ServiceWorker.StartNewWorker.Time for new workers.
    {ServiceWorker_StartSituationDoNotUse}
  </summary>
  <token key="ServiceWorker_StartSituationDoNotUse"
      variants="ServiceWorker_StartSituationDoNotUse">
    <variant name=""/>
  </token>
</histogram>

<histogram
    name="ServiceWorker.StartWorker.Time{ServiceWorker_StartSituationDoNotUse}_{ServiceWorkerEventType}"
    units="ms" expires_after="2027-01-10">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time taken to start a Service Worker that is already installed, from
    process allocation to ACK of started from the renderer (which occurs after
    script execution). The metric is not recorded if DevTools was ever attached
    to the Service Worker during startup. See also
    ServiceWorker.StartNewWorker.Time for new workers.
    {ServiceWorker_StartSituationDoNotUse} {ServiceWorkerEventType}
  </summary>
</histogram>

<histogram name="ServiceWorker.StaticRouter.{Resource}.CacheLookupDuration"
    units="microseconds" expires_after="2027-02-07">
  <owner>suzukikeita@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Time spent to conduct cache lookup. Recorded when the service worker has
    associated routing info with the `cache` as the rule, and the browser or
    renderer is processing requests. This metric is recorded for {Resource}.

    This histogram only records metrics on machines with high-resolution clocks.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram name="ServiceWorker.StaticRouter.{Resource}.CacheStorageError"
    enum="CacheStorageErrorType" expires_after="2025-04-06">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the cache storage error when the cache source is set by a rule for
    the ServiceWorker static routing API and the cache storage match call
    returns a status instead of a result. This metric is recorded for
    {Resource}.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram name="ServiceWorker.StaticRouter.{Resource}.CORPCheckResult"
    enum="ServiceWorkerStaticRouterCORPCheckResult" expires_after="2027-04-15">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the result of the Cross-Origin Resource Policy (CORP) check for
    responses from the ServiceWorker Static Routing API with source: 'cache'.
    This metric is recorded for {Resource}.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram name="ServiceWorker.StaticRouter.{Resource}.ValidResponse"
    enum="Boolean" expires_after="2027-03-26">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether a response from the ServiceWorker Static Routing API with
    source: 'cache' is valid according to the Fetch spec (4.4 HTTP fetch, Step
    3.5.6). If it's invalid, it is a security risk and should be blocked.
  </summary>
  <token key="Resource">
    <variant name="MainResource" summary="main resource"/>
    <variant name="Subresource" summary="subresource"/>
  </token>
</histogram>

<histogram name="ServiceWorker.Storage.DeleteAndStartOverResult"
    enum="ServiceWorkerDeleteAndStartOverResult" expires_after="2024-08-04">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records result of storage recovery operations in ServiceWorkerStorage.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.Storage.FindForClientUrlInDB.ScopeCountForStorageKey"
    units="count" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The scope count for a given StorageKey. This is recorded when
    ServiceWorkerStorage::FindForClientUrlInDB() function is called.
  </summary>
</histogram>

<histogram name="ServiceWorker.Storage.FindForClientUrlInDB.Time" units="ms"
    expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    Execution time of ServiceWorkerStorage::FindForClientUrlInDB which is used
    by FindRegistrationForClientUrl.
  </summary>
</histogram>

<histogram name="ServiceWorker.Storage.PurgeResourceResult"
    enum="NetErrorCodes" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records successes and failures of purging a stale resource in
    ServiceWorkerStorage.
  </summary>
</histogram>

<histogram name="ServiceWorker.Storage.ReadInitialDataFromDB.Time" units="ms"
    expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    Execution time of ServiceWorkerStorage::ReadInitialDataFromDB which reads
    RegisteredStorageKey from a database.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.Storage.RegisteredStorageKeyCacheInitialization.Time2"
    units="ms" expires_after="2027-01-10">
  <owner>chikamune@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <improvement direction="LOWER_IS_BETTER"/>
  <summary>
    The cache creation time of service worker registration key on UI thread.
    Includes asynchronous call, thread hopping and the time of
    ServiceWorker.Storage.ReadInitialDataFromDB.Time. This is only recorded on
    the browser startup.
  </summary>
</histogram>

<histogram name="ServiceWorker.Subresource.Fallbacked.Type2"
    enum="ResourceType" expires_after="2025-08-31">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Type of subresources that is controlled with a service worker, but did not
    handled by a service worker (i.e. did not get replied via respondWith). This
    metric is taken every time a subresource load finishes.

    See ServiceWorker.Subresource.Handled.Type for handled cases.
  </summary>
</histogram>

<histogram name="ServiceWorker.Subresource.Handled.Type2" enum="ResourceType"
    expires_after="2025-08-31">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Type of subresources that is controlled with a service worker, and handled
    by a service worker (i.e. get replied via respondWith). This metric is taken
    every time a subresource load finishes.

    See ServiceWorker.Subresource.Fallbacked.Type for fallbacked cases.
  </summary>
</histogram>

<histogram name="ServiceWorker.SubresourceLoader.FetchRequestRestarted"
    enum="Boolean" expires_after="2027-04-03">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records true when OnConnectionClosed() is called and the fetch request is
    restarted in the ServiceWorkerSubresourceLoader. Recorded in the destructor
    of ServiceWorkerSubresourceLoader. This helps measure how often the
    connection to the service worker gets disconnected while handling a
    subresource fetch event.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.BlockedInlineResourceType"
    enum="ContentSecurityPolicyInlineType" expires_after="2026-07-19">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The type of inline resource, that is blocked by Content Security Policy when
    the synthetic response is enabled before receiving a Content Security Policy
    in a meta tag.

    This is recorded when the inline resource is blocked by the synthetic
    response.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.BlockedResourceCount"
    units="count" expires_after="2026-07-19">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The total count of blocked resources by the synthetic response.

    This is recorded, once per document/page, when the synthetic response is
    enabled and at the time when the first Content Security Policy delivered in
    a meta tag is parsed. Measures the count of resources that have been blocked
    by Content Security Policy because of synthetic response until that point.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.BlockedSrcType"
    enum="SyntheticResponseBlockedSrcType" expires_after="2026-07-19">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The type of source of scripts that is blocked by the synthetic response.

    This is recorded when the resource from the source is blocked by the
    synthetic response.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.BypassRedirectChecks"
    enum="Boolean" expires_after="2027-01-24">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether navigation request embedders (e.g. WebRequest API for
    extensions) handle redirect security checks.

    This is recorded when the network request is initiated in the browser
    process for the synthetic response.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.Eligibility"
    enum="SyntheticResponseEligibility" expires_after="2027-01-17">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the eligibility of the synthetic response.

    This is recorded when the main resource request is handled in ServiceWorker,
    and the page is avalable to use the synthetic response.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.HasSearchPrefetchCache"
    enum="Boolean" expires_after="2027-01-17">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether the search prefetch cache is found.

    This is recorded when the synthetic response is considered being handled,
    but before actually starting it.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.IsHeaderStored" enum="Boolean"
    expires_after="2027-01-17">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether the response headers are successfully stored to the memory.

    This is recorded in navigation, when the browser receives the response from
    the network, and there is no stored header locally yet for the synthetic
    response.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.IsSharedProducerPipeValid"
    enum="Boolean" expires_after="2026-07-19">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether the shared producer pipe is valid when handling an
    intercepted network response.

    This is recorded in navigation, when the browser receives the response from
    the network, while committed the navigation with locally stored headers and
    when the network service delegation mode is enabled. If this is true, the
    data pipe producer handle provided to the network service is still valid.
  </summary>
</histogram>

<histogram
    name="ServiceWorker.SyntheticResponse.IsValidBodyStreamProvided.{Status}"
    enum="Boolean" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records whether a valid response body handle is provided from URLLoader.

    This is recorded in navigation, when the browser receives the response from
    the network, while committed the navigation with locally stored headers. If
    this is true, the URLLoader provided a valid response body handle.
  </summary>
  <token key="Status">
    <variant name="NotReady"
        summary="Required data pipes are not created yet, or there is no
                 local response header."/>
    <variant name="Ready"
        summary="Required data pipes are all created, and there is a local
                 response header."/>
  </token>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.ReceiveResponseToComplete"
    units="ms" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the time from (a) the client receives the network response to (b)
    completes the response time.

    This is recorded in navigation, when the browser receives the response from
    the network, while committed the navigation with locally stored headers.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.ReloadReason"
    enum="SyntheticResponseReloadReason" expires_after="2027-01-24">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the reason why the browser reloads the page when a synthetic
    response is about to be served.

    This is recorded in navigation, when the browser receives the response from
    the network, but the browser tell the custom response to reload the page to
    the renderer for some fallback case e.g. header mismatch.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.StartRequestToReceiveResponse"
    units="ms" expires_after="2027-02-07">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the time from (a) the loader starts a network request to (b) it
    receives the response.

    This is recorded in navigation, when the browser receives the response from
    the network, while committed the navigation with locally stored headers.
  </summary>
</histogram>

<histogram name="ServiceWorker.SyntheticResponse.WriteFallbackBodyResult"
    enum="MojoResult" expires_after="2027-02-14">
  <owner>sisidovski@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the MojoResult returned by WriteData() when writing the synthetic
    response fallback body.
  </summary>
</histogram>

<histogram name="ServiceWorker.UpdateResourceSha256ChecksumsResult"
    enum="ServiceWorkerStatusCode" expires_after="2026-02-26">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The result of the checksum update operation. Each ServiceWorker resource
    should have a sha256 cehcksum hash string in the database, and that will be
    updated when there is a change in ServiceWorker scripts, or the field is
    empty.
  </summary>
</histogram>

<histogram name="ServiceWorker.URLLoaderFactoryInterceptorCountForMainResource"
    units="count" expires_after="2027-03-06">
  <owner>sisidovski@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    Records the number of interceptors involved in the URLLoaderFactory creation
    for the main resource request in ServiceWorkerClient. This is recorded when
    a navigation request is initiated by the service worker (e.g., navigation
    preload, synthetic response).
  </summary>
</histogram>

<histogram name="ServiceWorker.WindowClientNavigationIPAddressSpaceMismatch"
    enum="Boolean" expires_after="2026-09-22">
  <owner>hchao@chromium.org</owner>
  <owner>cthomp@chromium.org</owner>
  <owner>chrome-secure-web-and-net@google.com</owner>
  <summary>
    How many times a service worker navigates a WindowClient, and the IP address
    space of the WindowClient's current page does not match the IP address space
    of the Service Worker. A value of 'true' indicates that the IP address
    spaces did not match.
  </summary>
</histogram>

<histogram name="ServiceWorker.WorkaroundForCrBug1342408Applied" units="cases"
    expires_after="2025-10-26">
  <owner>yyanagisawa@google.com</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    True if the workaround for crbug.com/1342408 has been applied. Otherwise,
    false. The workaround is applied when the response stream call back is
    called.

    This information is used to understand if we need to continue this
    workaround or not.
  </summary>
</histogram>

<histogram name="ServiceWorkerCache.Cache.Browser.Match.Initialized" units="ms"
    expires_after="2025-03-23">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The time to perform a 'match' operation on a given Cache when that cache is
    known to be fully initialized. This includes measurements for hits, misses,
    and errors.
  </summary>
</histogram>

<histogram name="ServiceWorkerCache.Cache.Browser.Match.RelatedFetchEvent"
    units="ms" expires_after="2024-12-08">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The time to perform a 'match' operation on a given Cache when the operation
    was initiated from a service worker currently processing a FetchEvent with a
    matching request URL. This includes measurements for hits, misses, and
    errors.
  </summary>
</histogram>

<histogram
    name="ServiceWorkerCache.Cache.{ServiceWorkerCacheProcessType}.Match.{MatchType}"
    units="ms" expires_after="2024-12-29">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    Histogram for the ServiceWorker Cache API. {MatchType} This histogram was
    temporarily disabled from M96 through early 12/2021.
  </summary>
  <token key="ServiceWorkerCacheProcessType"
      variants="ServiceWorkerCacheProcessType"/>
  <token key="MatchType">
    <variant name="Hit"
        summary="The time to perform a 'match' operation on a given Cache
                 that successfully results in a Response."/>
    <variant name="IgnoreSearch"
        summary="The time to perform a 'match' operation on a given Cache
                 with the 'ignoreSearch' option set. This includes
                 measurements for hits, misses, and errors."/>
    <variant name="Miss"
        summary="The time to perform a 'match' operation on a given Cache
                 that completes successfully, but does not find a matching
                 entry."/>
  </token>
</histogram>

<histogram
    name="ServiceWorkerCache.Cache.{ServiceWorkerCacheProcessType}.{ProcessOps}"
    units="ms" expires_after="2026-09-20">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    Histogram for the ServiceWorker Cache API. {ProcessOps} This histogram was
    temporarily disabled from M96 through early 12/2021.
  </summary>
  <token key="ServiceWorkerCacheProcessType"
      variants="ServiceWorkerCacheProcessType"/>
  <token key="ProcessOps">
    <variant name="DeleteOne"
        summary="The time to delete a single Request/Response entry from a
                 Cache. This measurement includes times for both existing or
                 non-existant entries."/>
    <variant name="Keys"
        summary="The time to perform the 'keys' operation on a given Cache.
                 This includes measurements for both invocations targeting
                 all entries or only entries for a specific request
                 parameter."/>
    <variant name="Match"
        summary="The time to perform a 'match' operation on a given Cache.
                 This includes measurements for all invocations, including
                 hits, misses, errors, etc."/>
    <variant name="MatchAll"
        summary="The time to perform a 'matchAll' operation on a given Cache.
                 This includes measurements for all invocations, including
                 hits, misses, and errors. In addition requests for all Cache
                 entries and for specific request params are included
                 together in this histogram."/>
    <variant name="PutMany"
        summary="The time to put a multiple Request/Response entries into a
                 given Cache. This may or may not include deleting existing
                 entries that match any of the Requests. This includes
                 measurements for both successes and failures."/>
    <variant name="PutOne"
        summary="The time to put a single Request/Response entry into a given
                 Cache. This may or may not include deleting an existing
                 entry matching the Request. This includes measurements for
                 both successes and failures."/>
  </token>
</histogram>

<histogram
    name="ServiceWorkerCache.CacheStorage.Renderer.{ProcessOps}.AblationDelay"
    units="ms" expires_after="2026-02-09">
  <owner>elkurin@chromium.org</owner>
  <owner>chrome-storage-team-tokyo@google.com</owner>
  <summary>
    Records the actual delayed time on completing CacheStorage APIs. The value
    is Time (in ms) added to run CacheStorage used for ablation study purposes.
  </summary>
  <token key="ProcessOps">
    <variant name="Delete"
        summary="The time to 'delete' a Cache from the origin's CacheStorage.
                 If the Cache is still in use then the actual deletion may be
                 deferred until the last reference is dropped. Additional
                 time due to deferral is not included in this measurement."/>
    <variant name="Has"
        summary="The time to perform the 'has' operation on the origin's
                 CacheStorage."/>
    <variant name="Keys"
        summary="The time to perform the 'keys' operation on the origin's
                 CacheStorage."/>
    <variant name="Match"
        summary="The time to perform a 'match' operation against all caches
                 associated with the origin's CacheStorage. This histogram
                 includes measurements for hits, misses, and errors."/>
    <variant name="Open"
        summary="The time to 'open' a Cache in the origin's CacheStorage.
                 Some opening operations may happen asynchronously after the
                 'open' returns a Cache object. That deferred asynchronous
                 work is not included in this measurement."/>
  </token>
</histogram>

<histogram
    name="ServiceWorkerCache.CacheStorage.{ServiceWorkerCacheProcessType}.{ProcessOps}"
    units="ms" expires_after="2027-02-07">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    Histogram for the ServiceWorker Cache API. {ProcessOps} This histogram was
    temporarily disabled from M96 through early 12/2021.
  </summary>
  <token key="ServiceWorkerCacheProcessType"
      variants="ServiceWorkerCacheProcessType"/>
  <token key="ProcessOps">
    <variant name="Delete"
        summary="The time to 'delete' a Cache from the origin's CacheStorage.
                 If the Cache is still in use then the actual deletion may be
                 deferred until the last reference is dropped. Additional
                 time due to deferral is not included in this measurement."/>
    <variant name="Has"
        summary="The time to perform the 'has' operation on the origin's
                 CacheStorage."/>
    <variant name="Keys"
        summary="The time to perform the 'keys' operation on the origin's
                 CacheStorage."/>
    <variant name="MatchAllCaches"
        summary="The time to perform a 'match' operation against all caches
                 associated with the origin's CacheStorage. This histogram
                 includes measurements for hits, misses, and errors."/>
    <variant name="MatchOneCache"
        summary="The time to perform a 'match' operation against a single
                 cache associated with the origin's CacheStorage. This
                 histogram includes measurements for hits, misses, and
                 errors."/>
    <variant name="Open"
        summary="The time to 'open' a Cache in the origin's CacheStorage.
                 Some opening operations may happen asynchronously after the
                 'open' returns a Cache object. That deferred asynchronous
                 work is not included in this measurement."/>
  </token>
</histogram>

<histogram name="ServiceWorkerCache.ErrorStorageType"
    enum="CacheStorageErrorStorageType" expires_after="2026-08-30">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    Records where the generic kErrorStorage value is triggered within the
    cache_storage code. This histogram was temporarily disabled from late
    10/2021 to early 12/2021.
  </summary>
</histogram>

<histogram name="ServiceWorkerCache.ListOriginsIndexValidity"
    enum="CacheStorageIndexResult" expires_after="2025-05-26">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The result from parsing and validating the index protobuf while calculating
    the list of cache_storage origins.
  </summary>
</histogram>

<histogram
    name="ServiceWorkerCache.{ServiceWorkerCacheClientType}.Scheduler.OperationDuration2"
    units="ms" expires_after="2025-10-12">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The time in ms from when an operation is started until it completes. This
    histogram differs from the old OperationDuration in that it uses a different
    bucket size to measure longer values.
  </summary>
  <token key="ServiceWorkerCacheClientType"
      variants="ServiceWorkerCacheClientType"/>
</histogram>

<histogram
    name="ServiceWorkerCache.{ServiceWorkerCacheClientType}.Scheduler.QueueDuration2"
    units="ms" expires_after="2025-10-12">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The time in ms from when an operation is started until it completes. This
    histogram differs from the old OperationDuration in that it uses a different
    bucket size to measure longer values.
  </summary>
  <token key="ServiceWorkerCacheClientType"
      variants="ServiceWorkerCacheClientType"/>
</histogram>

<histogram
    name="ServiceWorkerCache.{ServiceWorkerCacheClientType}.Scheduler.QueueLength"
    units="operations" expires_after="2025-08-10">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The number of operations in the scheduling queue just before enqueuing a new
    operation.
  </summary>
  <token key="ServiceWorkerCacheClientType"
      variants="ServiceWorkerCacheClientType"/>
</histogram>

<histogram
    name="ServiceWorkerCache.{ServiceWorkerCacheSchedulerOpClientType}.Scheduler.OperationDuration2.{ServiceWorkerSchedulerOp}"
    units="ms" expires_after="2025-09-28">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The time in ms from when an operation is started until it completes for the
    {ServiceWorkerCacheSchedulerOpClientType} instance.
  </summary>
  <token key="ServiceWorkerCacheSchedulerOpClientType"
      variants="ServiceWorkerCacheSchedulerOpClientType"/>
  <token key="ServiceWorkerSchedulerOp" variants="ServiceWorkerSchedulerOp"/>
</histogram>

<histogram
    name="ServiceWorkerCache.{ServiceWorkerCacheSchedulerOpClientType}.Scheduler.QueueDuration2.{ServiceWorkerSchedulerOp}"
    units="ms" expires_after="2025-12-07">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The time in ms from when an operation is started until it completes for the
    {ServiceWorkerCacheSchedulerOpClientType} instance.
  </summary>
  <token key="ServiceWorkerCacheSchedulerOpClientType"
      variants="ServiceWorkerCacheSchedulerOpClientType"/>
  <token key="ServiceWorkerSchedulerOp" variants="ServiceWorkerSchedulerOp"/>
</histogram>

<histogram
    name="ServiceWorkerCache.{ServiceWorkerCacheSchedulerOpClientType}.Scheduler.QueueLength.{ServiceWorkerSchedulerOp}"
    units="operations" expires_after="2025-08-10">
  <owner>ayui@chromium.org</owner>
  <owner>chrome-owp-storage@google.com</owner>
  <summary>
    The number of operations in the scheduling queue just before enqueuing a new
    operation for the {ServiceWorkerCacheSchedulerOpClientType} instance.
  </summary>
  <token key="ServiceWorkerCacheSchedulerOpClientType"
      variants="ServiceWorkerCacheSchedulerOpClientType"/>
  <token key="ServiceWorkerSchedulerOp" variants="ServiceWorkerSchedulerOp"/>
</histogram>

<histogram name="Worker.BrowserProcess.DevToolsCreateTime" units="ms"
    expires_after="2026-12-27">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms for setting up the devtools agent for the dedicated worker to
    trace the dedicated worker script fetch.
  </summary>
</histogram>

<histogram name="Worker.BrowserProcess.StartScriptLoadTime" units="ms"
    expires_after="2026-08-22">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms from when a dedicated worker host is created inside the
    browser process until when the script is started to load in the browser
    process.
  </summary>
</histogram>

<histogram name="Worker.BrowserProcess.WorkerHostCreateTime" units="ms"
    expires_after="2026-08-22">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms for creating a DedicatedWorkerHost in the browser process.
    The time include all procedures that is needed for creating the
    DedicatedWorkerHost.
  </summary>
</histogram>

<histogram name="Worker.DevTools.AgentHost.Size" units="count"
    expires_after="2026-08-22">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    If PlzDedicatedWorker is enabled, DedicatedWorkerDebToolsAgent will be
    created and kept in the WorkerDevtoolsManager. This metric shows the number
    of the agent kept in the manager. The metric is recorded when the new entry
    is created, which correspond to timing when the
    Worker.BrowserProcess.DevToolsCreateTime metric is recorded. Therefore, it
    can be used for good understanding on how the number of entries affect the
    devtools agent creation time.
  </summary>
</histogram>

<histogram name="Worker.TopLevelScript.FetchClassicScriptTime" units="ms"
    expires_after="2026-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms from when a dedicated worker starts to fetch a classic script
    until the script starts to be evaluated. The value can only be taken for
    PlzDedicatedWorker.
  </summary>
</histogram>

<histogram name="Worker.TopLevelScript.Initialization2GlobalScopeCreation"
    units="ms" expires_after="2026-10-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms from when a worker thread initialization starts until the
    dedicated worker global scope is going to be made. This does not include the
    global scope creation time. Unfortunately, this does not measure a time from
    worker thread creation. It just measures from when the initialization
    starts.
  </summary>
</histogram>

<histogram name="Worker.TopLevelScript.LoadStartedTime" units="ms"
    expires_after="2026-10-12">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms from when a dedicated worker starts until the script load
    started. This includes PlzDedicatedWorker to offload starting to fetch a
    script in the browser process. However, fetching contents are excluded from
    this time.
  </summary>
</histogram>

<histogram name="Worker.TopLevelScript.StartToWorkerScriptFetchFinishedTime"
    units="ms" expires_after="2026-08-01">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms from when a dedicated worker starts until the worker script
    fetch finished. This includes PlzDedicatedWorker to offload starting to
    fetch a script in the browser process. It does not include the initial
    evaluation of the script.
  </summary>
</histogram>

<histogram name="Worker.TopLevelScript.WorkerHostCreatedTime" units="ms"
    expires_after="2026-12-27">
  <owner>yyanagisawa@chromium.org</owner>
  <owner>chrome-worker@google.com</owner>
  <summary>
    The time in ms from when a dedicated worker starts until the worker host
    creation callback is called from the browser process. This roughly means IPC
    turn-around time betweeen the renderer process and the browser process.
  </summary>
</histogram>

</histograms>

</histogram-configuration>
