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 counter histogram updater per DB insertion. */ 22 @AutoValue 23 public abstract class AdCounterHistogramUpdaterReportedStats { 24 /** Returns latency when calling Ad counter histogram updater. */ getLatencyInMillis()25 public abstract int getLatencyInMillis(); 26 27 /** Returns the status response code in AdServices. */ getStatusCode()28 public abstract int getStatusCode(); 29 30 /** 31 * Returns the total number of Ad events in database after Ad counter histogram updater process. 32 */ getTotalNumberOfEventsInDatabaseAfterInsert()33 public abstract int getTotalNumberOfEventsInDatabaseAfterInsert(); 34 35 /** 36 * Returns the number of histogram events were inserted in database during Ad counter histogram 37 * updater process. 38 */ getNumberOfInsertedEvent()39 public abstract int getNumberOfInsertedEvent(); 40 41 /** 42 * Returns the number of histogram events were evicted from database during Ad counter histogram 43 * updater process. 44 */ getNumberOfEvictedEvent()45 public abstract int getNumberOfEvictedEvent(); 46 47 /** 48 * @return generic builder 49 */ builder()50 public static Builder builder() { 51 return new AutoValue_AdCounterHistogramUpdaterReportedStats.Builder(); 52 } 53 54 /** Builder class for AdCounterHistogramUpdaterReportedStats. */ 55 @AutoValue.Builder 56 public abstract static class Builder { 57 /** Returns latency when calling Ad counter histogram updater. */ setLatencyInMillis(int value)58 public abstract Builder setLatencyInMillis(int value); 59 60 /** Returns the status response code in AdServices. */ setStatusCode(int value)61 public abstract Builder setStatusCode(int value); 62 63 /** 64 * Sets the total number of Ad events in database after Ad counter histogram updater 65 * process. 66 */ setTotalNumberOfEventsInDatabaseAfterInsert(int value)67 public abstract Builder setTotalNumberOfEventsInDatabaseAfterInsert(int value); 68 69 /** 70 * Sets the number of histogram events were inserted in database during Ad counter histogram 71 * updater process. 72 */ setNumberOfInsertedEvent(int value)73 public abstract Builder setNumberOfInsertedEvent(int value); 74 75 /** 76 * Sets the number of histogram events were evicted from database during Ad counter 77 * histogram updater process. 78 */ setNumberOfEvictedEvent(int value)79 public abstract Builder setNumberOfEvictedEvent(int value); 80 81 /** Returns an instance of {@link AdCounterHistogramUpdaterReportedStats} */ build()82 public abstract AdCounterHistogramUpdaterReportedStats build(); 83 } 84 } 85