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.kanon; 18 19 import android.annotation.Nullable; 20 21 import com.google.auto.value.AutoValue; 22 23 @AutoValue 24 public abstract class KAnonImmediateSignJoinStatusStats { 25 /** Result of the KAnon background job. */ getKAnonJobResult()26 public abstract int getKAnonJobResult(); 27 28 /** Number of messages that were attempted to be signed/joined in this background run. */ getTotalMessagesAttempted()29 public abstract int getTotalMessagesAttempted(); 30 31 /** Number of failed messages during the sign process in this background run. */ 32 @Nullable getMessagesFailedToSign()33 public abstract Integer getMessagesFailedToSign(); 34 35 /** Number of failed messages during the join process in this background run. */ 36 @Nullable getMessagesFailedToJoin()37 public abstract Integer getMessagesFailedToJoin(); 38 39 /** Latency for this KAnon background run. */ getLatencyInMs()40 public abstract int getLatencyInMs(); 41 builder()42 public static Builder builder() { 43 return new AutoValue_KAnonImmediateSignJoinStatusStats.Builder() 44 .setMessagesFailedToJoin(0) 45 .setMessagesFailedToSign(0); 46 } 47 48 @AutoValue.Builder 49 public abstract static class Builder { 50 /** Sets the kanonJobResult field */ setKAnonJobResult(int jobResult)51 public abstract Builder setKAnonJobResult(int jobResult); 52 53 /** Sets the totalMessagesAttempted field. */ setTotalMessagesAttempted(int totalMessagesAttempted)54 public abstract Builder setTotalMessagesAttempted(int totalMessagesAttempted); 55 56 /** Sets the number of messages failed in the sign process. */ setMessagesFailedToSign(@ullable Integer messagesFailedToSign)57 public abstract Builder setMessagesFailedToSign(@Nullable Integer messagesFailedToSign); 58 59 /** Sets the number of messages failed in the join process. */ setMessagesFailedToJoin(@ullable Integer messagesFailedToJoin)60 public abstract Builder setMessagesFailedToJoin(@Nullable Integer messagesFailedToJoin); 61 62 /** Sets the latency of the background job. */ setLatencyInMs(int latencyInMs)63 public abstract Builder setLatencyInMs(int latencyInMs); 64 build()65 public abstract KAnonImmediateSignJoinStatusStats build(); 66 } 67 } 68