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.pas; 18 19 import static com.android.adservices.service.stats.AdServicesLoggerUtil.FIELD_UNSET; 20 21 import com.android.adservices.service.stats.AdsRelevanceStatusUtils; 22 23 import com.google.auto.value.AutoValue; 24 25 /** Class for logging per download of the encoding stats. */ 26 @AutoValue 27 public abstract class EncodingFetchStats { 28 /** Returns the time to download the js. */ 29 @AdsRelevanceStatusUtils.Size getJsDownloadTime()30 public abstract int getJsDownloadTime(); 31 32 /** Returns http response code. */ getHttpResponseCode()33 public abstract int getHttpResponseCode(); 34 35 /** Returns the status of encoding fetch. */ 36 @AdsRelevanceStatusUtils.EncodingFetchStatus getFetchStatus()37 public abstract int getFetchStatus(); 38 39 /** Returns AdTech's eTLD+1 when the EncodingFetchStatus is not success. */ getAdTechId()40 public abstract String getAdTechId(); 41 42 /** Returns generic builder */ builder()43 public static Builder builder() { 44 return new AutoValue_EncodingFetchStats.Builder().setHttpResponseCode(FIELD_UNSET); 45 } 46 47 /** Builder class for EncodingFetchStats. */ 48 @AutoValue.Builder 49 public abstract static class Builder { setJsDownloadTime(@dsRelevanceStatusUtils.Size int value)50 public abstract Builder setJsDownloadTime(@AdsRelevanceStatusUtils.Size int value); 51 setHttpResponseCode(int value)52 public abstract Builder setHttpResponseCode(int value); 53 setFetchStatus( @dsRelevanceStatusUtils.EncodingFetchStatus int value)54 public abstract Builder setFetchStatus( 55 @AdsRelevanceStatusUtils.EncodingFetchStatus int value); 56 setAdTechId(String value)57 public abstract Builder setAdTechId(String value); 58 build()59 public abstract EncodingFetchStats build(); 60 } 61 } 62