// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_INTEREST_GROUP_AUCTION_METRICS_RECORDER_H_ #define CONTENT_BROWSER_INTEREST_GROUP_AUCTION_METRICS_RECORDER_H_ #include <stdint.h> #include <cstdint> #include <optional> #include <set> #include "base/containers/flat_map.h" #include "base/time/time.h" #include "content/browser/interest_group/additional_bid_result.h" #include "content/browser/interest_group/auction_worklet_manager.h" #include "content/common/content_export.h" #include "content/public/browser/auction_result.h" #include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom-shared.h" #include "content/services/auction_worklet/public/mojom/seller_worklet.mojom.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "url/origin.h" namespace content { // AuctionMetricsRecorder instances need to outlive other objects that keep a // reference to them, e.g. AuctionWorkletManager, so that these objects can // effectively record metrics. AuctionMetricsRecorderManager is responsible for // owning instances of AuctionMetricsRecorder beyond the lifetime of any of // these referencing objects. class CONTENT_EXPORT AuctionMetricsRecorderManager { … }; // The AuctionMetricsRecorder is an auction-scoped collection of data used to // record UKMs used to investigate auction latency used to detect regressive // trends over time and to drive future optimizations. // // The convention here is that: // - methods prefixed with On are called once, at some milestone in the auction. // - methods prefixed with Set are called once, whenever that data is available. // - methods prefixed with Record are called many times, whenever some repeated // event happens. The metrics associated with these are set on the builder // OnAuctionEnd, just before the Event is written to the UkmRecorder. class CONTENT_EXPORT AuctionMetricsRecorder { … }; } // namespace content #endif // CONTENT_BROWSER_INTEREST_GROUP_AUCTION_METRICS_RECORDER_H_