1 /*
2  * Copyright (C) 2023 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.cobalt;
18 
19 import com.google.common.util.concurrent.ListenableFuture;
20 
21 import java.util.List;
22 
23 /** The API for logging metrics with Cobalt. */
24 public interface CobaltLogger {
25     /**
26      * Logs an event for an OCCURRENCE metric.
27      *
28      * @param metricId registered ID of the OCCURRENCE metric which the event occurred for
29      * @param count number of occurrences
30      * @param eventVector registered events codes of the event which occurred
31      * @return An optional ListenableFuture that is ready when logging completes
32      */
logOccurrence(long metricId, long count, List<Integer> eventVector)33     ListenableFuture<Void> logOccurrence(long metricId, long count, List<Integer> eventVector);
34 
35     /**
36      * Logs an event for a STRING metric.
37      *
38      * @param metricId registered ID of the STRING metric which the event occurred for
39      * @param stringValue the string to log
40      * @param eventVector registered events codes of the event which occurred
41      * @return An optional ListenableFuture that is ready when logging completes
42      */
logString(long metricId, String stringValue, List<Integer> eventVector)43     ListenableFuture<Void> logString(long metricId, String stringValue, List<Integer> eventVector);
44 }
45