• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.adservices.service.stats;
18 
19 import com.google.auto.value.AutoValue;
20 
21 /** Class for logging Ad filtering process during ad selection. */
22 @AutoValue
23 public abstract class AdFilteringProcessAdSelectionReportedStats {
24     /** Returns the status response code in AdServices. */
getStatusCode()25     public abstract int getStatusCode();
26     /** Returns latency when running the whole Ad filtering process. */
getLatencyInMillisOfAllAdFiltering()27     public abstract int getLatencyInMillisOfAllAdFiltering();
28 
29     /** Returns latency when calling app install filters in ad filters. */
getLatencyInMillisOfAppInstallFiltering()30     public abstract int getLatencyInMillisOfAppInstallFiltering();
31 
32     /** Returns latency when calling FCap filters in ad filters. */
getLatencyInMillisOfFcapFilters()33     public abstract int getLatencyInMillisOfFcapFilters();
34 
35     /** Returns the total number of Ads before Ad filtering process. */
getTotalNumOfAdsBeforeFiltering()36     public abstract int getTotalNumOfAdsBeforeFiltering();
37 
38     /** Returns the process type when calling Ad filtering. */
39     @AdsRelevanceStatusUtils.FilterProcessType
getFilterProcessType()40     public abstract int getFilterProcessType();
41 
42     /**
43      * Returns the number of Ads which are filtered out of bidding. The field will be set as
44      * FIELD_UNSET if filter_process_type is FILTER_CONTEXTUAL_ADS
45      */
getNumOfAdsFilteredOutOfBidding()46     public abstract int getNumOfAdsFilteredOutOfBidding();
47 
48     /**
49      * Returns the number of custom audiences which are filtered out of bidding. The field will be
50      * set as FIELD_UNSET if filter_process_type is FILTER_CONTEXTUAL_ADS
51      */
getNumOfCustomAudiencesFilteredOutOfBidding()52     public abstract int getNumOfCustomAudiencesFilteredOutOfBidding();
53 
54     /**
55      * Returns the total number of custom audiences before Ad filtering process. The field will be
56      * set as FIELD_UNSET if filter_process_type is FILTER_CONTEXTUAL_ADS
57      */
getTotalNumOfCustomAudiencesBeforeFiltering()58     public abstract int getTotalNumOfCustomAudiencesBeforeFiltering();
59 
60     /**
61      * Returns the number of Ads which are filtered during contextual ads. The field will be set as
62      * FIELD_UNSET if filter_process_type is FILTER_CUSTOM_AUDIENCES
63      */
getNumOfContextualAdsFiltered()64     public abstract int getNumOfContextualAdsFiltered();
65 
66     /**
67      * Returns the number of contextual Ads filtered out of bidding because of invalid signatures.
68      * The field will be set as * FIELD_UNSET if filter_process_type is FILTER_CUSTOM_AUDIENCES
69      */
getNumOfContextualAdsFilteredOutOfBiddingInvalidSignatures()70     public abstract int getNumOfContextualAdsFilteredOutOfBiddingInvalidSignatures();
71 
72     /**
73      * Returns the number of contextual Ads filtered out of bidding because of no Ads. The field
74      * will be set as FIELD_UNSET if filter_process_type is FILTER_CUSTOM_AUDIENCES
75      */
getNumOfContextualAdsFilteredOutOfBiddingNoAds()76     public abstract int getNumOfContextualAdsFilteredOutOfBiddingNoAds();
77 
78     /**
79      * Returns the total number of contextual Ads before filtering. The field will be set as
80      * FIELD_UNSET if filter_process_type is FILTER_CUSTOM_AUDIENCES
81      */
getTotalNumOfContextualAdsBeforeFiltering()82     public abstract int getTotalNumOfContextualAdsBeforeFiltering();
83 
84     /** Returns the number of ad counter keys in fcap filters. */
getNumOfAdCounterKeysInFcapFilters()85     public abstract int getNumOfAdCounterKeysInFcapFilters();
86 
87     /** Returns the number of app packages involve in app install filters. */
getNumOfPackageInAppInstallFilters()88     public abstract int getNumOfPackageInAppInstallFilters();
89 
90     /** Returns the number of database operations during ad selection. */
getNumOfDbOperations()91     public abstract int getNumOfDbOperations();
92 
93     /**
94      * @return generic builder
95      */
builder()96     public static Builder builder() {
97         return new AutoValue_AdFilteringProcessAdSelectionReportedStats.Builder()
98                 .setLatencyInMillisOfAllAdFiltering(0)
99                 .setLatencyInMillisOfAppInstallFiltering(0)
100                 .setLatencyInMillisOfFcapFilters(0)
101                 .setStatusCode(0)
102                 .setNumOfAdsFilteredOutOfBidding(0)
103                 .setNumOfCustomAudiencesFilteredOutOfBidding(0)
104                 .setTotalNumOfAdsBeforeFiltering(0)
105                 .setTotalNumOfCustomAudiencesBeforeFiltering(0)
106                 .setNumOfPackageInAppInstallFilters(0)
107                 .setNumOfDbOperations(0)
108                 .setFilterProcessType(AdsRelevanceStatusUtils.FILTER_PROCESS_TYPE_UNSET)
109                 .setNumOfContextualAdsFiltered(0)
110                 .setNumOfAdCounterKeysInFcapFilters(0)
111                 .setNumOfContextualAdsFilteredOutOfBiddingInvalidSignatures(0)
112                 .setNumOfContextualAdsFilteredOutOfBiddingNoAds(0)
113                 .setTotalNumOfContextualAdsBeforeFiltering(0);
114     }
115 
116     /** Builder class for AdFilteringProcessAdSelectionReportedStats. */
117     @AutoValue.Builder
118     public abstract static class Builder {
119         /** Sets the status response code in AdServices. */
setStatusCode(int value)120         public abstract Builder setStatusCode(int value);
121 
122         /** Sets latency when running the whole Ad filtering process. */
setLatencyInMillisOfAllAdFiltering(int value)123         public abstract Builder setLatencyInMillisOfAllAdFiltering(int value);
124 
125         /** Sets latency when calling app install filters in ad filters. */
setLatencyInMillisOfAppInstallFiltering(int value)126         public abstract Builder setLatencyInMillisOfAppInstallFiltering(int value);
127 
128         /** Sets latency when calling FCap filters in ad filters. */
setLatencyInMillisOfFcapFilters(int value)129         public abstract Builder setLatencyInMillisOfFcapFilters(int value);
130 
131         /** Sets the total number of Ads before Ad filtering process. */
setTotalNumOfAdsBeforeFiltering(int value)132         public abstract Builder setTotalNumOfAdsBeforeFiltering(int value);
133 
134         /** Sets the process type when calling Ad filtering. */
setFilterProcessType( @dsRelevanceStatusUtils.FilterProcessType int value)135         public abstract Builder setFilterProcessType(
136                 @AdsRelevanceStatusUtils.FilterProcessType int value);
137 
138         /**
139          * Sets the number of Ads which are filtered out of bidding. The field will be set as
140          * FIELD_UNSET if filter_process_type is FILTER_CONTEXTUAL_ADS
141          */
setNumOfAdsFilteredOutOfBidding(int value)142         public abstract Builder setNumOfAdsFilteredOutOfBidding(int value);
143 
144         /** Sets the number of custom audiences which are filtered out of bidding. */
setNumOfCustomAudiencesFilteredOutOfBidding(int value)145         public abstract Builder setNumOfCustomAudiencesFilteredOutOfBidding(int value);
146 
147         /**
148          * Sets the total number of custom audiences before Ad filtering process. The field will be
149          * set as FIELD_UNSET if filter_process_type is FILTER_CONTEXTUAL_ADS
150          */
setTotalNumOfCustomAudiencesBeforeFiltering(int value)151         public abstract Builder setTotalNumOfCustomAudiencesBeforeFiltering(int value);
152 
153         /**
154          * Sets the number of Ads which are filtered during contextual ads. The field will be set as
155          * FIELD_UNSET if filter_process_type is FILTER_CUSTOM_AUDIENCES
156          */
setNumOfContextualAdsFiltered(int value)157         public abstract Builder setNumOfContextualAdsFiltered(int value);
158 
159         /**
160          * Sets the number of contextual Ads filtered out of bidding because of invalid signatures.
161          */
setNumOfContextualAdsFilteredOutOfBiddingInvalidSignatures( int value)162         public abstract Builder setNumOfContextualAdsFilteredOutOfBiddingInvalidSignatures(
163                 int value);
164 
165         /** Sets the number of contextual Ads filtered out of bidding because of no Ads. */
setNumOfContextualAdsFilteredOutOfBiddingNoAds(int value)166         public abstract Builder setNumOfContextualAdsFilteredOutOfBiddingNoAds(int value);
167 
168         /** Sets the total number of contextual Ads before filtering. */
setTotalNumOfContextualAdsBeforeFiltering(int value)169         public abstract Builder setTotalNumOfContextualAdsBeforeFiltering(int value);
170 
171         /** Sets the number of ad counter keys in fcap filters. */
setNumOfAdCounterKeysInFcapFilters(int value)172         public abstract Builder setNumOfAdCounterKeysInFcapFilters(int value);
173 
174         /** Sets the number of app packages involve in app install filters. */
setNumOfPackageInAppInstallFilters(int value)175         public abstract Builder setNumOfPackageInAppInstallFilters(int value);
176 
177         /** Sets the number of database operations during ad selection. */
setNumOfDbOperations(int value)178         public abstract Builder setNumOfDbOperations(int value);
179 
180         /** Returns an instance of {@link AdFilteringProcessAdSelectionReportedStats} */
build()181         public abstract AdFilteringProcessAdSelectionReportedStats build();
182     }
183 }
184