#include "content/browser/interest_group/auction_metrics_recorder.h"
#include <stdint.h>
#include <algorithm>
#include <functional>
#include "base/check.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "content/browser/interest_group/additional_bid_result.h"
#include "content/public/browser/auction_result.h"
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom-shared.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "url/origin.h"
namespace content {
GetExponentialBucketMinForCounts1000;
GetSemanticBucketMinForDurationTiming;
namespace {
int64_t GetBucketMinForPhaseTimeMetric(base::TimeDelta time_delta) { … }
}
AuctionMetricsRecorderManager::AuctionMetricsRecorderManager(
ukm::SourceId ukm_source_id)
: … { … }
AuctionMetricsRecorderManager::~AuctionMetricsRecorderManager() = default;
AuctionMetricsRecorder*
AuctionMetricsRecorderManager::CreateAuctionMetricsRecorder() { … }
AuctionMetricsRecorder::AuctionMetricsRecorder(ukm::SourceId ukm_source_id)
: … { … }
AuctionMetricsRecorder::~AuctionMetricsRecorder() = default;
void AuctionMetricsRecorder::OnAuctionEnd(AuctionResult auction_result) { … }
void AuctionMetricsRecorder::OnLoadInterestGroupPhaseComplete() { … }
void AuctionMetricsRecorder::OnWorkletRequested() { … }
void AuctionMetricsRecorder::OnWorkletReady() { … }
void AuctionMetricsRecorder::OnConfigPromisesResolved() { … }
void AuctionMetricsRecorder::SetNumInterestGroups(int64_t num_interest_groups) { … }
void AuctionMetricsRecorder::SetNumOwnersWithInterestGroups(
int64_t num_owners_with_interest_groups) { … }
void AuctionMetricsRecorder::SetNumOwnersWithoutInterestGroups(
int64_t num_owners_without_interest_groups) { … }
void AuctionMetricsRecorder::SetNumSellersWithBidders(
int64_t num_sellers_with_bidders) { … }
void AuctionMetricsRecorder::RecordNegativeInterestGroups(
int64_t num_negative_interest_groups) { … }
void AuctionMetricsRecorder::ReportBuyer(const url::Origin& owner) { … }
void AuctionMetricsRecorder::ReportBidderWorkletKey(
AuctionWorkletManager::WorkletKey& worklet_key) { … }
void AuctionMetricsRecorder::RecordBidsAbortedByBuyerCumulativeTimeout(
int64_t num_bids) { … }
void AuctionMetricsRecorder::RecordBidAbortedByBidderWorkletFatalError() { … }
void AuctionMetricsRecorder::RecordBidFilteredDuringInterestGroupLoad() { … }
void AuctionMetricsRecorder::RecordBidFilteredDuringReprioritization() { … }
void AuctionMetricsRecorder::RecordBidsFilteredByPerBuyerLimits(
int64_t num_bids) { … }
void AuctionMetricsRecorder::RecordAdditionalBidResult(
AdditionalBidResult result) { … }
void AuctionMetricsRecorder::RecordAdditionalBidDecodeLatency(
base::TimeDelta latency) { … }
void AuctionMetricsRecorder::
RecordNegativeInterestGroupIgnoredDueToInvalidSignature() { … }
void AuctionMetricsRecorder::
RecordNegativeInterestGroupIgnoredDueToJoiningOriginMismatch() { … }
void AuctionMetricsRecorder::SetKAnonymityBidMode(
auction_worklet::mojom::KAnonymityBidMode bid_mode) { … }
void AuctionMetricsRecorder::SetNumConfigPromises(int64_t num_config_promises) { … }
void AuctionMetricsRecorder::RecordInterestGroupWithNoBids() { … }
void AuctionMetricsRecorder::RecordInterestGroupWithOnlyNonKAnonBid() { … }
void AuctionMetricsRecorder::
RecordInterestGroupWithSeparateBidsForKAnonAndNonKAnon() { … }
void AuctionMetricsRecorder::
RecordInterestGroupWithSameBidForKAnonAndNonKAnon() { … }
void AuctionMetricsRecorder::RecordInterestGroupWithOtherMultiBid() { … }
void AuctionMetricsRecorder::RecordNumberOfBidsFromGenerateBid(
size_t k_anom_num,
size_t total_num) { … }
void AuctionMetricsRecorder::RecordComponentAuctionLatency(
base::TimeDelta latency) { … }
void AuctionMetricsRecorder::RecordBidForOneInterestGroupLatency(
base::TimeDelta latency) { … }
void AuctionMetricsRecorder::RecordGenerateSingleBidLatency(
base::TimeDelta latency) { … }
void AuctionMetricsRecorder::RecordGenerateBidDependencyLatencies(
const auction_worklet::mojom::GenerateBidDependencyLatencies&
generate_bid_dependency_latencies) { … }
void AuctionMetricsRecorder::RecordTopLevelBidQueuedWaitingForConfigPromises(
base::TimeDelta delay) { … }
void AuctionMetricsRecorder::RecordTopLevelBidQueuedWaitingForSellerWorklet(
base::TimeDelta delay) { … }
void AuctionMetricsRecorder::RecordBidQueuedWaitingForConfigPromises(
base::TimeDelta delay) { … }
void AuctionMetricsRecorder::RecordBidQueuedWaitingForSellerWorklet(
base::TimeDelta delay) { … }
void AuctionMetricsRecorder::RecordScoreAdFlowLatency(base::TimeDelta latency) { … }
void AuctionMetricsRecorder::RecordScoreAdLatency(base::TimeDelta latency) { … }
void AuctionMetricsRecorder::RecordScoreAdDependencyLatencies(
const auction_worklet::mojom::ScoreAdDependencyLatencies&
score_ad_dependency_latencies) { … }
void AuctionMetricsRecorder::LatencyAggregator::RecordLatency(
base::TimeDelta latency) { … }
int32_t AuctionMetricsRecorder::LatencyAggregator::GetNumRecords() { … }
base::TimeDelta AuctionMetricsRecorder::LatencyAggregator::GetMeanLatency() { … }
base::TimeDelta AuctionMetricsRecorder::LatencyAggregator::GetMaxLatency() { … }
void AuctionMetricsRecorder::EarliestTimeRecorder::MaybeRecordTime(
base::TimeTicks time) { … }
void AuctionMetricsRecorder::LatestTimeRecorder::MaybeRecordTime(
base::TimeTicks time) { … }
void AuctionMetricsRecorder::MaybeSetMeanAndMaxLatency(
AuctionMetricsRecorder::LatencyAggregator& aggregator,
EntrySetFunction set_mean_function,
EntrySetFunction set_max_function) { … }
void AuctionMetricsRecorder::SetNumAndMaybeMeanLatency(
AuctionMetricsRecorder::LatencyAggregator& aggregator,
EntrySetFunction set_num_function,
EntrySetFunction set_mean_function) { … }
void AuctionMetricsRecorder::MaybeSetPhaseStartTime(
EarliestTimeRecorder& recorder,
EntrySetFunction set_function) { … }
void AuctionMetricsRecorder::MaybeSetPhaseEndTime(
LatestTimeRecorder& recorder,
EntrySetFunction set_function) { … }
void AuctionMetricsRecorder::MaybeRecordGenerateBidDependencyLatency(
GenerateBidDependencyCriticalPath::Dependency dependency,
std::optional<base::TimeDelta> latency,
LatencyAggregator& aggregator,
GenerateBidDependencyCriticalPath& critical_path) { … }
void AuctionMetricsRecorder::RecordGenerateBidDependencyLatencyCriticalPath(
GenerateBidDependencyCriticalPath& critical_path) { … }
void AuctionMetricsRecorder::MaybeRecordGenerateBidPhasesStartAndEndTimes(
const auction_worklet::mojom::GenerateBidDependencyLatencies&
generate_bid_dependency_latencies) { … }
void AuctionMetricsRecorder::MaybeRecordScoreAdDependencyLatency(
ScoreAdDependencyCriticalPath::Dependency dependency,
std::optional<base::TimeDelta> latency,
LatencyAggregator& aggregator,
ScoreAdDependencyCriticalPath& critical_path) { … }
void AuctionMetricsRecorder::RecordScoreAdDependencyLatencyCriticalPath(
ScoreAdDependencyCriticalPath& critical_path) { … }
void AuctionMetricsRecorder::MaybeRecordScoreAdPhasesStartAndEndTimes(
const auction_worklet::mojom::ScoreAdDependencyLatencies&
score_ad_dependency_latencies) { … }
}